info
large_stringlengths
120
50k
question
large_stringlengths
504
10.4k
avg@8_qwen3_4b_instruct_2507
float64
0
0.88
{"tests": "{\"inputs\": [\"abaabbabaab`abbabbabaabbab\\nab\", \"AABABCAC\\nB\", \"AbCdEfG\\naBcDeFh\", \"abaabbbbaab`abbabbabaabaab\\nab\", \"AACABCAC\\nB\", \"AbGdEfC\\naBcDeFh\", \"abaabbbbaab`abbabbabaabaab\\n`b\", \"AACABCAC\\nC\", \"AbGdEfC\\naBcDhFe\", \"abaabbbbaaa`abbabbabbabaab\\n`b\", \"AACAACAC\\nC\", \"AbGdEfC\\naBcChFe\", \"abaabbbaaab`abbabbabbabaab\\n`b\", \"@ACAACAC\\nC\", \"AbGdEfC\\naBcCeFh\", \"abaabbbaaab`abbabbabbabaab\\nab\", \"AbGdEfC\\naecCBFh\", \"abaabbbaaab`abbabbabbabaab\\nb`\", \"AbGdEfC\\naechBFC\", \"baababbabbabba`baaabbbaaba\\nb`\", \"AbGdEfC\\nbechBFC\", \"baababbabbabca`baaabbbaaba\\nb`\", \"CfEdGbA\\nbechBFC\", \"baababbabbabda`baaabbbaaba\\nb`\", \"CfEdGbA\\nCFBhceb\", \"baababbabbabda`baaabbbaaba\\nc`\", \"CgEdGbA\\nCFBhceb\", \"baababbabbabda`baaabbbaaba\\n`c\", \"AbGdEgC\\nCFBhceb\", \"abaabbbaaab`adbabbabbabaab\\nc`\", \"AbGdFgC\\nCFBhceb\", \"abaabbbaaab`adbabbabbabaab\\nc_\", \"AbdGFgC\\nCFBhceb\", \"abaabbbaaab`adbabbabbabaac\\nc_\", \"AbGeFgC\\nCFBhceb\", \"abaabbbaaaa`adbabbabbabaac\\nc_\", \"gbGeFAC\\nCFBhceb\", \"abaabbbaaaa`adbabb`bbabaac\\nc_\", \"gbGeFAC\\nbechBFC\", \"abaabbbaaaa`adbabb`bbabaac\\nc^\", \"CAFeGbg\\nbechBFC\", \"abaabbbaaaa`adbabb`bbabaac\\nc]\", \"CAFeGbg\\nCFBhceb\", \"abaabbbaaaa`adbabb`bbabaac\\nc\\\\\", \"gbGeFAC\\nCFBhcea\", \"abaabbbaaaa`adbabb`bbabaac\\nd\\\\\", \"gbGeFBC\\nCFBhcea\", \"caababb`bbabda`aaaabbbaaba\\nd\\\\\", \"gbGfFBC\\nCFBhcea\", \"caababb`bbabda`baaababaaba\\nd\\\\\", \"hbGfFBC\\nCFBhcea\", \"caababb`bbabda`baabbabaaba\\nd\\\\\", \"hbGfFBC\\naechBFC\", \"caababb`bbabda`baabbabaaba\\nc\\\\\", \"hbGfFBC\\nhecaBFC\", \"abaababbaab`adbabb`bbabaac\\nc\\\\\", \"hbGfFBC\\ncehaBFC\", \"caababb`bbabda`baabbabaaba\\nc]\", \"hbGfFBC\\nCFBahec\", \"caababb`bbabda`baabbbbaaba\\nc]\", \"CBFfGbh\\ncehaBFC\", \"caababb`bbabda`baabbbbaaba\\nd]\", \"CBFfGah\\ncehaBFC\", \"caababb`bbabda`baabbbbaaba\\nd^\", \"CBFeGah\\ncehaBFC\", \"caababb`bbabda`baabbbbaaba\\nd_\", \"CBFeGah\\nceCaBFh\", \"caababbabbabda`baabbbbaaba\\nd_\", \"CBFeGah\\naeCcBFh\", \"caababbabbabda`baabbbbaaba\\nd^\", \"CBFeGah\\naeCcBGh\", \"ca`babbabbabda`baabbbbaaba\\nd^\", \"CBFeGah\\naeDcBGh\", \"ca`babbbbbabda`baabbbbaaba\\nd^\", \"CBFeGah\\nhGBcDea\", \"ca`babbbbbabda`baabcbbaaba\\nd^\", \"CBFeGah\\nhGBDcea\", \"ca`bbbbbbbabda`baabcbbaaba\\nd^\", \"CBeFGah\\nhGBDcea\", \"ca`bbbbbbbabda`baabcbbaaba\\nc^\", \"CBfFGah\\nhGBDcea\", \"cabbbbbbbbabda``aabcbbaaba\\nc^\", \"CBfFGah\\naecDBGh\", \"cabbbbbbbbabda``aabcbbaaba\\n^c\", \"CBfFGah\\naDceBGh\", \"cabbbbbbbbabda``aabcbbbaba\\nc^\", \"BBfFGah\\naDceBGh\", \"cabbbbbbbbabd`a`aabcbbbaba\\nc^\", \"BFfBGah\\naDceBGh\", \"ababbbcbaa`a`dbabbbbbbbbac\\nc^\", \"BFfBGah\\naEceBGh\", \"ababbbcbaa`a`dbabbbbbbbbac\\n^c\", \"BFfBGah\\naEceBhG\", \"ababbbcbaa`a`dbabbbbbbbbac\\nc]\", \"BhfBGaF\\naEceBhG\", \"cabbbbbbbbabd`a`aabcbbbaba\\nc]\", \"BhfBGaF\\naEGeBhc\", \"cabbbbcbbbabd`a`aabcbbbaba\\nc]\", \"BhfBGaF\\naEGeBgc\", \"cabbbbcbbbabd`a`aabcbbbaba\\n]c\", \"abaabbabaabaabbabbabaabbab\\nab\", \"AABABCAC\\nA\", \"AbCdEfG\\naBcDeFg\"], \"outputs\": [\"2\\n\", \"1\\n\", \"0\\n\", \"2\\n\", \"1\\n\", \"0\\n\", \"1\\n\", \"2\\n\", \"0\\n\", \"1\\n\", \"2\\n\", \"0\\n\", \"1\\n\", \"2\\n\", \"0\\n\", \"2\\n\", \"0\\n\", \"1\\n\", \"0\\n\", \"1\\n\", \"0\\n\", \"1\\n\", \"0\\n\", \"1\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"3\", \"2\", \"0\"]}", "source": "primeintellect"}
Problem Given the strings $ s $, $ t $. First, let the string set $ A = $ {$ s $}, $ B = \ phi $. At this time, I want to perform the following operations as much as possible. operation step1 Perform the following processing for all $ u ∊ A $. 1. From all subsequences of $ u $ (not necessarily contiguous), choose any one that is equal to $ t $. Let the indexes corresponding to $ u $ of the selected subsequence be $ z_1 $, $ z_2 $,…, $ z_ {| t |} $ (however, 1 $ \ le $ $ z_1 $ $ \ lt $ $ z_2). $$ \ lt $… $ \ lt $ $ z_ {| t |} $ $ \ le $ $ | u | $). If there is no such subsequence, the operation ends. 2. Divide the original string with the selected substring characters $ u_ {z_1} $, $ u_ {z_2} $,…, $ u_ {z_ {| t |}} $ and convert them to $ B $ to add. For example, in the case of $ u = $ "abcdcd" and $ t = $ "ac", the following two division methods can be considered. If you choose the first and third characters of $ u $, it will be split into "", "b" and "dcd". If you choose the first and fifth characters of $ u $, it will be split into "", "bcd" and "d". step2 Replace $ A $ with $ B $ and empty $ B $. Increase the number of operations by 1. Subsequence example The subsequences of "abac" are {"", "a", "b", "c", "aa", "ab", "ac", "ba", "bc", "aac", "aba" "," abc "," bac "," abac "}. "a" is a subsequence created by extracting the first or third character of "abac". "ac" is a subsequence created by extracting the 1st and 4th characters of "abac" or the 3rd and 4th characters. Constraints The input satisfies the following conditions. * 1 $ \ le $ $ | t | $ $ \ le $ $ | s | $ $ \ le $ $ 10 ^ 5 $ * Characters contained in the strings $ s $ and $ t $ are uppercase or lowercase letters of the alphabet Input The input is given in the following format. $ s $ $ t $ The string $ s $ is given on the first line, and the string $ t $ is given on the second line. Output Output the maximum number of operations. Examples Input AABABCAC A Output 2 Input abaabbabaabaabbabbabaabbab ab Output 3 Input AbCdEfG aBcDeFg Output 0 Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0.125
{"tests": "{\"inputs\": [[8], [1], [-2], [-1], [0]], \"outputs\": [[\"8 is more than zero.\"], [\"1 is more than zero.\"], [\"-2 is equal to or less than zero.\"], [\"-1 is equal to or less than zero.\"], [\"0 is equal to or less than zero.\"]]}", "source": "primeintellect"}
Correct this code so that it takes one argument, `x`, and returns "`x` is more than zero" if `x` is positive (and nonzero), and otherwise, returns "`x` is equal to or less than zero." In both cases, replace `x` with the actual value of `x`. Write your solution by modifying this code: ```python def corrections(x): ``` Your solution should implemented in the function "corrections". The i Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [[[1, 2, 4, 7, 11]], [[0, 1, 2, 3, 100000]], [[0, 1, 2, 100000, 4]], [[0, 1, 100000, 3, 4]], [[0, 100000, 2, 3, 4]]], \"outputs\": [[\"Non-linear sequence\"], [\"Non-linear sequence\"], [\"Non-linear sequence\"], [\"Non-linear sequence\"], [\"Non-linear sequence\"]]}", "source": "primeintellect"}
This is a follow-up from my previous Kata which can be found here: http://www.codewars.com/kata/5476f4ca03810c0fc0000098 This time, for any given linear sequence, calculate the function [f(x)] and return it as a function in Javascript or Lambda/Block in Ruby. For example: ```python get_function([0, 1, 2, 3, 4])(5) => 5 get_function([0, 3, 6, 9, 12])(10) => 30 get_function([1, 4, 7, 10, 13])(20) => 61 ``` Assumptions for this kata are: ``` The sequence argument will always contain 5 values equal to f(0) - f(4). The function will always be in the format "nx +/- m", 'x +/- m', 'nx', 'x' or 'm' If a non-linear sequence simply return 'Non-linear sequence' for javascript, ruby, and python. For C#, throw an ArgumentException. ``` Write your solution by modifying this code: ```python def get_function(sequence): ``` Your solution should implemented in the function "get_function". The i Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [\"20 228 779 225 819 142 849 24 494 45 172 95 207 908 510 424 78 100 166 869 456\\n\", \"4 220 380 729 969\\n\", \"23 486 261 249 312 592 411 874 397 18 70 417 512 338 679 517 997 938 328 418 793 522 745 59\\n\", \"17 644 532 255 57 108 413 51 284 364 300 597 646 712 470 42 730 231\\n\", \"16 29 672 601 178 603 860 6 431 114 463 588 788 712 956 895 19\\n\", \"26 932 569 829 138 565 766 466 673 559 678 417 618 930 751 840 184 809 639 287 550 923 341 851 209 987 252\\n\", \"5 336 860 760 835 498\\n\", \"22 196 690 553 822 392 687 425 763 216 73 525 412 155 263 205 965 825 105 153 580 218 103\\n\", \"19 702 667 743 976 908 728 134 106 380 193 214 71 920 114 587 543 817 248 537\\n\", \"41 473 219 972 591 238 267 209 464 467 916 814 40 625 105 820 496 54 297 264 523 570 828 418 527 299 509 269 156 663 562 900 826 471 561 416 710 828 315 864 985 230\\n\", \"12 378 724 582 387 583 241 294 159 198 653 369 418\\n\", \"100 768 386 927 48 730 113 255 362 942 394 33 323 165 231 290 249 820 379 775 763 813 796 688 744 701 787 339 81 566 573 363 333 650 980 382 379 783 327 432 724 722 155 47 577 386 27 827 206 406 601 659 219 86 346 963 787 823 301 558 389 565 921 412 214 590 484 283 372 812 715 787 533 871 524 109 947 551 626 843 958 917 502 176 2 538 829 479 51 820 36 130 384 647 542 288 236 26 572 609 838\\n\", \"55 980 951 933 349 865 252 836 585 313 392 431 751 354 656 496 601 497 885 865 976 786 300 638 211 678 152 645 281 654 187 517 633 137 139 672 692 81 507 968 84 589 398 835 944 744 331 234 931 906 99 906 691 89 234 592\\n\", \"3 287 979 395\\n\", \"10 5 659 259 120 421 165 194 637 577 39\\n\", \"14 36 901 516 623 703 971 304 394 491 525 464 219 183 648\\n\", \"100 715 309 432 153 350 568 147 107 606 211 173 658 636 657 167 891 846 911 810 882 842 617 696 277 752 680 364 97 389 602 859 794 601 290 947 952 548 784 58 154 995 923 502 320 579 359 901 424 270 711 997 802 17 692 79 769 371 443 867 760 735 725 553 335 705 190 977 252 974 35 96 659 648 599 669 226 648 570 341 918 971 337 410 988 719 489 446 89 622 312 540 46 727 783 381 431 663 48 374 327\\n\", \"100 299 824 225 296 650 282 360 130 136 93 651 610 411 842 516 272 200 380 711 512 460 805 390 651 99 536 524 176 479 613 28 468 126 254 765 777 226 124 597 363 218 247 663 629 780 870 901 980 249 301 491 399 106 572 740 205 107 264 71 276 877 791 745 3 44 509 470 961 323 66 13 541 3 367 860 783 236 451 762 175 752 944 574 858 515 313 753 312 577 515 588 454 305 22 147 39 221 617 1000 545\\n\", \"11 739 752 364 649 626 702 444 913 681 529 959\\n\", \"100 452 788 556 679 978 638 30 543 322 697 368 789 691 825 653 96 169 4 287 968 99 209 392 270 855 700 288 682 757 788 394 209 265 951 888 242 588 918 785 600 305 843 78 686 667 732 472 837 426 759 494 216 969 886 486 513 275 464 886 32 942 279 932 207 920 819 449 197 427 925 798 422 457 566 107 124 988 579 651 414 337 144 320 996 721 806 509 686 960 394 408 902 363 339 108 283 849 247 480 275\\n\", \"100 862 968 697 319 224 494 133 211 763 784 315 99 618 635 786 28 130 985 715 90 68 122 992 431 152 99 404 0 36 575 275 899 542 662 217 456 846 350 668 608 824 673 707 131 308 182 160 438 166 565 218 234 377 209 356 529 999 760 529 35 334 494 624 567 846 841 22 691 881 380 298 394 53 696 215 51 878 375 489 735 630 398 659 7 607 14 536 296 465 756 21 799 249 645 365 786 485 78 476 55\\n\", \"5 472 4 724 577 157\\n\", \"19 26 380 823 787 422 605 306 298 885 562 249 965 277 124 365 56 175 144 309\\n\", \"100 734 968 887 495 799 585 459 391 559 684 572 569 874 375 726 187 519 400 241 382 636 28 339 260 533 233 638 497 283 76 821 17 43 707 512 533 291 662 924 540 35 185 800 599 250 525 786 769 616 27 150 251 746 180 512 969 103 149 465 386 916 976 403 960 683 606 182 664 958 796 204 993 981 3 591 230 218 66 689 834 784 840 85 529 710 597 497 503 746 652 889 661 318 983 310 691 278 182 354 235\\n\", \"15 254 996 341 109 402 688 501 206 905 398 124 373 313 943 515\\n\", \"100 458 775 449 511 160 354 252 37 730 432 462 49 830 121 56 126 826 283 422 290 38 443 780 978 87 835 763 262 913 930 317 371 394 456 572 554 811 825 281 230 256 744 970 776 555 26 902 380 1000 324 361 37 457 140 705 545 975 158 497 578 87 505 949 171 651 210 725 151 725 5 71 671 749 41 446 994 67 38 374 66 362 425 794 509 565 188 744 229 346 241 807 123 746 445 294 86 346 709 238 70\\n\", \"100 977 395 60 537 919 860 484 159 486 326 116 92 518 983 95 747 501 264 798 321 301 928 395 948 469 374 875 185 636 173 22 612 568 82 149 176 633 323 335 118 339 142 901 858 124 686 604 626 951 91 637 251 709 722 889 177 95 453 363 731 626 75 33 193 849 182 59 481 505 395 289 844 537 189 391 351 876 685 667 826 466 994 767 174 716 345 352 501 799 405 923 424 480 956 308 18 828 367 499 22\\n\", \"3 887 104 641\\n\", \"4 802 765 992 1\\n\", \"57 817 933 427 116 51 69 125 687 717 688 307 594 927 643 17 638 823 482 184 525 943 161 318 226 296 419 632 478 97 697 370 915 320 797 30 371 556 847 748 272 224 746 557 151 388 264 789 211 746 663 426 688 825 744 914 811 853\\n\", \"29 384 110 78 925 320 755 176 690 784 848 981 653 140 840 659 262 954 812 850 431 523 495 16 233 70 352 92 520 877\\n\", \"19 196 392 738 103 119 872 900 189 65 113 260 985 228 537 217 735 785 445 636\\n\", \"100 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000\\n\", \"21 256 260 390 24 185 400 780 51 89 253 900 760 906 730 599 565 992 243 66 531 364\\n\", \"10 136 641 472 872 115 607 197 19 494 577\\n\", \"41 595 215 495 884 470 176 126 536 398 181 816 114 251 328 901 674 933 206 662 507 458 601 162 735 725 217 481 591 51 791 355 646 696 540 530 165 717 346 391 114 527\\n\", \"48 25 856 782 535 41 527 832 306 49 91 824 158 618 122 357 887 969 710 138 868 536 610 118 642 9 946 958 873 931 878 549 646 733 20 180 775 547 11 771 287 103 594 135 411 406 492 989 375\\n\", \"100 373 704 776 376 70 326 850 997 777 611 171 528 244 745 76 449 748 519 451 15 33 730 159 338 752 306 377 974 613 67 208 986 461 984 51 221 309 901 217 776 202 388 304 136 823 70 586 260 589 36 275 623 766 434 651 208 430 28 181 42 786 389 718 246 62 770 467 62 670 684 838 562 762 832 699 274 902 284 224 181 10 500 804 467 624 454 675 54 172 546 96 958 625 505 203 687 274 360 439 634\\n\", \"45 657 700 898 830 795 104 427 995 219 505 95 385 64 241 196 318 927 228 428 329 606 619 535 200 707 660 574 19 292 88 872 950 788 769 779 272 563 896 267 782 400 52 857 154 293\\n\", \"100 774 470 986 421 759 654 647 407 914 678 14 574 705 424 561 423 603 7 203 224 9 743 270 737 215 342 858 569 80 231 896 854 392 881 274 150 224 611 247 829 289 953 402 994 376 654 417 670 351 310 584 360 743 545 787 958 887 645 526 657 876 421 510 267 992 784 108 907 84 355 735 373 307 136 57 374 480 164 43 831 474 317 191 216 862 668 864 438 312 80 94 188 501 604 145 183 77 253 89 162\\n\", \"20 228 779 225 819 142 849 29 494 45 172 95 207 908 510 424 78 100 166 869 456\\n\", \"4 220 380 1127 969\\n\", \"23 486 261 249 312 592 411 874 397 18 70 417 512 338 679 517 997 398 328 418 793 522 745 59\\n\", \"17 644 532 255 57 108 413 51 284 364 300 597 646 130 470 42 730 231\\n\", \"26 932 236 829 138 565 766 466 673 559 678 417 618 930 751 840 184 809 639 287 550 923 341 851 209 987 252\\n\", \"5 336 860 760 835 933\\n\", \"22 196 690 553 916 392 687 425 763 216 73 525 412 155 263 205 965 825 105 153 580 218 103\\n\", \"19 702 667 743 976 908 164 134 106 380 193 214 71 920 114 587 543 817 248 537\\n\", \"41 473 219 972 591 238 267 209 464 467 916 814 40 625 105 614 496 54 297 264 523 570 828 418 527 299 509 269 156 663 562 900 826 471 561 416 710 828 315 864 985 230\\n\", \"12 378 724 582 387 296 241 294 159 198 653 369 418\\n\", \"100 768 386 927 48 730 113 255 362 942 394 33 323 165 231 290 249 820 379 775 763 813 796 688 744 701 787 339 81 566 573 363 333 650 980 382 379 783 327 432 724 722 155 47 577 386 27 827 206 406 601 659 219 86 346 963 787 823 301 558 389 565 921 412 214 590 484 283 372 812 715 787 533 871 524 109 947 551 626 843 958 917 502 176 2 538 829 479 51 820 36 130 384 647 542 288 236 26 244 609 838\\n\", \"55 980 951 933 349 865 252 836 585 313 392 431 751 354 656 496 601 497 885 865 976 177 300 638 211 678 152 645 281 654 187 517 633 137 139 672 692 81 507 968 84 589 398 835 944 744 331 234 931 906 99 906 691 89 234 592\\n\", \"3 452 979 395\\n\", \"10 5 665 259 120 421 165 194 637 577 39\\n\", \"14 36 901 516 140 703 971 304 394 491 525 464 219 183 648\\n\", \"100 715 309 864 153 350 568 147 107 606 211 173 658 636 657 167 891 846 911 810 882 842 617 696 277 752 680 364 97 389 602 859 794 601 290 947 952 548 784 58 154 995 923 502 320 579 359 901 424 270 711 997 802 17 692 79 769 371 443 867 760 735 725 553 335 705 190 977 252 974 35 96 659 648 599 669 226 648 570 341 918 971 337 410 988 719 489 446 89 622 312 540 46 727 783 381 431 663 48 374 327\\n\", \"100 299 824 225 296 650 282 360 130 136 93 651 610 411 842 516 272 200 380 711 512 460 805 390 651 99 536 524 176 479 613 28 468 126 254 765 777 226 124 597 363 218 247 663 629 780 870 901 980 249 301 491 399 106 572 740 205 107 264 71 276 877 791 745 3 44 509 470 961 323 66 13 541 3 367 860 783 236 451 762 175 752 944 574 858 515 313 753 312 577 515 817 454 305 22 147 39 221 617 1000 545\\n\", \"11 875 752 364 649 626 702 444 913 681 529 959\\n\", \"100 452 788 556 679 978 638 30 543 322 697 368 789 691 825 653 96 169 4 287 968 99 209 392 270 855 700 288 682 757 788 394 209 265 951 888 242 588 918 785 600 305 843 78 686 667 732 472 837 426 759 494 216 969 886 486 513 275 464 886 32 942 279 932 207 920 819 449 197 427 925 798 422 457 566 107 124 988 579 651 407 337 144 320 996 721 806 509 686 960 394 408 902 363 339 108 283 849 247 480 275\\n\", \"100 862 968 697 319 224 494 133 211 763 784 315 99 618 635 786 28 130 985 715 90 68 122 992 431 152 99 404 0 36 575 275 899 542 662 217 456 846 350 668 608 824 673 707 131 308 182 160 438 166 565 218 234 377 209 356 529 1137 760 529 35 334 494 624 567 846 841 22 691 881 380 298 394 53 696 215 51 878 375 489 735 630 398 659 7 607 14 536 296 465 756 21 799 249 645 365 786 485 78 476 55\\n\", \"5 519 4 724 577 157\\n\", \"19 26 380 823 787 422 605 306 134 885 562 249 965 277 124 365 56 175 144 309\\n\", \"100 734 968 887 495 799 585 459 391 559 684 572 569 874 375 726 187 519 400 57 382 636 28 339 260 533 233 638 497 283 76 821 17 43 707 512 533 291 662 924 540 35 185 800 599 250 525 786 769 616 27 150 251 746 180 512 969 103 149 465 386 916 976 403 960 683 606 182 664 958 796 204 993 981 3 591 230 218 66 689 834 784 840 85 529 710 597 497 503 746 652 889 661 318 983 310 691 278 182 354 235\\n\", \"15 254 996 360 109 402 688 501 206 905 398 124 373 313 943 515\\n\", \"100 458 775 449 511 160 354 252 37 730 432 462 49 830 121 56 126 826 283 422 290 38 443 780 978 87 835 763 262 913 930 317 371 394 456 572 554 811 825 281 230 256 744 970 776 555 26 902 380 1000 324 361 37 457 140 705 545 975 240 497 578 87 505 949 171 651 210 725 151 725 5 71 671 749 41 446 994 67 38 374 66 362 425 794 509 565 188 744 229 346 241 807 123 746 445 294 86 346 709 238 70\\n\", \"100 977 395 60 537 919 860 484 159 486 326 116 92 518 983 95 747 501 264 798 321 301 928 395 948 469 374 875 185 636 173 22 612 568 82 149 176 633 323 335 118 339 142 901 858 124 686 604 626 951 91 637 251 709 722 889 177 95 220 363 731 626 75 33 193 849 182 59 481 505 395 289 844 537 189 391 351 876 685 667 826 466 994 767 174 716 345 352 501 799 405 923 424 480 956 308 18 828 367 499 22\\n\", \"4 802 765 992 0\\n\", \"57 817 933 427 116 18 69 125 687 717 688 307 594 927 643 17 638 823 482 184 525 943 161 318 226 296 419 632 478 97 697 370 915 320 797 30 371 556 847 748 272 224 746 557 151 388 264 789 211 746 663 426 688 825 744 914 811 853\\n\", \"29 384 110 78 925 320 755 176 690 784 848 981 653 140 840 659 262 954 812 983 431 523 495 16 233 70 352 92 520 877\\n\", \"19 196 392 738 103 119 872 900 189 65 113 260 985 228 537 217 735 785 445 616\\n\", \"100 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1010 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000\\n\", \"21 256 260 390 24 185 400 780 51 89 253 107 760 906 730 599 565 992 243 66 531 364\\n\", \"10 136 641 753 872 115 607 197 19 494 577\\n\", \"41 595 215 495 884 470 176 126 536 398 160 816 114 251 328 901 674 933 206 662 507 458 601 162 735 725 217 481 591 51 791 355 646 696 540 530 165 717 346 391 114 527\\n\", \"48 25 856 782 535 41 527 832 306 49 91 824 158 618 122 357 887 969 710 138 868 536 610 118 642 9 946 958 881 931 878 549 646 733 20 180 775 547 11 771 287 103 594 135 411 406 492 989 375\\n\", \"100 373 704 776 376 70 326 850 997 777 611 171 403 244 745 76 449 748 519 451 15 33 730 159 338 752 306 377 974 613 67 208 986 461 984 51 221 309 901 217 776 202 388 304 136 823 70 586 260 589 36 275 623 766 434 651 208 430 28 181 42 786 389 718 246 62 770 467 62 670 684 838 562 762 832 699 274 902 284 224 181 10 500 804 467 624 454 675 54 172 546 96 958 625 505 203 687 274 360 439 634\\n\", \"45 657 700 898 830 795 104 427 995 219 505 95 385 64 241 196 318 927 228 428 329 606 619 535 200 707 660 574 19 292 88 872 950 788 769 779 272 563 896 102 782 400 52 857 154 293\\n\", \"100 774 470 986 421 759 654 647 407 914 678 14 574 705 424 561 423 603 7 203 224 9 743 270 737 215 342 858 569 80 183 896 854 392 881 274 150 224 611 247 829 289 953 402 994 376 654 417 670 351 310 584 360 743 545 787 958 887 645 526 657 876 421 510 267 992 784 108 907 84 355 735 373 307 136 57 374 480 164 43 831 474 317 191 216 862 668 864 438 312 80 94 188 501 604 145 183 77 253 89 162\\n\", \"4 1 1 3 4\\n\", \"20 228 779 225 819 142 849 29 494 45 172 95 207 908 510 424 78 100 166 869 511\\n\", \"4 220 380 756 969\\n\", \"23 486 261 160 312 592 411 874 397 18 70 417 512 338 679 517 997 398 328 418 793 522 745 59\\n\", \"17 644 532 255 57 108 413 51 284 364 300 597 646 208 470 42 730 231\\n\", \"26 932 236 829 138 565 766 466 673 559 678 417 618 930 751 840 184 809 639 287 550 923 341 851 209 987 52\\n\", \"5 498 860 760 835 933\\n\", \"22 196 690 553 916 516 687 425 763 216 73 525 412 155 263 205 965 825 105 153 580 218 103\\n\", \"19 702 667 743 976 908 164 134 106 380 193 214 71 920 107 587 543 817 248 537\\n\", \"41 473 219 972 591 238 267 209 464 467 916 814 40 625 105 614 496 54 297 264 523 849 828 418 527 299 509 269 156 663 562 900 826 471 561 416 710 828 315 864 985 230\\n\", \"12 378 724 582 387 296 241 294 159 198 653 369 83\\n\", \"100 768 386 927 48 730 113 255 362 942 394 33 323 165 231 290 249 820 379 775 763 813 796 688 744 701 787 339 81 566 573 363 333 650 980 382 379 783 327 432 724 722 155 47 577 386 27 827 206 406 601 659 219 86 387 963 787 823 301 558 389 565 921 412 214 590 484 283 372 812 715 787 533 871 524 109 947 551 626 843 958 917 502 176 2 538 829 479 51 820 36 130 384 647 542 288 236 26 244 609 838\\n\", \"55 980 951 933 349 865 252 836 585 313 392 431 751 354 656 496 601 621 885 865 976 177 300 638 211 678 152 645 281 654 187 517 633 137 139 672 692 81 507 968 84 589 398 835 944 744 331 234 931 906 99 906 691 89 234 592\\n\", \"3 452 979 51\\n\", \"10 5 665 259 120 421 165 49 637 577 39\\n\", \"14 36 901 516 140 703 971 323 394 491 525 464 219 183 648\\n\", \"100 715 309 864 153 350 568 147 107 606 211 173 658 636 657 167 891 846 911 810 882 842 617 696 277 752 680 364 97 389 602 859 794 601 290 947 952 548 784 58 154 995 923 502 320 579 359 901 424 270 711 997 802 17 692 79 769 371 443 867 760 735 725 553 335 705 190 977 252 974 35 96 659 648 599 669 226 648 570 83 918 971 337 410 988 719 489 446 89 622 312 540 46 727 783 381 431 663 48 374 327\\n\", \"100 299 824 225 296 650 282 556 130 136 93 651 610 411 842 516 272 200 380 711 512 460 805 390 651 99 536 524 176 479 613 28 468 126 254 765 777 226 124 597 363 218 247 663 629 780 870 901 980 249 301 491 399 106 572 740 205 107 264 71 276 877 791 745 3 44 509 470 961 323 66 13 541 3 367 860 783 236 451 762 175 752 944 574 858 515 313 753 312 577 515 817 454 305 22 147 39 221 617 1000 545\\n\", \"11 875 752 364 649 626 702 444 1444 681 529 959\\n\", \"100 452 788 556 679 978 638 30 543 322 697 368 789 691 825 653 96 169 4 287 702 99 209 392 270 855 700 288 682 757 788 394 209 265 951 888 242 588 918 785 600 305 843 78 686 667 732 472 837 426 759 494 216 969 886 486 513 275 464 886 32 942 279 932 207 920 819 449 197 427 925 798 422 457 566 107 124 988 579 651 407 337 144 320 996 721 806 509 686 960 394 408 902 363 339 108 283 849 247 480 275\\n\", \"100 862 968 697 319 224 494 133 211 763 784 315 99 618 635 786 28 130 985 715 90 68 122 992 431 152 99 404 0 36 575 275 899 542 662 217 456 846 350 668 608 824 673 707 131 308 182 160 438 166 565 218 234 377 209 356 529 1137 760 529 35 334 494 624 567 846 841 22 691 881 380 298 394 53 696 215 51 878 375 489 735 630 398 659 7 607 14 536 296 465 756 21 799 257 645 365 786 485 78 476 55\\n\", \"5 519 2 724 577 157\\n\", \"19 26 380 823 787 422 605 306 134 885 562 249 965 277 124 365 56 328 144 309\\n\", \"100 734 968 887 495 799 585 459 391 559 684 572 569 874 375 726 187 519 400 57 382 636 28 339 260 533 233 638 497 283 76 821 17 43 707 436 533 291 662 924 540 35 185 800 599 250 525 786 769 616 27 150 251 746 180 512 969 103 149 465 386 916 976 403 960 683 606 182 664 958 796 204 993 981 3 591 230 218 66 689 834 784 840 85 529 710 597 497 503 746 652 889 661 318 983 310 691 278 182 354 235\\n\", \"15 254 996 360 109 402 688 501 206 905 398 124 373 152 943 515\\n\", \"100 458 775 449 511 160 354 252 37 730 432 462 36 830 121 56 126 826 283 422 290 38 443 780 978 87 835 763 262 913 930 317 371 394 456 572 554 811 825 281 230 256 744 970 776 555 26 902 380 1000 324 361 37 457 140 705 545 975 240 497 578 87 505 949 171 651 210 725 151 725 5 71 671 749 41 446 994 67 38 374 66 362 425 794 509 565 188 744 229 346 241 807 123 746 445 294 86 346 709 238 70\\n\", \"100 977 395 60 537 919 860 484 159 486 326 116 92 518 983 95 747 501 264 798 321 301 928 395 948 469 374 875 185 636 173 22 612 568 82 149 176 633 323 335 118 339 142 901 481 124 686 604 626 951 91 637 251 709 722 889 177 95 220 363 731 626 75 33 193 849 182 59 481 505 395 289 844 537 189 391 351 876 685 667 826 466 994 767 174 716 345 352 501 799 405 923 424 480 956 308 18 828 367 499 22\\n\", \"4 802 765 1034 0\\n\", \"57 817 933 427 116 18 69 125 687 717 688 307 594 927 643 17 638 823 482 184 525 943 161 318 226 296 419 632 478 97 697 370 915 320 797 30 371 556 847 748 272 224 414 557 151 388 264 789 211 746 663 426 688 825 744 914 811 853\\n\", \"29 384 110 78 925 320 755 176 690 784 848 981 653 23 840 659 262 954 812 983 431 523 495 16 233 70 352 92 520 877\\n\", \"19 380 392 738 103 119 872 900 189 65 113 260 985 228 537 217 735 785 445 616\\n\", \"100 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1010 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1100 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000\\n\", \"21 256 260 390 24 185 400 780 51 89 253 107 73 906 730 599 565 992 243 66 531 364\\n\", \"10 136 641 753 872 115 607 197 19 291 577\\n\", \"41 595 215 495 884 470 176 126 536 398 160 816 114 251 328 901 674 933 206 151 507 458 601 162 735 725 217 481 591 51 791 355 646 696 540 530 165 717 346 391 114 527\\n\", \"48 25 856 782 535 41 527 832 306 49 91 824 158 618 122 357 887 969 710 138 868 536 610 118 642 9 946 958 881 931 878 549 646 733 20 180 775 547 11 771 28 103 594 135 411 406 492 989 375\\n\", \"100 373 704 776 376 70 326 850 997 777 611 171 403 244 745 76 449 748 519 451 15 33 730 159 338 752 306 377 974 613 67 208 986 461 984 51 221 309 901 217 776 202 388 304 136 823 70 586 260 589 36 275 623 766 434 651 208 430 28 181 42 786 389 718 246 62 770 467 62 670 684 838 562 988 832 699 274 902 284 224 181 10 500 804 467 624 454 675 54 172 546 96 958 625 505 203 687 274 360 439 634\\n\", \"45 657 700 898 830 795 104 427 995 219 648 95 385 64 241 196 318 927 228 428 329 606 619 535 200 707 660 574 19 292 88 872 950 788 769 779 272 563 896 102 782 400 52 857 154 293\\n\", \"100 774 470 986 421 759 654 647 407 914 678 14 574 705 424 561 423 603 7 203 224 9 743 270 737 215 342 858 569 80 183 896 854 392 881 274 150 224 611 247 829 289 953 402 994 376 654 417 670 351 310 584 360 743 545 536 958 887 645 526 657 876 421 510 267 992 784 108 907 84 355 735 373 307 136 57 374 480 164 43 831 474 317 191 216 862 668 864 438 312 80 94 188 501 604 145 183 77 253 89 162\\n\", \"4 2 1 3 4\\n\", \"20 228 779 225 819 142 849 29 494 45 172 95 207 908 510 424 68 100 166 869 511\\n\", \"4 220 360 756 969\\n\", \"23 242 261 160 312 592 411 874 397 18 70 417 512 338 679 517 997 398 328 418 793 522 745 59\\n\", \"4 1 2 3 4\\n\"], \"outputs\": [\"78186\", \"7043\", \"141284\", \"61016\", \"73502\", \"207547\", \"10166\", \"96555\", \"87024\", \"463602\", \"30198\", \"2547238\", \"810147\", \"3430\", \"17712\", \"49351\", \"2688801\", \"2316930\", \"45653\", \"2696135\", \"2232342\", \"5745\", \"67719\", \"2604711\", \"57959\", \"2200721\", \"2437955\", \"3018\", \"5312\", \"900997\", \"216056\", \"92576\", \"5050000\", \"114365\", \"22286\", \"406104\", \"597376\", \"2297827\", \"507143\", \"2204266\", \"78221\\n\", \"8237\\n\", \"132104\\n\", \"53450\\n\", \"206881\\n\", \"12341\\n\", \"96931\\n\", \"83640\\n\", \"460512\\n\", \"28763\\n\", \"2515094\\n\", \"797358\\n\", \"3595\\n\", \"17724\\n\", \"47419\\n\", \"2690097\\n\", \"2337769\\n\", \"45789\\n\", \"2695575\\n\", \"2240208\\n\", \"5792\\n\", \"66407\\n\", \"2601215\\n\", \"58016\\n\", \"2205477\\n\", \"2424441\\n\", \"5308\\n\", \"900832\\n\", \"218583\\n\", \"92196\\n\", \"5050320\\n\", \"105642\\n\", \"23129\\n\", \"405894\\n\", \"597600\\n\", \"2296327\\n\", \"500708\\n\", \"2202826\\n\", \"28\\n\", \"79321\\n\", \"7124\\n\", \"131837\\n\", \"54464\\n\", \"201681\\n\", \"12503\\n\", \"97551\\n\", \"83542\\n\", \"466371\\n\", \"24743\\n\", \"2517308\\n\", \"799466\\n\", \"2563\\n\", \"16709\\n\", \"47552\\n\", \"2669715\\n\", \"2339141\\n\", \"50037\\n\", \"2690255\\n\", \"2240952\\n\", \"5788\\n\", \"69008\\n\", \"2598555\\n\", \"55923\\n\", \"2205321\\n\", \"2407853\\n\", \"5434\\n\", \"886888\\n\", \"217062\\n\", \"92380\\n\", \"5057220\\n\", \"97398\\n\", \"21302\\n\", \"396185\\n\", \"587240\\n\", \"2312825\\n\", \"502138\\n\", \"2189021\\n\", \"29\\n\", \"79161\\n\", \"7084\\n\", \"131593\\n\", \"30\"]}", "source": "primeintellect"}
How to make a cake you'll never eat. Ingredients. * 2 carrots * 0 calories * 100 g chocolate spread * 1 pack of flour * 1 egg Method. 1. Put calories into the mixing bowl. 2. Take carrots from refrigerator. 3. Chop carrots. 4. Take chocolate spread from refrigerator. 5. Put chocolate spread into the mixing bowl. 6. Combine pack of flour into the mixing bowl. 7. Fold chocolate spread into the mixing bowl. 8. Add chocolate spread into the mixing bowl. 9. Put pack of flour into the mixing bowl. 10. Add egg into the mixing bowl. 11. Fold pack of flour into the mixing bowl. 12. Chop carrots until choped. 13. Pour contents of the mixing bowl into the baking dish. Serves 1. Input The only line of input contains a sequence of integers a0, a1, ... (1 ≤ a0 ≤ 100, 0 ≤ ai ≤ 1000 for i ≥ 1). Output Output a single integer. Examples Input 4 1 2 3 4 Output 30 Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0.625
{"tests": "{\"inputs\": [[\"Abcd1234\"], [\"Abcd123\"], [\"abcd1234\"], [\"AbcdefGhijKlmnopQRsTuvwxyZ1234567890\"], [\"ABCD1234\"], [\"Ab1!@#$%^&*()-_+={}[]|\\\\:;?/>.<,\"], [\"!@#$%^&*()-_+={}[]|\\\\:;?/>.<,\"], [\"\"], [\" aA1----\"], [\"4aA1----\"]], \"outputs\": [[true], [false], [false], [true], [false], [true], [false], [false], [true], [true]]}", "source": "primeintellect"}
## Description Your job is to create a simple password validation function, as seen on many websites. The rules for a valid password are as follows: - There needs to be at least 1 uppercase letter. - There needs to be at least 1 lowercase letter. - There needs to be at least 1 number. - The password needs to be at least 8 characters long. You are permitted to use any methods to validate the password. ## Examples: ### Extra info - You will only be passed strings. - The string can contain any standard keyboard character. - Accepted strings can be any length, as long as they are 8 characters or more. Write your solution by modifying this code: ```python def password(string): ``` Your solution should implemented in the function "password". The i Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [\"55\\n\", \"46\\n\", \"16\\n\", \"53\\n\", \"99\\n\", \"87\\n\", \"3\\n\", \"47\\n\", \"62\\n\", \"6\\n\", \"11\\n\", \"93\\n\", \"89\\n\", \"34\\n\", \"38\\n\", \"22\\n\", \"85\\n\", \"25\\n\", \"82\\n\", \"26\\n\", \"74\\n\", \"100\\n\", \"51\\n\", \"69\\n\", \"7\\n\", \"95\\n\", \"23\\n\", \"59\\n\", \"64\\n\", \"91\\n\", \"97\\n\", \"18\\n\", \"65\\n\", \"13\\n\", \"9\\n\", \"58\\n\", \"30\\n\", \"96\\n\", \"36\\n\", \"49\\n\", \"86\\n\", \"4\\n\", \"12\\n\", \"81\\n\", \"8\\n\", \"2\\n\", \"94\\n\", \"43\\n\", \"101\\n\", \"10\\n\", \"15\\n\", \"115\\n\", \"80\\n\", \"1\\n\", \"29\\n\", \"40\\n\", \"0\\n\", \"21\\n\", \"-1\\n\", \"105\\n\", \"39\\n\", \"32\\n\", \"41\\n\", \"149\\n\", \"14\\n\", \"152\\n\", \"35\\n\", \"202\\n\", \"000\\n\", \"-2\\n\", \"131\\n\", \"-4\\n\", \"142\\n\", \"17\\n\", \"111\\n\", \"56\\n\", \"27\\n\", \"121\\n\", \"-7\\n\", \"128\\n\", \"5\\n\", \"19\\n\", \"44\\n\", \"45\\n\", \"126\\n\", \"-8\\n\", \"31\\n\", \"-5\\n\", \"-3\\n\", \"20\\n\", \"50\\n\", \"-6\\n\", \"-12\\n\", \"146\\n\", \"no\\nyes\\nno\\nnn\\nno\\n\", \"24\\n\", \"001\\n\", \"28\\n\", \"-9\\n\", \"113\\n\", \"61\\n\", \"-21\\n\", \"48\\n\", \"no\\nyes\\nno\\nno\\nno\\n\", \"yes\\nno\\nyes\\n\"], \"outputs\": [\"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\n4\\n9\\n25\\n49\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\n4\\n9\\n25\\n49\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\n4\\n9\\n25\\n49\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\n4\\n9\\n25\\n49\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\n4\\n9\\n25\\n49\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\n4\\n9\\n25\\n49\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\n4\\n9\\n25\\n49\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\n4\\n9\\n25\\n49\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\n4\\n9\\n25\\n49\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\n4\\n9\\n25\\n49\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\n4\\n9\\n25\\n49\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\n4\\n9\\n25\\n49\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\n4\\n9\\n25\\n49\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\n4\\n9\\n25\\n49\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\n4\\n9\\n25\\n49\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\n4\\n9\\n25\\n49\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\n4\\n9\\n25\\n49\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\n4\\n9\\n25\\n49\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\n4\\n9\\n25\\n49\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\n4\\n9\\n25\\n49\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\n4\\n9\\n25\\n49\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\n4\\n9\\n25\\n49\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\n4\\n9\\n25\\n49\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\n4\\n9\\n25\\n49\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\n4\\n9\\n25\\n49\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\n4\\n9\\n25\\n49\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\n4\\n9\\n25\\n49\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\n4\\n9\\n25\\n49\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\n4\\n9\\n25\\n49\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\n4\\n9\\n25\\n49\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\n4\\n9\\n25\\n49\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\n4\\n9\\n25\\n49\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\n4\\n9\\n25\\n49\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\n4\\n9\\n25\\n49\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\n4\\n9\\n25\\n49\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\n4\\n9\\n25\\n49\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\n4\\n9\\n25\\n49\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\n4\\n9\\n25\\n49\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\n4\\n9\\n25\\n49\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\n4\\n9\\n25\\n49\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\n4\\n9\\n25\\n49\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\n4\\n9\\n25\\n49\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\n4\\n9\\n25\\n49\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\n4\\n9\\n25\\n49\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\n4\\n9\\n25\\n49\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\n4\\n9\\n25\\n49\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\n4\\n9\\n25\\n49\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\n4\\n9\\n25\\n49\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\n4\\n9\\n25\\n49\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\n4\\n9\\n25\\n49\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\n4\\n9\\n25\\n49\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\n4\\n9\\n25\\n49\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\n4\\n9\\n25\\n49\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\n4\\n9\\n25\\n49\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\n4\\n9\\n25\\n49\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\n4\\n9\\n25\\n49\\nprime\\n\", \"2\\n3\\n5\\n7\\n11\\n13\\n17\\n19\\n23\\n29\\n31\\n37\\n41\\n43\\n47\\n4\\n9\\n25\\n49\\nprime\\n\", \"2\\n3\\n5\\ncomposite\"]}", "source": "primeintellect"}
This is an interactive problem. In the output section below you will see the information about flushing the output. Bear Limak thinks of some hidden number — an integer from interval [2, 100]. Your task is to say if the hidden number is prime or composite. Integer x > 1 is called prime if it has exactly two distinct divisors, 1 and x. If integer x > 1 is not prime, it's called composite. You can ask up to 20 queries about divisors of the hidden number. In each query you should print an integer from interval [2, 100]. The system will answer "yes" if your integer is a divisor of the hidden number. Otherwise, the answer will be "no". For example, if the hidden number is 14 then the system will answer "yes" only if you print 2, 7 or 14. When you are done asking queries, print "prime" or "composite" and terminate your program. You will get the Wrong Answer verdict if you ask more than 20 queries, or if you print an integer not from the range [2, 100]. Also, you will get the Wrong Answer verdict if the printed answer isn't correct. You will get the Idleness Limit Exceeded verdict if you don't print anything (but you should) or if you forget about flushing the output (more info below). Input After each query you should read one string from the input. It will be "yes" if the printed integer is a divisor of the hidden number, and "no" otherwise. Output Up to 20 times you can ask a query — print an integer from interval [2, 100] in one line. You have to both print the end-of-line character and flush the output. After flushing you should read a response from the input. In any moment you can print the answer "prime" or "composite" (without the quotes). After that, flush the output and terminate your program. To flush you can use (just after printing an integer and end-of-line): * fflush(stdout) in C++; * System.out.flush() in Java; * stdout.flush() in Python; * flush(output) in Pascal; * See the documentation for other languages. Hacking. To hack someone, as the input you should print the hidden number — one integer from the interval [2, 100]. Of course, his/her solution won't be able to read the hidden number from the input. Examples Input yes no yes Output 2 80 5 composite Input no yes no no no Output 58 59 78 78 2 prime Note The hidden number in the first query is 30. In a table below you can see a better form of the provided example of the communication process. <image> The hidden number is divisible by both 2 and 5. Thus, it must be composite. Note that it isn't necessary to know the exact value of the hidden number. In this test, the hidden number is 30. <image> 59 is a divisor of the hidden number. In the interval [2, 100] there is only one number with this divisor. The hidden number must be 59, which is prime. Note that the answer is known even after the second query and you could print it then and terminate. Though, it isn't forbidden to ask unnecessary queries (unless you exceed the limit of 20 queries). Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [\"4\\n4\\n1 5\\n2 4\\n2 3\\n3 4\\n5\\n1 5\\n2 3\\n2 5\\n3 5\\n2 2\\n3\\n1 3\\n2 4\\n2 3\\n7\\n1 10\\n2 8\\n2 5\\n3 4\\n4 4\\n6 8\\n7 7\\n\", \"1\\n1\\n1 200000\\n\", \"1\\n1\\n100000 100001\\n\", \"1\\n1\\n100000 100001\\n\", \"1\\n1\\n1 200000\\n\", \"1\\n1\\n1 99274\\n\", \"4\\n4\\n1 5\\n2 4\\n2 3\\n3 4\\n5\\n1 5\\n2 3\\n2 5\\n3 5\\n2 2\\n3\\n1 3\\n2 4\\n2 3\\n7\\n1 10\\n2 8\\n0 5\\n3 4\\n4 4\\n6 8\\n7 7\\n\", \"1\\n1\\n1 22517\\n\", \"1\\n1\\n1 7974\\n\", \"1\\n1\\n1 7964\\n\", \"1\\n1\\n1 15088\\n\", \"1\\n1\\n1 19102\\n\", \"1\\n1\\n2 200000\\n\", \"1\\n1\\n2 99274\\n\", \"1\\n1\\n2 22517\\n\", \"1\\n1\\n1 12431\\n\", \"1\\n1\\n2 7964\\n\", \"1\\n1\\n2 15088\\n\", \"1\\n1\\n2 64316\\n\", \"1\\n1\\n2 77\\n\", \"1\\n1\\n2 2502\\n\", \"1\\n1\\n4 15088\\n\", \"1\\n1\\n3 64316\\n\", \"1\\n1\\n2 71\\n\", \"1\\n1\\n4 27790\\n\", \"1\\n1\\n3 18584\\n\", \"1\\n1\\n4 16410\\n\", \"1\\n1\\n3 26085\\n\", \"1\\n1\\n5 16410\\n\", \"1\\n1\\n7 16410\\n\", \"1\\n1\\n7 19314\\n\", \"1\\n1\\n13 19314\\n\", \"1\\n1\\n13 30599\\n\", \"1\\n1\\n13 34075\\n\", \"1\\n1\\n13 22692\\n\", \"1\\n1\\n3 22692\\n\", \"1\\n1\\n4 22692\\n\", \"1\\n1\\n1 109488\\n\", \"1\\n1\\n4 22517\\n\", \"1\\n1\\n1 20933\\n\", \"1\\n1\\n1 251\\n\", \"1\\n1\\n2 40312\\n\", \"1\\n1\\n3 7964\\n\", \"1\\n1\\n3 15088\\n\", \"1\\n1\\n3 125786\\n\", \"1\\n1\\n3 15616\\n\", \"1\\n1\\n5 26864\\n\", \"1\\n1\\n7 15271\\n\", \"1\\n1\\n14 19314\\n\", \"1\\n1\\n2 19314\\n\", \"1\\n1\\n6 30599\\n\", \"1\\n1\\n24 34075\\n\", \"1\\n1\\n3 6566\\n\", \"1\\n1\\n7 22692\\n\", \"1\\n1\\n4 28041\\n\", \"1\\n1\\n1 390\\n\", \"1\\n1\\n6 15088\\n\", \"1\\n1\\n3 178631\\n\", \"1\\n1\\n3 12343\\n\", \"1\\n1\\n5 27920\\n\", \"1\\n1\\n14 14399\\n\", \"1\\n1\\n6 5829\\n\", \"1\\n1\\n24 29513\\n\", \"1\\n1\\n3 13129\\n\", \"4\\n4\\n1 5\\n2 4\\n2 3\\n3 4\\n5\\n1 5\\n2 3\\n2 5\\n3 5\\n2 2\\n3\\n1 3\\n2 4\\n2 3\\n7\\n1 10\\n2 8\\n2 5\\n3 4\\n4 4\\n6 8\\n7 7\\n\"], \"outputs\": [\"3\\n4\\n2\\n7\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"3\\n4\\n2\\n6\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"3\\n4\\n2\\n7\\n\"]}", "source": "primeintellect"}
You are given $n$ segments on a coordinate axis $OX$. The $i$-th segment has borders $[l_i; r_i]$. All points $x$, for which $l_i \le x \le r_i$ holds, belong to the $i$-th segment. Your task is to choose the maximum by size (the number of segments) subset of the given set of segments such that each pair of segments in this subset either non-intersecting or one of them lies inside the other one. Two segments $[l_i; r_i]$ and $[l_j; r_j]$ are non-intersecting if they have no common points. For example, segments $[1; 2]$ and $[3; 4]$, $[1; 3]$ and $[5; 5]$ are non-intersecting, while segments $[1; 2]$ and $[2; 3]$, $[1; 2]$ and $[2; 2]$ are intersecting. The segment $[l_i; r_i]$ lies inside the segment $[l_j; r_j]$ if $l_j \le l_i$ and $r_i \le r_j$. For example, segments $[2; 2]$, $[2, 3]$, $[3; 4]$ and $[2; 4]$ lie inside the segment $[2; 4]$, while $[2; 5]$ and $[1; 4]$ are not. You have to answer $t$ independent test cases. -----Input----- The first line of the input contains one integer $t$ ($1 \le t \le 1000$) — the number of test cases. Then $t$ test cases follow. The first line of the test case contains one integer $n$ ($1 \le n \le 3000$) — the number of segments. The next $n$ lines describe segments. The $i$-th segment is given as two integers $l_i$ and $r_i$ ($1 \le l_i \le r_i \le 2 \cdot 10^5$), where $l_i$ is the left border of the $i$-th segment and $r_i$ is the right border of the $i$-th segment. Additional constraint on the input: there are no duplicates in the list of segments. It is guaranteed that the sum of $n$ does not exceed $3000$ ($\sum n \le 3000$). -----Output----- For each test case, print the answer: the maximum possible size of the subset of the given set of segments such that each pair of segments in this subset either non-intersecting or one of them lies inside the other one. -----Example----- Input 4 4 1 5 2 4 2 3 3 4 5 1 5 2 3 2 5 3 5 2 2 3 1 3 2 4 2 3 7 1 10 2 8 2 5 3 4 4 4 6 8 7 7 Output 3 4 2 7 Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [\"3\\n4\\n3 4 3 3\\n-1 1 2 2\\n-1 2 2 3\\n2\\n5 6\\n-1 5\\n-1 1\\n3\\n3 5 2\\n-1 1 1\\n-1 3 5\\n\", \"3\\n4\\n3 4 3 3\\n-1 1 2 2\\n-1 2 2 3\\n2\\n5 6\\n-1 5\\n0 1\\n3\\n3 5 2\\n-1 1 1\\n-1 3 5\\n\", \"3\\n4\\n3 4 3 3\\n-1 1 2 2\\n-1 2 2 3\\n2\\n5 9\\n-1 5\\n0 1\\n3\\n3 5 2\\n-1 1 1\\n-1 3 5\\n\", \"3\\n4\\n3 4 3 4\\n-1 1 2 2\\n-1 2 2 3\\n2\\n5 9\\n-1 5\\n0 1\\n3\\n3 5 2\\n-1 1 1\\n-1 3 5\\n\", \"3\\n4\\n3 4 3 3\\n-1 1 2 2\\n-1 2 2 3\\n2\\n5 6\\n-1 5\\n-1 1\\n3\\n3 5 2\\n-1 2 1\\n-1 3 5\\n\", \"3\\n4\\n3 4 3 8\\n-1 1 2 2\\n-1 2 2 3\\n2\\n5 9\\n-1 5\\n0 1\\n3\\n3 5 2\\n-1 1 1\\n-1 3 5\\n\", \"3\\n4\\n3 4 3 3\\n-1 1 2 2\\n-1 2 2 3\\n2\\n5 6\\n-1 1\\n0 1\\n3\\n3 5 2\\n-1 1 1\\n-1 3 5\\n\", \"3\\n4\\n3 8 3 4\\n-1 1 2 2\\n-1 2 2 3\\n2\\n5 9\\n-1 5\\n0 1\\n3\\n3 5 2\\n-1 1 1\\n-1 3 5\\n\", \"3\\n4\\n1 6 3 8\\n-1 2 3 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1 1 6 2\\n-1 2 2 3\\n2\\n5 9\\n-1 1\\n0 1\\n3\\n3 5 2\\n-1 1 1\\n-1 3 5\\n\", \"3\\n4\\n1 6 3 8\\n-1 2 4 2\\n-1 2 3 3\\n2\\n5 9\\n-1 5\\n-1 1\\n3\\n3 5 2\\n-1 1 1\\n-1 3 5\\n\", \"3\\n4\\n1 6 3 8\\n-1 4 6 2\\n-1 2 2 3\\n2\\n5 9\\n-1 5\\n-1 1\\n3\\n3 7 2\\n-1 1 1\\n-1 3 5\\n\", \"3\\n4\\n3 4 3 3\\n-1 1 2 2\\n-1 2 2 3\\n2\\n5 6\\n-1 5\\n-1 1\\n3\\n3 5 2\\n-1 1 1\\n-1 3 5\\n\"], \"outputs\": [\"7\\n11\\n8\\n\", \"7\\n11\\n8\\n\", \"7\\n14\\n8\\n\", \"8\\n14\\n8\\n\", \"7\\n11\\n7\\n\", \"12\\n14\\n8\\n\", \"7\\n7\\n8\\n\", \"10\\n14\\n8\\n\", \"18\\n14\\n8\\n\", \"16\\n14\\n8\\n\", \"16\\n10\\n8\\n\", \"18\\n10\\n8\\n\", \"10\\n11\\n8\\n\", \"6\\n14\\n8\\n\", \"18\\n14\\n10\\n\", \"16\\n14\\n10\\n\", \"10\\n15\\n8\\n\", \"12\\n14\\n6\\n\", \"14\\n14\\n6\\n\", \"12\\n11\\n8\\n\", \"7\\n19\\n8\\n\", \"8\\n13\\n8\\n\", \"8\\n11\\n7\\n\", \"12\\n14\\n10\\n\", \"20\\n10\\n8\\n\", \"9\\n14\\n8\\n\", \"12\\n14\\n9\\n\", \"17\\n14\\n10\\n\", \"10\\n11\\n10\\n\", \"12\\n14\\n12\\n\", \"10\\n15\\n10\\n\", \"12\\n10\\n6\\n\", \"10\\n15\\n9\\n\", \"19\\n14\\n10\\n\", \"14\\n21\\n6\\n\", \"15\\n14\\n10\\n\", \"7\\n11\\n12\\n\", \"12\\n19\\n8\\n\", \"20\\n14\\n8\\n\", \"10\\n11\\n12\\n\", \"12\\n9\\n6\\n\", \"10\\n18\\n9\\n\", \"15\\n14\\n12\\n\", \"18\\n14\\n12\\n\", \"20\\n10\\n13\\n\", \"20\\n14\\n10\\n\", \"12\\n12\\n6\\n\", \"7\\n11\\n16\\n\", \"7\\n11\\n23\\n\", \"11\\n11\\n8\\n\", \"13\\n14\\n8\\n\", \"19\\n14\\n8\\n\", \"18\\n17\\n8\\n\", \"16\\n19\\n8\\n\", \"15\\n11\\n8\\n\", \"15\\n14\\n8\\n\", \"16\\n14\\n13\\n\", \"12\\n9\\n8\\n\", \"16\\n14\\n12\\n\", \"12\\n13\\n6\\n\", \"14\\n14\\n8\\n\", \"12\\n14\\n11\\n\", \"10\\n18\\n10\\n\", \"11\\n14\\n8\\n\", \"12\\n10\\n8\\n\", \"7\\n11\\n11\\n\", \"18\\n13\\n10\\n\", \"6\\n11\\n7\\n\", \"8\\n14\\n11\\n\", \"8\\n15\\n8\\n\", \"17\\n14\\n12\\n\", \"18\\n13\\n6\\n\", \"10\\n15\\n11\\n\", \"7\\n14\\n6\\n\", \"20\\n10\\n10\\n\", \"17\\n10\\n8\\n\", \"23\\n14\\n10\\n\", \"19\\n10\\n13\\n\", \"16\\n19\\n7\\n\", \"10\\n11\\n7\\n\", \"18\\n14\\n11\\n\", \"16\\n16\\n8\\n\", \"12\\n14\\n14\\n\", \"10\\n15\\n13\\n\", \"10\\n18\\n11\\n\", \"20\\n11\\n10\\n\", \"29\\n14\\n10\\n\", \"17\\n12\\n6\\n\", \"7\\n17\\n12\\n\", \"21\\n19\\n7\\n\", \"12\\n22\\n14\\n\", \"7\\n18\\n11\\n\", \"23\\n11\\n10\\n\", \"12\\n11\\n7\\n\", \"12\\n22\\n11\\n\", \"7\\n18\\n15\\n\", \"17\\n22\\n11\\n\", \"10\\n15\\n15\\n\", \"7\\n18\\n16\\n\", \"20\\n11\\n17\\n\", \"7\\n14\\n9\\n\", \"18\\n14\\n7\\n\", \"16\\n9\\n8\\n\", \"10\\n10\\n8\\n\", \"18\\n10\\n11\\n\", \"7\\n15\\n7\\n\", \"15\\n15\\n8\\n\", \"12\\n14\\n7\\n\", \"16\\n14\\n16\\n\", \"12\\n16\\n6\\n\", \"13\\n14\\n6\\n\", \"16\\n22\\n10\\n\", \"8\\n14\\n7\\n\", \"9\\n11\\n8\\n\", \"18\\n8\\n8\\n\", \"17\\n19\\n8\\n\", \"21\\n14\\n8\\n\", \"15\\n14\\n14\\n\", \"16\\n11\\n12\\n\", \"12\\n9\\n7\\n\", \"20\\n9\\n13\\n\", \"7\\n12\\n16\\n\", \"12\\n14\\n8\\n\", \"7\\n11\\n7\\n\", \"12\\n14\\n8\\n\", \"12\\n14\\n8\\n\", \"7\\n7\\n8\\n\", \"12\\n14\\n8\\n\", \"12\\n14\\n8\\n\", \"18\\n10\\n8\\n\", \"7\\n14\\n8\\n\", \"12\\n14\\n8\\n\", \"7\\n11\\n7\\n\", \"12\\n14\\n8\\n\", \"18\\n14\\n8\\n\", \"10\\n11\\n8\\n\", \"8\\n14\\n8\\n\", \"12\\n14\\n8\\n\", \"16\\n14\\n10\\n\", \"12\\n14\\n8\\n\", \"16\\n14\\n10\\n\", \"10\\n15\\n8\\n\", \"16\\n14\\n10\\n\", \"10\\n15\\n8\\n\", \"12\\n14\\n6\\n\", \"16\\n14\\n10\\n\", \"16\\n14\\n10\\n\", \"12\\n14\\n8\\n\", \"7\\n11\\n7\\n\", \"12\\n14\\n8\\n\", \"12\\n14\\n8\\n\", \"12\\n14\\n8\\n\", \"7\\n11\\n8\\n\", \"7\\n14\\n8\\n\", \"18\\n14\\n8\\n\", \"10\\n15\\n8\\n\", \"12\\n14\\n6\\n\", \"12\\n14\\n8\\n\", \"20\\n10\\n8\\n\", \"9\\n14\\n8\\n\", \"7\\n14\\n8\\n\", \"17\\n14\\n10\\n\", \"12\\n14\\n12\\n\", \"10\\n11\\n12\\n\", \"20\\n10\\n8\\n\", \"12\\n14\\n8\\n\", \"19\\n14\\n10\\n\", \"12\\n14\\n12\\n\", \"12\\n9\\n6\\n\", \"10\\n11\\n12\\n\", \"12\\n14\\n8\\n\", \"12\\n14\\n12\\n\", \"7\\n11\\n12\\n\", \"20\\n10\\n13\\n\", \"9\\n14\\n8\\n\", \"18\\n14\\n10\\n\", \"7\\n11\\n12\\n\", \"18\\n14\\n10\\n\", \"7\\n11\\n16\\n\", \"12\\n14\\n8\\n\", \"12\\n14\\n8\\n\", \"7\\n7\\n8\\n\", \"12\\n14\\n8\\n\", \"12\\n14\\n12\\n\", \"16\\n10\\n8\\n\", \"18\\n10\\n8\\n\", \"7\\n14\\n8\\n\", \"7\\n11\\n7\\n\", \"18\\n14\\n10\\n\", \"8\\n14\\n8\\n\", \"17\\n14\\n10\\n\", \"10\\n15\\n8\\n\", \"16\\n14\\n10\\n\", \"14\\n14\\n6\\n\", \"16\\n14\\n13\\n\", \"12\\n11\\n8\\n\", \"12\\n14\\n8\\n\", \"12\\n14\\n9\\n\", \"20\\n10\\n8\\n\", \"18\\n14\\n8\\n\", \"17\\n14\\n10\\n\", \"\\n7\\n11\\n8\\n\"]}", "source": "primeintellect"}
You have $n$ chains, the $i$-th chain consists of $c_i$ vertices. Vertices in each chain are numbered independently from $1$ to $c_i$ along the chain. In other words, the $i$-th chain is the undirected graph with $c_i$ vertices and $(c_i - 1)$ edges connecting the $j$-th and the $(j + 1)$-th vertices for each $1 \le j < c_i$. Now you decided to unite chains in one graph in the following way: the first chain is skipped; the $1$-st vertex of the $i$-th chain is connected by an edge with the $a_i$-th vertex of the $(i - 1)$-th chain; the last ($c_i$-th) vertex of the $i$-th chain is connected by an edge with the $b_i$-th vertex of the $(i - 1)$-th chain. Picture of the first test case. Dotted lines are the edges added during uniting process Calculate the length of the longest simple cycle in the resulting graph. A simple cycle is a chain where the first and last vertices are connected as well. If you travel along the simple cycle, each vertex of this cycle will be visited exactly once. -----Input----- The first line contains a single integer $t$ ($1 \le t \le 1000$) — the number of test cases. The first line of each test case contains the single integer $n$ ($2 \le n \le 10^5$) — the number of chains you have. The second line of each test case contains $n$ integers $c_1, c_2, \dots, c_n$ ($2 \le c_i \le 10^9$) — the number of vertices in the corresponding chains. The third line of each test case contains $n$ integers $a_1, a_2, \dots, a_n$ ($a_1 = -1$; $1 \le a_i \le c_{i - 1}$). The fourth line of each test case contains $n$ integers $b_1, b_2, \dots, b_n$ ($b_1 = -1$; $1 \le b_i \le c_{i - 1}$). Both $a_1$ and $b_1$ are equal to $-1$, they aren't used in graph building and given just for index consistency. It's guaranteed that the sum of $n$ over all test cases doesn't exceed $10^5$. -----Output----- For each test case, print the length of the longest simple cycle. -----Examples----- Input 3 4 3 4 3 3 -1 1 2 2 -1 2 2 3 2 5 6 -1 5 -1 1 3 3 5 2 -1 1 1 -1 3 5 Output 7 11 8 -----Note----- In the first test case, the longest simple cycle is shown below: We can't increase it with the first chain, since in such case it won't be simple — the vertex $2$ on the second chain will break simplicity. Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [\"4\\n5 2 6 10 8 3\\n1 7\\n2 10 4\\n2 9 5\\n\", \"5\\n3 12 10 19\\n5 1 4 18 11 13\\n4 17 15 2 6\\n4 3 12 18 10\\n4 2 8 5 9\\n\", \"10\\n1 77966\\n1 79480\\n1 94920\\n1 53920\\n1 15585\\n1 57339\\n1 1585\\n1 91802\\n1 27934\\n1 20354\\n\", \"5\\n3 2 4 10\\n2 1 6\\n2 8 7\\n3 2 4 10\\n2 1 6\\n\", \"3\\n2 1 2\\n2 3 4\\n2 5 6\\n\", \"3\\n1 1\\n1 2\\n1 3\\n\", \"20\\n3 9 18 16\\n6 13 5 11 3 15 7\\n5 16 20 8 9 12\\n7 15 19 3 7 10 14 1\\n3 13 4 11\\n6 15 8 14 3 17 1\\n4 9 19 2 16\\n3 3 10 14\\n4 1 15 18 16\\n3 3 19 6\\n2 15 16\\n7 12 14 1 2 10 6 11\\n2 7 17\\n5 2 12 1 19 6\\n10 18 10 5 7 11 20 3 13 4 8\\n6 6 2 14 15 9 16\\n9 20 7 1 13 4 11 18 12 19\\n5 2 5 6 14 8\\n6 19 1 11 20 9 10\\n4 12 7 5 8\\n\", \"20\\n5 15 40 35 68 16\\n6 70 19 28 69 63 85\\n4 37 80 41 90\\n7 11 74 35 94 55 59 64\\n7 46 28 22 90 95 37 13\\n5 62 45 87 50 94\\n6 85 83 37 72 27 53\\n6 46 56 59 71 49 33\\n7 17 35 91 24 50 30 38\\n2 75 12\\n2 46 38\\n1 61\\n11 15 79 14 89 19 96 84 26 93 83 18\\n1 75\\n6 4 100 55 59 74 83\\n5 48 44 37 12 6\\n6 68 53 28 43 10 63\\n4 30 49 86 93\\n2 62 13\\n7 25 81 8 94 10 96 71\\n\", \"3\\n5 2 7 6 9 8\\n4 10 1 5 4\\n1 3\\n\", \"4\\n5 2 6 10 8 1\\n1 7\\n2 10 4\\n2 9 5\\n\", \"10\\n1 77966\\n1 79480\\n1 94920\\n1 53920\\n1 15585\\n1 57339\\n1 1585\\n1 100869\\n1 27934\\n1 20354\\n\", \"20\\n5 15 40 35 68 16\\n6 70 19 28 69 63 85\\n4 37 80 41 90\\n7 11 74 35 94 55 59 64\\n7 46 28 22 90 95 37 13\\n5 62 45 87 50 94\\n6 85 83 37 72 27 53\\n6 46 56 59 71 49 33\\n7 17 35 91 24 50 30 38\\n2 75 12\\n2 46 38\\n1 61\\n11 15 79 14 89 19 96 84 26 93 83 18\\n1 75\\n6 4 100 55 59 62 83\\n5 48 44 37 12 6\\n6 68 53 28 43 10 63\\n4 30 49 86 93\\n2 62 13\\n7 25 81 8 94 10 96 71\\n\", \"3\\n5 2 7 6 8 8\\n4 10 1 5 4\\n1 3\\n\", \"4\\n5 2 6 10 13 1\\n1 7\\n2 10 4\\n2 9 5\\n\", \"20\\n5 15 40 35 68 16\\n6 70 19 28 69 63 1\\n4 37 80 41 90\\n7 11 148 35 94 55 59 64\\n7 46 28 22 90 95 37 13\\n5 62 45 25 50 94\\n6 85 83 37 72 27 53\\n6 46 56 59 71 49 33\\n7 17 35 91 24 50 30 38\\n2 75 12\\n2 46 38\\n1 61\\n11 15 79 14 89 20 96 84 26 93 83 18\\n1 75\\n6 4 100 55 59 62 83\\n5 48 44 37 12 6\\n6 68 53 28 32 10 63\\n4 30 49 86 93\\n2 62 13\\n7 25 81 8 94 10 96 71\\n\", \"20\\n5 15 40 35 68 22\\n6 70 19 28 69 63 1\\n4 37 154 41 90\\n7 11 148 35 94 55 59 64\\n7 46 28 22 90 95 37 13\\n5 62 45 34 50 94\\n6 85 83 37 72 27 53\\n6 46 56 59 71 49 33\\n7 17 35 91 24 50 30 38\\n2 75 12\\n2 46 38\\n1 61\\n11 15 79 14 89 20 96 84 26 93 83 18\\n1 75\\n6 4 100 55 59 62 83\\n5 48 44 37 12 6\\n6 68 53 28 32 10 63\\n4 30 49 86 93\\n2 62 13\\n7 25 81 8 94 10 96 71\\n\", \"20\\n5 15 40 35 68 22\\n6 70 19 28 69 63 1\\n4 37 154 41 90\\n7 11 148 35 94 55 59 64\\n7 46 28 22 90 95 37 13\\n5 62 45 34 50 94\\n6 85 83 37 72 27 53\\n6 46 56 59 71 49 33\\n7 17 35 91 24 50 30 38\\n2 75 12\\n2 46 38\\n1 61\\n11 15 79 14 89 20 96 84 26 93 83 18\\n1 75\\n6 4 100 55 59 62 83\\n5 48 44 37 12 6\\n6 68 53 28 32 10 63\\n4 30 49 86 93\\n2 62 13\\n7 25 81 16 94 10 96 71\\n\", \"20\\n5 15 40 35 68 22\\n6 70 19 28 69 63 1\\n4 37 154 41 90\\n7 11 148 35 94 55 59 36\\n7 46 28 22 90 95 37 13\\n5 62 45 34 50 94\\n6 85 83 37 72 27 53\\n6 46 56 59 71 49 33\\n7 17 35 91 24 50 30 38\\n2 75 12\\n2 46 38\\n1 61\\n11 25 79 14 89 20 96 84 26 93 83 22\\n1 75\\n6 4 100 55 59 62 83\\n5 48 44 37 12 6\\n6 68 53 28 32 10 63\\n4 30 49 86 93\\n2 62 13\\n7 25 81 16 94 10 96 71\\n\", \"20\\n5 15 40 35 68 16\\n6 70 19 28 69 63 85\\n4 37 80 82 90\\n7 11 74 35 94 55 59 64\\n7 46 28 22 90 95 37 13\\n5 62 45 87 50 94\\n6 85 83 37 72 27 53\\n6 46 56 59 71 49 33\\n7 17 35 91 24 50 30 38\\n2 75 12\\n2 46 38\\n1 61\\n11 15 79 14 89 19 96 84 26 93 83 18\\n1 75\\n6 4 100 55 59 74 83\\n5 48 44 37 12 6\\n6 68 53 28 43 10 63\\n4 30 49 86 93\\n2 62 13\\n7 25 81 8 94 10 96 71\\n\", \"7\\n3 1 6 6\\n4 3 5 2 9\\n2 8 1\\n4 3 7 6 4\\n3 2 5 9\\n3 6 3 8\\n3 4 2 9\\n\", \"20\\n5 15 40 35 68 16\\n6 70 19 28 69 63 85\\n4 37 80 29 90\\n7 11 74 35 94 55 59 64\\n7 46 28 22 90 95 37 13\\n5 62 45 87 50 94\\n6 85 83 37 72 27 53\\n6 46 56 59 71 49 33\\n7 17 35 91 24 50 30 38\\n2 75 12\\n2 46 38\\n1 61\\n11 15 79 14 89 19 96 84 26 93 83 18\\n1 75\\n6 4 100 55 59 62 83\\n5 48 44 37 12 6\\n6 68 53 28 43 4 63\\n4 30 49 86 93\\n2 62 13\\n7 25 81 8 94 10 96 71\\n\", \"20\\n5 15 40 35 68 16\\n6 70 19 28 69 63 1\\n4 37 80 41 90\\n7 11 148 35 118 55 59 64\\n7 46 28 22 90 95 37 13\\n5 62 45 25 50 94\\n6 85 83 37 72 27 53\\n6 46 56 59 71 49 33\\n7 17 35 91 24 50 30 38\\n2 75 12\\n2 46 38\\n1 61\\n11 15 79 14 89 20 96 84 26 93 83 18\\n1 75\\n6 4 100 55 59 62 83\\n5 48 44 37 12 6\\n6 68 53 28 32 10 63\\n4 30 49 86 93\\n2 62 13\\n7 25 141 8 94 10 96 71\\n\", \"10\\n1 77966\\n1 79480\\n1 94920\\n1 53920\\n1 29566\\n1 57339\\n1 1585\\n1 100869\\n1 27934\\n1 20354\\n\", \"20\\n5 15 40 35 68 16\\n6 70 19 28 69 63 85\\n4 37 80 41 90\\n7 11 74 35 94 55 59 64\\n7 46 28 22 90 95 37 13\\n5 62 45 87 50 94\\n6 85 83 37 72 27 53\\n6 46 56 59 71 49 33\\n7 17 35 91 24 50 30 38\\n2 75 12\\n2 46 38\\n1 61\\n11 15 79 14 89 19 96 84 26 93 83 18\\n1 75\\n6 4 100 55 59 62 83\\n5 48 44 37 12 6\\n6 68 53 28 32 10 63\\n4 30 49 86 93\\n2 62 13\\n7 25 81 8 94 10 96 71\\n\", \"3\\n5 2 7 6 13 8\\n4 10 1 5 4\\n1 3\\n\", \"4\\n5 2 6 10 13 1\\n1 5\\n2 10 4\\n2 9 5\\n\", \"20\\n5 15 40 35 68 16\\n6 70 19 28 69 63 85\\n4 37 80 41 90\\n7 11 74 35 94 55 59 64\\n7 46 28 22 90 95 37 13\\n5 62 45 87 50 94\\n6 85 83 37 72 27 53\\n6 46 56 59 71 49 33\\n7 17 35 91 24 50 30 38\\n2 75 12\\n2 46 38\\n1 61\\n11 15 79 14 89 20 96 84 26 93 83 18\\n1 75\\n6 4 100 55 59 62 83\\n5 48 44 37 12 6\\n6 68 53 28 32 10 63\\n4 30 49 86 93\\n2 62 13\\n7 25 81 8 94 10 96 71\\n\", \"20\\n5 15 40 35 68 16\\n6 70 19 28 69 63 85\\n4 37 80 41 90\\n7 11 74 35 94 55 59 64\\n7 46 28 22 90 95 37 13\\n5 62 45 25 50 94\\n6 85 83 37 72 27 53\\n6 46 56 59 71 49 33\\n7 17 35 91 24 50 30 38\\n2 75 12\\n2 46 38\\n1 61\\n11 15 79 14 89 20 96 84 26 93 83 18\\n1 75\\n6 4 100 55 59 62 83\\n5 48 44 37 12 6\\n6 68 53 28 32 10 63\\n4 30 49 86 93\\n2 62 13\\n7 25 81 8 94 10 96 71\\n\", \"20\\n5 15 40 35 68 16\\n6 70 19 28 69 63 85\\n4 37 80 41 90\\n7 11 148 35 94 55 59 64\\n7 46 28 22 90 95 37 13\\n5 62 45 25 50 94\\n6 85 83 37 72 27 53\\n6 46 56 59 71 49 33\\n7 17 35 91 24 50 30 38\\n2 75 12\\n2 46 38\\n1 61\\n11 15 79 14 89 20 96 84 26 93 83 18\\n1 75\\n6 4 100 55 59 62 83\\n5 48 44 37 12 6\\n6 68 53 28 32 10 63\\n4 30 49 86 93\\n2 62 13\\n7 25 81 8 94 10 96 71\\n\", \"20\\n5 15 40 35 68 16\\n6 70 19 28 69 63 1\\n4 37 154 41 90\\n7 11 148 35 94 55 59 64\\n7 46 28 22 90 95 37 13\\n5 62 45 25 50 94\\n6 85 83 37 72 27 53\\n6 46 56 59 71 49 33\\n7 17 35 91 24 50 30 38\\n2 75 12\\n2 46 38\\n1 61\\n11 15 79 14 89 20 96 84 26 93 83 18\\n1 75\\n6 4 100 55 59 62 83\\n5 48 44 37 12 6\\n6 68 53 28 32 10 63\\n4 30 49 86 93\\n2 62 13\\n7 25 81 8 94 10 96 71\\n\", \"20\\n5 15 40 35 68 22\\n6 70 19 28 69 63 1\\n4 37 154 41 90\\n7 11 148 35 94 55 59 64\\n7 46 28 22 90 95 37 13\\n5 62 45 25 50 94\\n6 85 83 37 72 27 53\\n6 46 56 59 71 49 33\\n7 17 35 91 24 50 30 38\\n2 75 12\\n2 46 38\\n1 61\\n11 15 79 14 89 20 96 84 26 93 83 18\\n1 75\\n6 4 100 55 59 62 83\\n5 48 44 37 12 6\\n6 68 53 28 32 10 63\\n4 30 49 86 93\\n2 62 13\\n7 25 81 8 94 10 96 71\\n\", \"20\\n5 15 40 35 68 22\\n6 70 19 28 69 63 1\\n4 37 154 41 90\\n7 11 148 35 94 55 59 64\\n7 46 28 22 90 95 37 13\\n5 62 45 34 50 94\\n6 85 83 37 72 27 53\\n6 46 56 59 71 49 33\\n7 17 35 91 24 50 30 38\\n2 75 12\\n2 46 38\\n1 61\\n11 15 79 14 89 20 96 84 26 93 83 22\\n1 75\\n6 4 100 55 59 62 83\\n5 48 44 37 12 6\\n6 68 53 28 32 10 63\\n4 30 49 86 93\\n2 62 13\\n7 25 81 16 94 10 96 71\\n\", \"20\\n5 15 40 35 68 22\\n6 70 19 28 69 63 1\\n4 37 154 41 90\\n7 11 148 35 94 55 59 64\\n7 46 28 22 90 95 37 13\\n5 62 45 34 50 94\\n6 85 83 37 72 27 53\\n6 46 56 59 71 49 33\\n7 17 35 91 24 50 30 38\\n2 75 12\\n2 46 38\\n1 61\\n11 25 79 14 89 20 96 84 26 93 83 22\\n1 75\\n6 4 100 55 59 62 83\\n5 48 44 37 12 6\\n6 68 53 28 32 10 63\\n4 30 49 86 93\\n2 62 13\\n7 25 81 16 94 10 96 71\\n\", \"3\\n2 1 2\\n2 4 4\\n2 5 6\\n\", \"4\\n5 2 10 10 8 1\\n1 7\\n2 10 4\\n2 9 5\\n\", \"10\\n1 77966\\n1 79480\\n1 94920\\n1 53920\\n1 15585\\n1 106741\\n1 1585\\n1 100869\\n1 27934\\n1 20354\\n\", \"20\\n5 15 40 35 68 16\\n6 70 19 28 69 63 85\\n4 37 80 29 90\\n7 11 74 35 94 55 59 64\\n7 46 28 22 90 95 37 13\\n5 62 45 87 50 94\\n6 85 83 37 72 27 53\\n6 46 56 59 71 49 33\\n7 17 35 91 24 50 30 38\\n2 75 12\\n2 46 38\\n1 61\\n11 15 79 14 89 19 96 84 26 93 83 18\\n1 75\\n6 4 100 55 59 62 83\\n5 48 44 37 12 6\\n6 68 53 28 43 10 63\\n4 30 49 86 93\\n2 62 13\\n7 25 81 8 94 10 96 71\\n\", \"20\\n5 15 40 35 68 16\\n6 70 19 28 69 63 85\\n4 37 80 41 90\\n7 11 74 35 94 97 59 64\\n7 46 28 22 90 95 37 13\\n5 62 45 25 50 94\\n6 85 83 37 72 27 53\\n6 46 56 59 71 49 33\\n7 17 35 91 24 50 30 38\\n2 75 12\\n2 46 38\\n1 61\\n11 15 79 14 89 20 96 84 26 93 83 18\\n1 75\\n6 4 100 55 59 62 83\\n5 48 44 37 12 6\\n6 68 53 28 32 10 63\\n4 30 49 86 93\\n2 62 13\\n7 25 81 8 94 10 96 71\\n\", \"20\\n5 15 40 35 68 16\\n6 70 19 28 69 63 1\\n4 37 80 41 90\\n7 11 148 35 94 55 59 64\\n7 46 28 22 90 95 37 13\\n5 62 45 25 50 94\\n6 85 83 37 72 27 53\\n6 46 56 59 71 49 33\\n7 17 35 91 24 50 30 38\\n2 75 12\\n2 46 38\\n1 61\\n11 15 79 14 89 20 96 84 26 93 83 18\\n1 75\\n6 4 100 55 59 62 83\\n5 48 44 37 12 6\\n6 68 53 28 32 10 63\\n4 30 49 86 93\\n2 62 13\\n7 25 141 8 94 10 96 71\\n\", \"20\\n5 15 40 35 68 22\\n6 70 19 28 69 63 1\\n4 37 154 41 90\\n7 11 148 35 94 55 59 64\\n7 46 28 22 90 95 37 13\\n5 62 45 25 50 94\\n6 85 83 37 72 27 53\\n6 46 56 59 71 49 33\\n7 17 35 91 24 50 30 38\\n2 75 12\\n2 46 38\\n1 61\\n11 15 79 14 89 20 96 84 26 93 83 18\\n1 75\\n6 4 100 55 59 62 83\\n5 48 44 37 12 6\\n6 68 53 28 32 10 63\\n4 30 49 86 93\\n2 62 13\\n7 25 81 8 94 1 96 71\\n\", \"20\\n5 15 40 35 68 22\\n6 70 19 28 69 63 1\\n4 37 154 41 90\\n7 11 148 35 94 55 59 64\\n7 46 28 22 90 95 37 13\\n5 62 45 34 50 94\\n6 85 83 37 72 27 53\\n6 46 56 59 71 94 33\\n7 17 35 91 24 50 30 38\\n2 75 12\\n2 46 38\\n1 61\\n11 15 79 14 89 20 96 84 26 93 83 18\\n1 75\\n6 4 100 55 59 62 83\\n5 48 44 37 12 6\\n6 68 53 28 32 10 63\\n4 30 49 86 93\\n2 62 13\\n7 25 81 8 94 10 96 71\\n\", \"20\\n5 15 40 35 68 22\\n6 70 19 28 69 63 1\\n4 37 154 41 90\\n7 11 148 35 94 55 59 64\\n7 46 28 22 90 95 37 13\\n5 62 45 34 50 94\\n6 85 83 37 72 27 53\\n6 46 56 59 71 49 33\\n7 17 35 91 24 50 30 38\\n2 75 12\\n2 46 38\\n1 61\\n11 15 79 14 89 20 96 84 26 93 132 18\\n1 75\\n6 4 100 55 59 62 83\\n5 48 44 37 12 6\\n6 68 53 28 32 10 63\\n4 30 49 86 93\\n2 62 13\\n7 25 81 16 94 10 96 71\\n\", \"20\\n5 15 40 35 68 22\\n6 70 19 28 69 63 1\\n4 37 154 41 90\\n7 11 148 35 94 55 59 64\\n7 46 28 22 90 95 37 13\\n5 62 45 34 50 94\\n6 85 32 37 72 27 53\\n6 46 56 59 71 49 33\\n7 17 35 91 24 50 30 38\\n2 75 12\\n2 46 38\\n1 61\\n11 25 79 14 89 20 96 84 26 93 83 22\\n1 75\\n6 4 100 55 59 62 83\\n5 48 44 37 12 6\\n6 68 53 28 32 10 63\\n4 30 49 86 93\\n2 62 13\\n7 25 81 16 94 10 96 71\\n\", \"10\\n1 77966\\n1 79480\\n1 94920\\n1 53920\\n1 11167\\n1 106741\\n1 1585\\n1 100869\\n1 27934\\n1 20354\\n\", \"20\\n5 15 40 35 68 22\\n6 70 19 28 69 63 1\\n4 37 154 41 90\\n7 11 148 35 94 55 59 64\\n7 46 28 22 90 95 37 13\\n5 62 45 25 50 94\\n6 85 83 37 72 27 53\\n6 46 56 59 71 49 33\\n7 17 35 91 24 50 30 38\\n2 75 12\\n2 46 2\\n1 61\\n11 15 79 14 89 20 96 84 26 93 83 18\\n1 75\\n6 4 100 55 59 62 83\\n5 48 44 37 12 6\\n6 68 53 28 32 10 63\\n4 30 49 86 93\\n2 62 13\\n7 25 81 8 94 1 96 71\\n\", \"20\\n5 15 40 35 68 22\\n6 70 19 28 69 63 1\\n4 37 154 41 90\\n7 11 148 35 94 55 59 64\\n7 46 28 22 90 95 37 13\\n5 62 45 34 50 94\\n6 85 83 37 72 27 53\\n6 46 56 59 71 94 33\\n7 17 35 91 24 50 30 38\\n2 75 12\\n2 46 38\\n1 61\\n11 15 79 14 89 20 96 84 26 93 83 18\\n1 75\\n6 4 100 55 59 62 94\\n5 48 44 37 12 6\\n6 68 53 28 32 10 63\\n4 30 49 86 93\\n2 62 13\\n7 25 81 8 94 10 96 71\\n\", \"20\\n5 15 40 35 68 22\\n6 70 19 28 69 63 1\\n4 37 154 41 90\\n7 11 148 35 94 55 59 64\\n7 46 28 22 90 97 37 13\\n5 62 45 34 50 94\\n6 85 83 37 72 27 53\\n6 46 56 59 71 49 33\\n7 17 35 91 24 50 30 38\\n2 75 12\\n2 46 38\\n1 61\\n11 15 79 14 89 20 96 84 26 93 132 18\\n1 75\\n6 4 100 55 59 62 83\\n5 48 44 37 12 6\\n6 68 53 28 32 10 63\\n4 30 49 86 93\\n2 62 13\\n7 25 81 16 94 10 96 71\\n\", \"10\\n1 77966\\n1 79480\\n1 94920\\n1 53920\\n1 11167\\n1 106741\\n1 1585\\n1 104870\\n1 27934\\n1 20354\\n\", \"20\\n5 15 40 35 68 16\\n6 70 19 28 69 63 85\\n4 37 80 29 90\\n7 11 74 35 94 55 59 64\\n7 46 28 22 90 95 37 13\\n5 62 45 87 50 94\\n6 85 83 37 72 27 53\\n6 46 56 59 71 49 33\\n7 17 35 91 24 50 30 38\\n2 75 12\\n2 46 38\\n1 61\\n11 15 132 14 89 19 96 84 26 93 83 18\\n1 75\\n6 4 100 55 59 62 83\\n5 48 44 37 12 6\\n6 68 53 28 43 4 63\\n4 30 49 86 93\\n2 62 13\\n7 25 81 8 94 10 96 71\\n\", \"20\\n5 15 40 35 68 16\\n6 70 19 28 69 63 1\\n4 37 80 41 90\\n7 11 148 35 118 55 59 64\\n7 46 28 22 90 95 37 13\\n5 62 45 25 50 94\\n6 85 83 37 72 27 53\\n6 46 56 59 71 49 33\\n7 17 35 91 24 50 30 38\\n2 75 12\\n2 46 36\\n1 61\\n11 15 79 14 89 20 96 84 26 93 83 18\\n1 75\\n6 4 100 55 59 62 83\\n5 48 44 37 12 6\\n6 68 53 28 32 10 63\\n4 30 49 86 93\\n2 62 13\\n7 25 141 8 94 10 96 71\\n\", \"20\\n5 15 40 35 68 22\\n6 70 19 28 69 63 1\\n4 37 154 41 90\\n7 11 148 35 94 55 59 64\\n7 46 28 22 90 95 72 13\\n5 62 45 25 50 94\\n6 85 83 37 72 27 53\\n6 46 56 59 71 49 33\\n7 17 35 91 24 50 30 38\\n2 75 12\\n2 46 2\\n1 61\\n11 15 79 14 89 20 96 84 26 93 83 18\\n1 75\\n6 4 100 55 59 62 83\\n5 48 44 37 12 6\\n6 68 53 28 32 10 63\\n4 30 49 86 93\\n2 62 13\\n7 25 81 8 94 1 96 71\\n\", \"20\\n5 15 40 35 68 22\\n6 70 19 28 69 63 1\\n4 37 154 41 90\\n7 11 148 35 94 55 59 64\\n7 46 28 22 90 95 37 13\\n5 62 45 34 50 94\\n6 85 83 12 72 27 53\\n6 46 56 59 71 94 33\\n7 17 35 91 24 50 30 38\\n2 75 12\\n2 46 38\\n1 61\\n11 15 79 14 89 20 96 84 26 93 83 18\\n1 75\\n6 4 100 55 59 62 94\\n5 48 44 37 12 6\\n6 68 53 28 32 10 63\\n4 30 49 86 93\\n2 62 13\\n7 25 81 8 94 10 96 71\\n\", \"20\\n5 15 40 35 68 22\\n6 70 19 28 69 63 1\\n4 37 154 41 90\\n7 11 148 35 94 55 59 64\\n7 46 28 22 90 97 37 13\\n5 62 45 34 50 94\\n6 85 83 37 72 27 53\\n6 46 56 116 71 49 33\\n7 17 35 91 24 50 30 38\\n2 75 12\\n2 46 38\\n1 61\\n11 15 79 14 89 20 96 84 26 93 132 18\\n1 75\\n6 4 100 55 59 62 83\\n5 48 44 37 12 6\\n6 68 53 28 32 10 63\\n4 30 49 86 93\\n2 62 13\\n7 25 81 16 94 10 96 71\\n\", \"10\\n1 77966\\n1 79480\\n1 94920\\n1 53920\\n1 11167\\n1 106741\\n1 616\\n1 104870\\n1 27934\\n1 20354\\n\", \"20\\n5 15 40 35 68 16\\n6 70 19 28 69 63 85\\n4 37 80 29 90\\n7 11 74 35 94 55 59 64\\n7 46 37 22 90 95 37 13\\n5 62 45 87 50 94\\n6 85 83 37 72 27 53\\n6 46 56 59 71 49 33\\n7 17 35 91 24 50 30 38\\n2 75 12\\n2 46 38\\n1 61\\n11 15 132 14 89 19 96 84 26 93 83 18\\n1 75\\n6 4 100 55 59 62 83\\n5 48 44 37 12 6\\n6 68 53 28 43 4 63\\n4 30 49 86 93\\n2 62 13\\n7 25 81 8 94 10 96 71\\n\", \"20\\n5 15 40 35 68 16\\n6 70 19 28 69 63 1\\n4 37 80 6 90\\n7 11 148 35 118 55 59 64\\n7 46 28 22 90 95 37 13\\n5 62 45 25 50 94\\n6 85 83 37 72 27 53\\n6 46 56 59 71 49 33\\n7 17 35 91 24 50 30 38\\n2 75 12\\n2 46 36\\n1 61\\n11 15 79 14 89 20 96 84 26 93 83 18\\n1 75\\n6 4 100 55 59 62 83\\n5 48 44 37 12 6\\n6 68 53 28 32 10 63\\n4 30 49 86 93\\n2 62 13\\n7 25 141 8 94 10 96 71\\n\", \"20\\n5 15 40 35 68 22\\n6 70 19 28 69 63 1\\n4 37 154 41 90\\n7 11 148 35 94 55 59 64\\n7 46 28 22 90 95 72 13\\n5 62 45 25 50 94\\n6 85 83 37 72 27 53\\n6 46 56 59 71 49 33\\n7 17 35 91 24 50 30 38\\n2 75 12\\n2 46 2\\n1 61\\n11 15 79 14 89 20 96 84 26 93 83 18\\n1 75\\n6 4 100 55 59 62 83\\n5 48 44 37 12 6\\n6 68 53 28 32 10 63\\n4 30 49 86 92\\n2 62 13\\n7 25 81 8 94 1 96 71\\n\", \"20\\n5 15 40 35 68 22\\n6 70 19 28 69 63 1\\n4 37 154 41 90\\n7 11 148 35 94 55 59 64\\n7 46 28 22 90 95 37 13\\n5 62 45 34 50 94\\n6 85 83 12 72 27 53\\n6 46 56 59 71 94 33\\n7 17 35 91 24 50 30 38\\n2 78 12\\n2 46 38\\n1 61\\n11 15 79 14 89 20 96 84 26 93 83 18\\n1 75\\n6 4 100 55 59 62 94\\n5 48 44 37 12 6\\n6 68 53 28 32 10 63\\n4 30 49 86 93\\n2 62 13\\n7 25 81 8 94 10 96 71\\n\", \"7\\n3 1 6 7\\n4 3 5 2 9\\n2 8 1\\n4 3 7 6 4\\n3 2 5 9\\n3 6 3 8\\n3 4 2 9\\n\"], \"outputs\": [\"5\\n\", \"8\\n\", \"0\\n\", \"2\\n\", \"0\\n\", \"0\\n\", \"35\\n\", \"34\\n\", \"2\\n\", \"5\\n\", \"0\\n\", \"34\\n\", \"2\\n\", \"3\\n\", \"33\\n\", \"31\\n\", \"29\\n\", \"30\\n\", \"36\\n\", \"6\\n\", \"35\\n\", \"32\\n\", \"0\\n\", \"34\\n\", \"3\\n\", \"3\\n\", \"34\\n\", \"34\\n\", \"34\\n\", \"33\\n\", \"34\\n\", \"29\\n\", \"29\\n\", \"0\\n\", \"3\\n\", \"0\\n\", \"36\\n\", \"34\\n\", \"33\\n\", \"34\\n\", \"33\\n\", \"29\\n\", \"29\\n\", \"0\\n\", \"35\\n\", \"33\\n\", \"29\\n\", \"0\\n\", \"35\\n\", \"32\\n\", \"36\\n\", \"34\\n\", \"30\\n\", \"0\\n\", \"35\\n\", \"34\\n\", \"36\\n\", \"34\\n\", \"6\\n\"]}", "source": "primeintellect"}
Paw the Spider is making a web. Web-making is a real art, Paw has been learning to do it his whole life. Let's consider the structure of the web. <image> There are n main threads going from the center of the web. All main threads are located in one plane and divide it into n equal infinite sectors. The sectors are indexed from 1 to n in the clockwise direction. Sectors i and i + 1 are adjacent for every i, 1 ≤ i < n. In addition, sectors 1 and n are also adjacent. Some sectors have bridge threads. Each bridge connects the two main threads that make up this sector. The points at which the bridge is attached to the main threads will be called attachment points. Both attachment points of a bridge are at the same distance from the center of the web. At each attachment point exactly one bridge is attached. The bridges are adjacent if they are in the same sector, and there are no other bridges between them. A cell of the web is a trapezoid, which is located in one of the sectors and is bounded by two main threads and two adjacent bridges. You can see that the sides of the cell may have the attachment points of bridges from adjacent sectors. If the number of attachment points on one side of the cell is not equal to the number of attachment points on the other side, it creates an imbalance of pulling forces on this cell and this may eventually destroy the entire web. We'll call such a cell unstable. The perfect web does not contain unstable cells. Unstable cells are marked red in the figure. Stable cells are marked green. Paw the Spider isn't a skillful webmaker yet, he is only learning to make perfect webs. Help Paw to determine the number of unstable cells in the web he has just spun. Input The first line contains integer n (3 ≤ n ≤ 1000) — the number of main threads. The i-th of following n lines describe the bridges located in the i-th sector: first it contains integer ki (1 ≤ ki ≤ 105) equal to the number of bridges in the given sector. Then follow ki different integers pij (1 ≤ pij ≤ 105; 1 ≤ j ≤ ki). Number pij equals the distance from the attachment points of the j-th bridge of the i-th sector to the center of the web. It is guaranteed that any two bridges between adjacent sectors are attached at a different distance from the center of the web. It is guaranteed that the total number of the bridges doesn't exceed 105. Output Print a single integer — the number of unstable cells in Paw the Spider's web. Examples Input 7 3 1 6 7 4 3 5 2 9 2 8 1 4 3 7 6 4 3 2 5 9 3 6 3 8 3 4 2 9 Output 6 Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0.625
{"tests": "{\"inputs\": [\"1\\n10\\n1 2\\n1 3\\n1 4\\n2 5\\n2 6\\n3 7\\n3 8\\n4 9\\n4 10\\n\", \"1\\n10\\n1 2\\n1 3\\n1 4\\n2 5\\n2 6\\n3 7\\n3 8\\n4 9\\n7 10\\n\", \"1\\n10\\n1 2\\n1 3\\n2 4\\n2 5\\n2 6\\n3 7\\n3 8\\n4 9\\n4 10\\n\", \"1\\n10\\n1 2\\n1 3\\n4 4\\n2 5\\n2 6\\n3 7\\n3 8\\n6 9\\n4 10\\n\", \"1\\n3\\n1 2\\n2 3\\n1 4\\n1 5\\n4 6\\n6 7\\n3 8\\n4 9\\n4 10\\n\", \"1\\n10\\n1 2\\n1 3\\n1 4\\n2 5\\n2 6\\n6 7\\n3 8\\n4 9\\n4 10\\n\", \"1\\n10\\n1 2\\n1 3\\n1 4\\n2 5\\n4 6\\n6 7\\n3 8\\n4 9\\n4 10\\n\", \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\\n10\\n1 2\\n4 3\\n1 4\\n2 5\\n4 6\\n5 7\\n3 8\\n4 9\\n8 10\\n\", \"1\\n10\\n1 2\\n1 3\\n2 4\\n2 5\\n4 6\\n2 7\\n3 8\\n2 9\\n5 10\\n\", \"1\\n10\\n1 2\\n2 3\\n2 4\\n2 5\\n4 6\\n3 7\\n3 8\\n2 9\\n2 10\\n\", \"1\\n10\\n1 2\\n1 3\\n2 4\\n2 5\\n3 6\\n5 7\\n1 8\\n7 9\\n2 10\\n\", \"1\\n10\\n1 2\\n1 3\\n1 4\\n2 5\\n4 6\\n6 7\\n2 8\\n4 9\\n3 10\\n\", \"1\\n3\\n1 2\\n2 3\\n1 4\\n1 10\\n4 6\\n6 7\\n3 8\\n4 9\\n4 10\\n\", \"1\\n10\\n1 2\\n4 3\\n1 4\\n3 5\\n4 6\\n5 7\\n3 8\\n4 9\\n8 10\\n\", \"1\\n10\\n1 2\\n4 3\\n2 4\\n2 5\\n4 6\\n3 7\\n3 8\\n2 9\\n2 10\\n\", \"1\\n10\\n1 2\\n1 3\\n2 4\\n2 5\\n3 6\\n5 7\\n2 8\\n7 9\\n2 10\\n\", \"1\\n10\\n1 2\\n1 3\\n1 4\\n2 5\\n2 6\\n3 7\\n3 8\\n6 9\\n4 10\\n\", \"1\\n10\\n1 2\\n1 3\\n1 4\\n2 5\\n2 6\\n3 7\\n3 8\\n4 9\\n4 10\\n\"], \"outputs\": [\"8\\n\", \"9\\n\", \"10\\n\", \"8\\n\", \"3\\n\", \"9\\n\", \"9\\n\", \"10\\n\", \"9\\n\", \"10\\n\", \"10\\n\", \"9\\n\", \"10\\n\", \"9\\n\", \"9\\n\", \"10\\n\", \"10\\n\", \"10\\n\", \"10\\n\", \"10\\n\", \"10\\n\", \"9\\n\", \"9\\n\", \"9\\n\", \"9\\n\", \"10\\n\", \"10\\n\", \"10\\n\", \"10\\n\", \"10\\n\", \"9\\n\", \"10\\n\", \"10\\n\", \"10\\n\", \"10\\n\", \"10\\n\", \"10\\n\", \"9\\n\", \"10\\n\", \"9\\n\", \"10\\n\", \"10\\n\", \"9\\n\", \"3\\n\", \"9\\n\", \"10\\n\", \"10\\n\", \"9\\n\", \"8\\n\"]}", "source": "primeintellect"}
Assume that you have $k$ one-dimensional segments $s_1, s_2, \dots s_k$ (each segment is denoted by two integers — its endpoints). Then you can build the following graph on these segments. The graph consists of $k$ vertexes, and there is an edge between the $i$-th and the $j$-th vertexes ($i \neq j$) if and only if the segments $s_i$ and $s_j$ intersect (there exists at least one point that belongs to both of them). For example, if $s_1 = [1, 6], s_2 = [8, 20], s_3 = [4, 10], s_4 = [2, 13], s_5 = [17, 18]$, then the resulting graph is the following: [Image] A tree of size $m$ is good if it is possible to choose $m$ one-dimensional segments so that the graph built on these segments coincides with this tree. You are given a tree, you have to find its good subtree with maximum possible size. Recall that a subtree is a connected subgraph of a tree. Note that you have to answer $q$ independent queries. -----Input----- The first line contains one integer $q$ ($1 \le q \le 15 \cdot 10^4$) — the number of the queries. The first line of each query contains one integer $n$ ($2 \le n \le 3 \cdot 10^5$) — the number of vertices in the tree. Each of the next $n - 1$ lines contains two integers $x$ and $y$ ($1 \le x, y \le n$) denoting an edge between vertices $x$ and $y$. It is guaranteed that the given graph is a tree. It is guaranteed that the sum of all $n$ does not exceed $3 \cdot 10^5$. -----Output----- For each query print one integer — the maximum size of a good subtree of the given tree. -----Example----- Input 1 10 1 2 1 3 1 4 2 5 2 6 3 7 3 8 4 9 4 10 Output 8 -----Note----- In the first query there is a good subtree of size $8$. The vertices belonging to this subtree are ${9, 4, 10, 2, 5, 1, 6, 3}$. Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [\"2012.12.31\\n2.12.16.14.14\\n7138.5.13\\n10.5.5.1.2\\n10000000.12.31\\n#\", \"2012.12.31\\n2.12.16.14.14\\n7138.5.13\\n10.2.5.1.5\\n10000000.12.31\\n#\", \"2012.12.31\\n2.12.16.14.14\\n6138.5.13\\n10.5.2.1.5\\n10000000.12.31\\n#\", \"2012.12.31\\n2.12.16.04.14\\n7138.5.13\\n10.5.5.1.2\\n10000000.12.31\\n#\", \"2012.12.31\\n2.12.16.14.14\\n7138.5.03\\n10.5.5.1.2\\n10000000.12.31\\n#\", \"2012.12.31\\n2.12.16.14.14\\n7138.5.13\\n5.1.5.2.01\\n10000000.12.31\\n#\", \"2012.12.31\\n2.12.16.14.14\\n6138.5.13\\n10.4.2.1.5\\n10000000.12.31\\n#\", \"2012.12.31\\n2.12.16.14.14\\n7138.5.03\\n2.1.5.5.01\\n10000000.12.31\\n#\", \"2012.12.30\\n2.12.16.14.14\\n6138.5.13\\n10.4.2.1.5\\n10000000.12.31\\n#\", \"2012.12.30\\n2.12.16.14.14\\n6138.5.13\\n10.4.2.2.5\\n10000000.12.31\\n#\", \"2012.12.31\\n2.12.16.04.15\\n7138.5.13\\n10.5.5.1.2\\n10000000.12.31\\n#\", \"2312.12.01\\n2.12.16.14.14\\n7138.5.13\\n5.1.5.2.01\\n10000000.12.31\\n#\", \"2012.12.31\\n2.12.16.14.14\\n7318.5.03\\n2.1.5.5.01\\n10000000.12.31\\n#\", \"2012.12.30\\n2.12.17.14.14\\n6138.5.13\\n10.4.2.1.5\\n10000000.12.31\\n#\", \"2312.12.10\\n2.12.16.14.14\\n7138.5.13\\n5.1.5.2.01\\n10000000.12.31\\n#\", \"2312.02.11\\n2.12.16.14.14\\n7138.5.13\\n5.1.5.2.01\\n10000000.12.31\\n#\", \"2312.02.12\\n2.12.16.14.14\\n7138.5.13\\n5.1.5.2.01\\n10000000.12.31\\n#\", \"2012.12.31\\n2.12.16.04.14\\n7138.5.13\\n10.5.5.1.2\\n10000001.12.31\\n#\", \"2012.12.31\\n2.11.16.14.14\\n7138.5.03\\n10.5.5.1.2\\n10000000.12.31\\n#\", \"2012.12.31\\n2.12.16.14.14\\n6138.6.13\\n10.4.2.1.5\\n10000000.12.31\\n#\", \"2012.12.31\\n2.12.16.04.14\\n7138.5.03\\n2.1.5.5.01\\n10000000.12.31\\n#\", \"2312.02.11\\n2.12.16.14.14\\n7138.5.13\\n10.2.5.1.5\\n10000000.12.31\\n#\", \"2312.02.12\\n2.12.16.14.14\\n7128.5.13\\n5.1.5.2.01\\n10000000.12.31\\n#\", \"2012.12.31\\n2.11.16.14.14\\n7138.4.03\\n10.5.5.1.2\\n10000000.12.31\\n#\", \"2012.12.31\\n2.12.16.14.13\\n6138.6.13\\n10.4.2.1.5\\n10000000.12.31\\n#\", \"2312.02.11\\n2.13.16.14.14\\n7138.5.13\\n10.2.5.1.5\\n10000000.12.31\\n#\", \"2312.02.12\\n2.12.16.14.14\\n7128.5.31\\n5.1.5.2.01\\n10000000.12.31\\n#\", \"2312.02.11\\n2.13.16.14.15\\n7138.5.13\\n10.2.5.1.5\\n10000000.12.31\\n#\", \"2313.02.11\\n2.13.16.14.15\\n7138.5.13\\n10.2.5.1.5\\n10000000.12.31\\n#\", \"2012.12.31\\n2.12.16.14.14\\n7138.5.13\\n10.3.5.1.5\\n10000000.12.31\\n#\", \"2012.12.31\\n2.12.17.14.14\\n7138.5.03\\n10.5.5.1.2\\n10000000.12.31\\n#\", \"2012.12.31\\n2.12.16.14.14\\n7138.5.13\\n2.1.5.5.01\\n10000000.12.31\\n#\", \"2012.12.31\\n2.12.16.14.14\\n7139.5.03\\n2.1.5.5.01\\n10000000.12.31\\n#\", \"2012.12.31\\n2.12.16.04.16\\n7138.5.13\\n10.5.5.1.2\\n10000000.12.31\\n#\", \"2012.12.30\\n2.12.17.14.14\\n6538.1.13\\n10.4.2.1.5\\n10000000.12.31\\n#\", \"2012.12.30\\n2.12.16.14.14\\n6138.6.13\\n10.4.2.1.5\\n10000000.12.31\\n#\", \"2312.02.12\\n2.12.16.14.14\\n7128.5.13\\n5.1.5.2.01\\n10020000.10.31\\n#\", \"2012.12.31\\n2.12.16.14.13\\n6138.6.13\\n10.4.2.1.5\\n11000000.12.31\\n#\", \"2012.12.31\\n2.12.16.14.14\\n7138.6.13\\n10.3.5.1.5\\n10000000.12.31\\n#\", \"2012.12.31\\n2.12.17.14.14\\n7138.6.03\\n10.5.5.1.2\\n10000000.12.31\\n#\", \"2012.12.31\\n1.12.16.14.14\\n7139.5.03\\n2.1.5.5.01\\n10000000.12.31\\n#\", \"2012.12.31\\n2.12.16.14.13\\n6138.6.13\\n5.1.2.4.01\\n11000000.12.31\\n#\", \"2012.12.31\\n2.12.17.14.14\\n7138.6.03\\n2.1.5.5.01\\n10000000.12.31\\n#\", \"2012.12.31\\n2.12.16.14.14\\n7138.5.13\\n10.2.5.1.5\\n10000000.12.21\\n#\", \"2012.12.31\\n2.12.16.14.14\\n7138.5.13\\n10.2.5.1.5\\n1000000.012.31\\n#\", \"2012.12.31\\n2.12.16.14.14\\n7139.5.03\\n2.1.5.5.01\\n10010000.12.31\\n#\", \"2012.12.31\\n2.12.16.04.15\\n7138.5.13\\n2.1.5.5.01\\n10000000.12.31\\n#\", \"2312.12.10\\n2.12.16.13.14\\n7138.5.13\\n5.1.5.2.01\\n10000000.12.31\\n#\", \"2012.12.31\\n2.12.16.04.14\\n7138.5.13\\n10.4.5.1.2\\n10000001.12.31\\n#\", \"2312.02.12\\n2.12.16.14.14\\n7128.5.13\\n10.2.5.1.5\\n10000000.12.31\\n#\", \"2012.12.31\\n2.11.16.14.14\\n7138.4.02\\n10.5.5.1.2\\n10000000.12.31\\n#\", \"2012.12.31\\n2.12.17.14.14\\n7138.5.03\\n2.1.5.5.01\\n10000000.12.31\\n#\", \"2012.12.31\\n2.12.16.04.16\\n7139.5.13\\n10.5.5.1.2\\n10000000.12.31\\n#\", \"2012.12.31\\n2.12.16.14.14\\n6138.6.13\\n10.4.2.1.5\\n11000000.12.31\\n#\", \"2012.12.31\\n4.12.16.12.14\\n7138.6.13\\n10.3.5.1.5\\n10000000.12.31\\n#\", \"2012.12.31\\n2.12.17.14.14\\n7138.6.03\\n10.5.1.5.2\\n10000000.12.31\\n#\", \"2012.12.31\\n1.12.16.14.14\\n7139.5.03\\n10.5.5.1.2\\n10000000.12.31\\n#\", \"3012.12.31\\n2.12.16.14.13\\n6138.6.13\\n5.1.2.4.01\\n11000000.12.31\\n#\", \"2012.12.31\\n3.11.16.14.14\\n7138.4.02\\n10.5.5.1.2\\n10000000.12.31\\n#\", \"2012.12.31\\n2.12.16.14.14\\n6138.6.13\\n10.4.2.0.5\\n11000000.12.31\\n#\", \"2012.12.31\\n2.12.07.14.14\\n7138.6.03\\n10.5.1.5.2\\n10000000.12.31\\n#\", \"3011.12.31\\n2.12.16.14.13\\n6138.6.13\\n5.1.2.4.01\\n11000000.12.31\\n#\", \"2012.12.31\\n2.12.16.14.14\\n6138.6.13\\n5.0.2.4.01\\n11000000.12.31\\n#\", \"2013.12.31\\n2.12.07.14.14\\n7138.6.03\\n10.5.1.5.2\\n10000000.12.31\\n#\", \"2012.12.31\\n2.12.16.14.14\\n6138.6.13\\n5.0.2.4.01\\n21000000.12.31\\n#\", \"2012.12.31\\n2.12.16.14.14\\n6138.6.13\\n6.0.2.4.01\\n21000000.12.31\\n#\", \"2012.12.31\\n2.12.16.04.15\\n7138.5.03\\n10.5.5.1.2\\n10000000.12.31\\n#\", \"2012.12.31\\n2.12.16.14.14\\n7138.5.03\\n10.5.5.1.2\\n10100000.12.30\\n#\", \"2311.12.01\\n2.12.16.14.14\\n7138.5.13\\n5.1.5.2.01\\n10000000.12.31\\n#\", \"2012.12.31\\n2.12.16.14.15\\n7318.5.03\\n2.1.5.5.01\\n10000000.12.31\\n#\", \"2012.12.30\\n2.12.17.14.14\\n6038.5.13\\n10.4.2.1.5\\n10000000.12.31\\n#\", \"2312.02.11\\n2.12.16.14.14\\n7138.5.13\\n5.1.5.2.02\\n10000000.12.31\\n#\", \"2312.02.12\\n2.12.16.14.04\\n7138.5.13\\n5.1.5.2.01\\n10000000.12.31\\n#\", \"2012.12.31\\n2.12.16.14.14\\n6138.6.13\\n5.1.2.4.01\\n10000000.12.31\\n#\", \"2012.12.31\\n2.12.16.04.14\\n7538.1.03\\n2.1.5.5.01\\n10000000.12.31\\n#\", \"2012.12.31\\n2.12.16.14.13\\n6138.6.13\\n10.4.2.1.5\\n10000100.12.31\\n#\", \"2313.03.11\\n2.13.16.14.15\\n7138.5.13\\n10.2.5.1.5\\n10000000.12.31\\n#\", \"2012.12.31\\n2.12.16.14.14\\n7138.5.13\\n10.3.4.1.5\\n10000000.12.31\\n#\", \"2012.12.31\\n2.12.17.15.14\\n7138.5.03\\n10.5.5.1.2\\n10000000.12.31\\n#\", \"2012.12.31\\n2.12.16.14.14\\n7138.6.13\\n2.1.5.5.01\\n10000000.12.31\\n#\", \"2012.12.30\\n2.12.16.14.14\\n6138.6.13\\n10.3.2.1.5\\n10000000.12.31\\n#\", \"2012.12.31\\n2.12.16.14.14\\n7138.5.13\\n10.2.5.5.1\\n1000000.012.31\\n#\", \"2312.12.10\\n2.12.16.13.14\\n7139.5.13\\n5.1.5.2.01\\n10000000.12.31\\n#\", \"2012.12.31\\n2.11.16.14.14\\n7128.4.02\\n10.5.5.1.2\\n10000000.12.31\\n#\", \"2013.12.21\\n4.12.16.12.14\\n7138.6.13\\n10.3.5.1.5\\n10000000.12.31\\n#\", \"2013.12.31\\n2.17.02.14.14\\n7138.6.03\\n10.5.1.5.2\\n10000000.12.31\\n#\", \"2012.12.31\\n2.12.16.04.16\\n7138.5.03\\n10.5.5.1.2\\n10000000.12.31\\n#\", \"2012.12.30\\n3.12.17.14.14\\n6038.5.13\\n10.4.2.1.5\\n10000000.12.31\\n#\", \"2312.02.12\\n2.12.16.14.04\\n7138.5.13\\n10.2.5.1.5\\n10000000.12.31\\n#\", \"2313.03.11\\n2.13.16.14.15\\n8138.5.13\\n10.2.5.1.5\\n10000000.12.31\\n#\", \"2012.12.31\\n2.12.16.14.14\\n7138.6.13\\n2.1.5.4.01\\n10000000.12.31\\n#\", \"2013.12.31\\n1.17.02.14.14\\n7138.6.03\\n10.5.1.5.2\\n10000000.12.31\\n#\", \"2012.12.31\\n2.12.16.14.14\\n7138.5.13\\n5.1.2.5.01\\n10000000.12.31\\n#\", \"2012.12.31\\n2.12.16.14.14\\n7138.5.13\\n10.5.5.1.2\\n10000200.10.31\\n#\", \"2012.12.31\\n2.12.16.14.14\\n7138.5.13\\n10.2.5.1.5\\n10010000.12.31\\n#\", \"2012.12.31\\n2.12.16.14.14\\n7138.5.03\\n10.5.5.1.2\\n20000000.12.31\\n#\", \"2112.12.30\\n2.12.16.14.14\\n7138.5.13\\n5.1.5.2.01\\n10000000.12.31\\n#\", \"2312.12.01\\n2.12.16.14.14\\n7138.5.03\\n2.1.5.5.01\\n10000000.12.31\\n#\", \"2012.12.30\\n2.12.16.14.14\\n6138.5.13\\n10.4.2.1.5\\n10010000.12.31\\n#\", \"2012.12.30\\n2.12.16.14.14\\n6538.1.13\\n10.4.2.2.5\\n10000000.12.31\\n#\", \"2012.12.31\\n2.12.16.14.14\\n7138.5.13\\n10.5.2.1.5\\n10000000.12.31\\n#\"], \"outputs\": [\"0.0.0.0.10\\n3054.8.15\\n0.0.0.0.10\\n6059.2.10\\n8.19.3.13.2\\n\", \"0.0.0.0.10\\n3054.8.15\\n0.0.0.0.10\\n5999.12.25\\n8.19.3.13.2\\n\", \"0.0.0.0.10\\n3054.8.15\\n10.9.5.8.8\\n6056.2.29\\n8.19.3.13.2\\n\", \"0.0.0.0.10\\n3054.1.27\\n0.0.0.0.10\\n6059.2.10\\n8.19.3.13.2\\n\", \"0.0.0.0.10\\n3054.8.15\\n0.0.0.0.0\\n6059.2.10\\n8.19.3.13.2\\n\", \"0.0.0.0.10\\n3054.8.15\\n0.0.0.0.10\\n4009.1.7\\n8.19.3.13.2\\n\", \"0.0.0.0.10\\n3054.8.15\\n10.9.5.8.8\\n6036.6.13\\n8.19.3.13.2\\n\", \"0.0.0.0.10\\n3054.8.15\\n0.0.0.0.0\\n2826.5.29\\n8.19.3.13.2\\n\", \"0.0.0.0.9\\n3054.8.15\\n10.9.5.8.8\\n6036.6.13\\n8.19.3.13.2\\n\", \"0.0.0.0.9\\n3054.8.15\\n10.9.5.8.8\\n6036.7.3\\n8.19.3.13.2\\n\", \"0.0.0.0.10\\n3054.1.28\\n0.0.0.0.10\\n6059.2.10\\n8.19.3.13.2\\n\", \"0.15.4.5.12\\n3054.8.15\\n0.0.0.0.10\\n4009.1.7\\n8.19.3.13.2\\n\", \"0.0.0.0.10\\n3054.8.15\\n0.9.2.11.4\\n2826.5.29\\n8.19.3.13.2\\n\", \"0.0.0.0.9\\n3055.8.10\\n10.9.5.8.8\\n6036.6.13\\n8.19.3.13.2\\n\", \"0.15.4.6.1\\n3054.8.15\\n0.0.0.0.10\\n4009.1.7\\n8.19.3.13.2\\n\", \"0.15.3.8.18\\n3054.8.15\\n0.0.0.0.10\\n4009.1.7\\n8.19.3.13.2\\n\", \"0.15.3.8.19\\n3054.8.15\\n0.0.0.0.10\\n4009.1.7\\n8.19.3.13.2\\n\", \"0.0.0.0.10\\n3054.1.27\\n0.0.0.0.10\\n6059.2.10\\n8.19.4.13.7\\n\", \"0.0.0.0.10\\n3034.11.28\\n0.0.0.0.0\\n6059.2.10\\n8.19.3.13.2\\n\", \"0.0.0.0.10\\n3054.8.15\\n10.9.5.9.19\\n6036.6.13\\n8.19.3.13.2\\n\", \"0.0.0.0.10\\n3054.1.27\\n0.0.0.0.0\\n2826.5.29\\n8.19.3.13.2\\n\", \"0.15.3.8.18\\n3054.8.15\\n0.0.0.0.10\\n5999.12.25\\n8.19.3.13.2\\n\", \"0.15.3.8.19\\n3054.8.15\\n12.19.9.15.18\\n4009.1.7\\n8.19.3.13.2\\n\", \"0.0.0.0.10\\n3034.11.28\\n12.19.19.16.10\\n6059.2.10\\n8.19.3.13.2\\n\", \"0.0.0.0.10\\n3054.8.14\\n10.9.5.9.19\\n6036.6.13\\n8.19.3.13.2\\n\", \"0.15.3.8.18\\n3074.5.2\\n0.0.0.0.10\\n5999.12.25\\n8.19.3.13.2\\n\", \"0.15.3.8.19\\n3054.8.15\\n12.19.9.16.16\\n4009.1.7\\n8.19.3.13.2\\n\", \"0.15.3.8.18\\n3074.5.3\\n0.0.0.0.10\\n5999.12.25\\n8.19.3.13.2\\n\", \"0.15.4.9.4\\n3074.5.3\\n0.0.0.0.10\\n5999.12.25\\n8.19.3.13.2\\n\", \"0.0.0.0.10\\n3054.8.15\\n0.0.0.0.10\\n6019.9.11\\n8.19.3.13.2\\n\", \"0.0.0.0.10\\n3055.8.10\\n0.0.0.0.0\\n6059.2.10\\n8.19.3.13.2\\n\", \"0.0.0.0.10\\n3054.8.15\\n0.0.0.0.10\\n2826.5.29\\n8.19.3.13.2\\n\", \"0.0.0.0.10\\n3054.8.15\\n0.0.1.0.5\\n2826.5.29\\n8.19.3.13.2\\n\", \"0.0.0.0.10\\n3054.1.29\\n0.0.0.0.10\\n6059.2.10\\n8.19.3.13.2\\n\", \"0.0.0.0.9\\n3055.8.10\\n11.9.10.17.5\\n6036.6.13\\n8.19.3.13.2\\n\", \"0.0.0.0.9\\n3054.8.15\\n10.9.5.9.19\\n6036.6.13\\n8.19.3.13.2\\n\", \"0.15.3.8.19\\n3054.8.15\\n12.19.9.15.18\\n4009.1.7\\n7.13.14.14.11\\n\", \"0.0.0.0.10\\n3054.8.14\\n10.9.5.9.19\\n6036.6.13\\n10.7.6.4.2\\n\", \"0.0.0.0.10\\n3054.8.15\\n0.0.0.2.1\\n6019.9.11\\n8.19.3.13.2\\n\", \"0.0.0.0.10\\n3055.8.10\\n0.0.0.1.11\\n6059.2.10\\n8.19.3.13.2\\n\", \"0.0.0.0.10\\n2660.5.12\\n0.0.1.0.5\\n2826.5.29\\n8.19.3.13.2\\n\", \"0.0.0.0.10\\n3054.8.14\\n10.9.5.9.19\\n4006.3.4\\n10.7.6.4.2\\n\", \"0.0.0.0.10\\n3055.8.10\\n0.0.0.1.11\\n2826.5.29\\n8.19.3.13.2\\n\", \"0.0.0.0.10\\n3054.8.15\\n0.0.0.0.10\\n5999.12.25\\n8.19.3.12.12\\n\", \"0.0.0.0.10\\n3054.8.15\\n0.0.0.0.10\\n5999.12.25\\n9.6.1.4.2\\n\", \"0.0.0.0.10\\n3054.8.15\\n0.0.1.0.5\\n2826.5.29\\n8.6.9.6.7\\n\", \"0.0.0.0.10\\n3054.1.28\\n0.0.0.0.10\\n2826.5.29\\n8.19.3.13.2\\n\", \"0.15.4.6.1\\n3054.7.26\\n0.0.0.0.10\\n4009.1.7\\n8.19.3.13.2\\n\", \"0.0.0.0.10\\n3054.1.27\\n0.0.0.0.10\\n6039.5.26\\n8.19.4.13.7\\n\", \"0.15.3.8.19\\n3054.8.15\\n12.19.9.15.18\\n5999.12.25\\n8.19.3.13.2\\n\", \"0.0.0.0.10\\n3034.11.28\\n12.19.19.16.9\\n6059.2.10\\n8.19.3.13.2\\n\", \"0.0.0.0.10\\n3055.8.10\\n0.0.0.0.0\\n2826.5.29\\n8.19.3.13.2\\n\", \"0.0.0.0.10\\n3054.1.29\\n0.0.1.0.15\\n6059.2.10\\n8.19.3.13.2\\n\", \"0.0.0.0.10\\n3054.8.15\\n10.9.5.9.19\\n6036.6.13\\n10.7.6.4.2\\n\", \"0.0.0.0.10\\n3843.1.11\\n0.0.0.2.1\\n6019.9.11\\n8.19.3.13.2\\n\", \"0.0.0.0.10\\n3055.8.10\\n0.0.0.1.11\\n6055.5.22\\n8.19.3.13.2\\n\", \"0.0.0.0.10\\n2660.5.12\\n0.0.1.0.5\\n6059.2.10\\n8.19.3.13.2\\n\", \"2.10.14.10.12\\n3054.8.14\\n10.9.5.9.19\\n4006.3.4\\n10.7.6.4.2\\n\", \"0.0.0.0.10\\n3429.3.2\\n12.19.19.16.9\\n6059.2.10\\n8.19.3.13.2\\n\", \"0.0.0.0.10\\n3054.8.15\\n10.9.5.9.19\\n6036.5.24\\n10.7.6.4.2\\n\", \"0.0.0.0.10\\n3045.10.1\\n0.0.0.1.11\\n6055.5.22\\n8.19.3.13.2\\n\", \"2.10.13.10.6\\n3054.8.14\\n10.9.5.9.19\\n4006.3.4\\n10.7.6.4.2\\n\", \"0.0.0.0.10\\n3054.8.15\\n10.9.5.9.19\\n3986.6.17\\n10.7.6.4.2\\n\", \"0.0.1.0.15\\n3045.10.1\\n0.0.0.1.11\\n6055.5.22\\n8.19.3.13.2\\n\", \"0.0.0.0.10\\n3054.8.15\\n10.9.5.9.19\\n3986.6.17\\n11.8.11.4.2\\n\", \"0.0.0.0.10\\n3054.8.15\\n10.9.5.9.19\\n4380.9.19\\n11.8.11.4.2\\n\", \"0.0.0.0.10\\n3054.1.28\\n0.0.0.0.0\\n6059.2.10\\n8.19.3.13.2\\n\", \"0.0.0.0.10\\n3054.8.15\\n0.0.0.0.0\\n6059.2.10\\n2.11.19.17.11\\n\", \"0.15.3.5.6\\n3054.8.15\\n0.0.0.0.10\\n4009.1.7\\n8.19.3.13.2\\n\", \"0.0.0.0.10\\n3054.8.16\\n0.9.2.11.4\\n2826.5.29\\n8.19.3.13.2\\n\", \"0.0.0.0.9\\n3055.8.10\\n10.4.4.0.4\\n6036.6.13\\n8.19.3.13.2\\n\", \"0.15.3.8.18\\n3054.8.15\\n0.0.0.0.10\\n4009.1.8\\n8.19.3.13.2\\n\", \"0.15.3.8.19\\n3054.8.5\\n0.0.0.0.10\\n4009.1.7\\n8.19.3.13.2\\n\", \"0.0.0.0.10\\n3054.8.15\\n10.9.5.9.19\\n4006.3.4\\n8.19.3.13.2\\n\", \"0.0.0.0.10\\n3054.1.27\\n1.0.5.8.17\\n2826.5.29\\n8.19.3.13.2\\n\", \"0.0.0.0.10\\n3054.8.14\\n10.9.5.9.19\\n6036.6.13\\n9.4.5.3.6\\n\", \"0.15.4.10.12\\n3074.5.3\\n0.0.0.0.10\\n5999.12.25\\n8.19.3.13.2\\n\", \"0.0.0.0.10\\n3054.8.15\\n0.0.0.0.10\\n6018.9.16\\n8.19.3.13.2\\n\", \"0.0.0.0.10\\n3055.8.30\\n0.0.0.0.0\\n6059.2.10\\n8.19.3.13.2\\n\", \"0.0.0.0.10\\n3054.8.15\\n0.0.0.2.1\\n2826.5.29\\n8.19.3.13.2\\n\", \"0.0.0.0.9\\n3054.8.15\\n10.9.5.9.19\\n6016.9.26\\n8.19.3.13.2\\n\", \"0.0.0.0.10\\n3054.8.15\\n0.0.0.0.10\\n6000.3.10\\n9.6.1.4.2\\n\", \"0.15.4.6.1\\n3054.7.26\\n0.0.1.0.15\\n4009.1.7\\n8.19.3.13.2\\n\", \"0.0.0.0.10\\n3034.11.28\\n12.19.9.13.17\\n6059.2.10\\n8.19.3.13.2\\n\", \"0.0.1.0.5\\n3843.1.11\\n0.0.0.2.1\\n6019.9.11\\n8.19.3.13.2\\n\", \"0.0.1.0.15\\n3139.5.22\\n0.0.0.1.11\\n6055.5.22\\n8.19.3.13.2\\n\", \"0.0.0.0.10\\n3054.1.29\\n0.0.0.0.0\\n6059.2.10\\n8.19.3.13.2\\n\", \"0.0.0.0.9\\n3449.11.12\\n10.4.4.0.4\\n6036.6.13\\n8.19.3.13.2\\n\", \"0.15.3.8.19\\n3054.8.5\\n0.0.0.0.10\\n5999.12.25\\n8.19.3.13.2\\n\", \"0.15.4.10.12\\n3074.5.3\\n2.10.14.10.13\\n5999.12.25\\n8.19.3.13.2\\n\", \"0.0.0.0.10\\n3054.8.15\\n0.0.0.2.1\\n2826.5.9\\n8.19.3.13.2\\n\", \"0.0.1.0.15\\n2745.2.16\\n0.0.0.1.11\\n6055.5.22\\n8.19.3.13.2\\n\", \"0.0.0.0.10\\n3054.8.15\\n0.0.0.0.10\\n4006.3.24\\n8.19.3.13.2\\n\", \"0.0.0.0.10\\n3054.8.15\\n0.0.0.0.10\\n6059.2.10\\n9.9.6.8.9\\n\", \"0.0.0.0.10\\n3054.8.15\\n0.0.0.0.10\\n5999.12.25\\n8.6.9.6.7\\n\", \"0.0.0.0.10\\n3054.8.15\\n0.0.0.0.0\\n6059.2.10\\n10.0.8.13.2\\n\", \"0.5.1.8.13\\n3054.8.15\\n0.0.0.0.10\\n4009.1.7\\n8.19.3.13.2\\n\", \"0.15.4.5.12\\n3054.8.15\\n0.0.0.0.0\\n2826.5.29\\n8.19.3.13.2\\n\", \"0.0.0.0.9\\n3054.8.15\\n10.9.5.8.8\\n6036.6.13\\n8.6.9.6.7\\n\", \"0.0.0.0.9\\n3054.8.15\\n11.9.10.17.5\\n6036.7.3\\n8.19.3.13.2\\n\", \"0.0.0.0.10\\n3054.8.15\\n0.0.0.0.10\\n6056.2.29\\n8.19.3.13.2\"]}", "source": "primeintellect"}
Shinya watched a program on TV called "Maya's Great Prophecy! Will the World End in 2012?" After all, I wasn't sure if the world would end, but I was interested in Maya's "long-term calendar," which was introduced in the program. The program explained as follows. The Maya long-term calendar is a very long calendar consisting of 13 Baktuns (1872,000 days) in total, consisting of the units shown in the table on the right. One calculation method believes that the calendar begins on August 11, 3114 BC and ends on December 21, 2012, which is why the world ends on December 21, 2012. .. However, there is also the idea that 13 Baktun will be one cycle, and when the current calendar is over, a new cycle will be started. | 1 kin = 1 day 1 winal = 20 kin 1 tun = 18 winals 1 Katun = 20 tons 1 Baktun = 20 Katun | --- | --- | --- "How many days will my 20th birthday be in the Maya calendar?" Shinya wanted to express various days in the Maya long-term calendar. Now, instead of Shinya, create a program that converts between the Christian era and the Maya long-term calendar. input The input consists of multiple datasets. The end of the input is indicated by # 1 line. Each dataset is given in the following format: b.ka.t.w.ki Or y.m.d The dataset consists of one line containing one character string. b.ka.t.w.ki is the Mayan long-term date and y.m.d is the Christian era date. The units given are as follows. Maya long calendar b | Baktun | (0 ≤ b <13) --- | --- | --- ka | Katun | (0 ≤ ka <20) t | Tun | (0 ≤ t <20) w | Winal | (0 ≤ w <18) ki | kin | (0 ≤ ki <20) Year y | year | (2012 ≤ y ≤ 10,000,000) --- | --- | --- m | month | (1 ≤ m ≤ 12) d | day | (1 ≤ d ≤ 31) The maximum value for a day in the Christian era depends on whether it is a large month, a small month, or a leap year (a leap year is a multiple of 4 that is not divisible by 100 or divisible by 400). The range of dates in the Maya long calendar is from 0.0.0.0.0 to 12.19.19.17.19. However, 0.0.0.0.0.0 of the Maya long-term calendar corresponds to 2012.12.21 of the Christian era. The range of dates in the Christian era is from 2012.12.21 to 10000000.12.31. The number of datasets does not exceed 500. output When the input is the Western calendar, the Maya long calendar is output, and when the input is the Maya long calendar, the Western calendar is output in the same format as the input. As a result of converting the input year, even if the next cycle of the Maya long calendar is entered, it may be output in the format of b.ka.t.w.ki. Example Input 2012.12.31 2.12.16.14.14 7138.5.13 10.5.2.1.5 10000000.12.31 # Output 0.0.0.0.10 3054.8.15 0.0.0.0.10 6056.2.29 8.19.3.13.2 Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [\"3\\n9\\niredppipe\\npiedpiper\\n4\\nestt\\ntest\\n4\\ntste\\ntest\\n\", \"4\\n1\\na\\nz\\n5\\nadhas\\ndasha\\n5\\naashd\\ndasha\\n5\\naahsd\\ndasha\\n\", \"6\\n7\\ncontest\\nntecost\\n7\\ncontest\\nnstteco\\n7\\ncontest\\ntnsteco\\n7\\ncontest\\ncotestn\\n7\\ncontest\\ncontest\\n7\\nontestc\\ncontest\\n\", \"5\\n2\\nab\\naa\\n2\\naa\\naa\\n2\\nab\\nba\\n2\\nbb\\nba\\n3\\naab\\nabb\\n\", \"5\\n2\\nab\\naa\\n2\\naa\\naa\\n2\\nab\\nba\\n2\\nbb\\nba\\n3\\naab\\nabb\\n\", \"6\\n7\\ncontest\\nntecost\\n7\\ncontest\\nnstteco\\n7\\ncontest\\ntnsteco\\n7\\ncontest\\ncotestn\\n7\\ncontest\\ncontest\\n7\\nontestc\\ncontest\\n\", \"5\\n2\\nab\\naa\\n2\\nab\\naa\\n2\\nab\\nba\\n2\\nbb\\nba\\n3\\naab\\nabb\\n\", \"5\\n2\\nab\\naa\\n2\\nab\\naa\\n2\\nab\\nba\\n2\\nbb\\nab\\n3\\nabb\\nabb\\n\", \"3\\n9\\niredppipe\\npiedpiper\\n4\\nestt\\ntest\\n4\\ntstf\\ntest\\n\", \"4\\n1\\na\\nz\\n5\\nadhas\\ndasha\\n5\\naashd\\ndatha\\n5\\naahsd\\ndasha\\n\", \"5\\n2\\nab\\nba\\n2\\nab\\naa\\n2\\nab\\nba\\n2\\nbb\\nba\\n3\\naab\\nabb\\n\", \"5\\n2\\nab\\naa\\n2\\naa\\naa\\n2\\nab\\nba\\n2\\nbb\\nab\\n3\\naab\\nabb\\n\", \"3\\n9\\nepippderi\\npiedpiper\\n4\\nestt\\ntest\\n4\\ntste\\ntest\\n\", \"5\\n2\\nab\\nba\\n2\\nab\\nba\\n2\\nab\\nba\\n2\\nbb\\nba\\n3\\naab\\nabb\\n\", \"5\\n2\\nab\\naa\\n2\\naa\\naa\\n2\\nba\\nba\\n2\\nbb\\nab\\n3\\naab\\nabb\\n\", \"3\\n9\\nepippderi\\npiedpiper\\n4\\nestt\\ntest\\n4\\ntste\\nsest\\n\", \"5\\n2\\nab\\naa\\n2\\nba\\naa\\n2\\nba\\nba\\n2\\nbb\\nba\\n3\\naab\\nabb\\n\", \"5\\n2\\nab\\naa\\n2\\naa\\naa\\n2\\nab\\nba\\n2\\nbb\\nab\\n3\\naab\\nbaa\\n\", \"5\\n2\\nbb\\nba\\n2\\nab\\nba\\n2\\nab\\nba\\n2\\nbb\\nba\\n3\\naab\\nabb\\n\", \"3\\n9\\nepippderi\\noiedpiper\\n4\\nestt\\ntest\\n4\\ntste\\nsest\\n\", \"5\\n2\\nab\\nab\\n2\\naa\\naa\\n2\\nab\\nba\\n2\\nbb\\nab\\n3\\naab\\nbaa\\n\", \"5\\n2\\nab\\naa\\n2\\naa\\naa\\n2\\nba\\nba\\n2\\nbb\\nab\\n3\\nbaa\\naba\\n\", \"5\\n2\\nab\\naa\\n2\\naa\\naa\\n2\\nbb\\nba\\n2\\nbb\\nab\\n3\\nbaa\\naba\\n\", \"6\\n7\\ncontest\\nntecost\\n7\\ncontest\\nnstteco\\n7\\ncontest\\ntnsteco\\n7\\ncontess\\ncotestn\\n7\\ncontest\\ncontest\\n7\\nontestc\\ncontest\\n\", \"3\\n9\\niredppipe\\npiedpiper\\n4\\nttse\\ntest\\n4\\ntste\\ntest\\n\", \"4\\n1\\na\\nz\\n5\\nadhas\\ndasha\\n5\\naashd\\ndasha\\n5\\nabhsd\\ndasha\\n\", \"5\\n2\\nab\\nab\\n2\\nab\\naa\\n2\\nab\\nba\\n2\\nbb\\nab\\n3\\nabb\\nabb\\n\", \"3\\n9\\niredppipe\\npiedpiper\\n4\\nests\\ntest\\n4\\ntstf\\ntest\\n\", \"4\\n1\\na\\nz\\n5\\nadhas\\ndasha\\n5\\naashd\\ndatha\\n5\\naahsd\\nahsad\\n\", \"5\\n2\\nab\\naa\\n2\\naa\\naa\\n2\\nbb\\nba\\n2\\nbb\\nab\\n3\\naab\\nabb\\n\", \"5\\n2\\nab\\nba\\n2\\nab\\nba\\n2\\nab\\nba\\n2\\nbb\\nba\\n3\\nbab\\nabb\\n\", \"3\\n9\\nepippderi\\noiedpiper\\n4\\nestt\\ntett\\n4\\ntste\\nsest\\n\", \"3\\n9\\nepiopderi\\noiedpiper\\n4\\nertt\\ntest\\n4\\ntste\\nsest\\n\", \"6\\n7\\ncontest\\nntecost\\n7\\ncontest\\nnsttdco\\n7\\ncontest\\ntnsteco\\n7\\ncontess\\ncotestn\\n7\\ncontest\\ncontest\\n7\\nontestc\\ncontest\\n\", \"3\\n9\\nirecppipe\\npiedpiper\\n4\\nttse\\ntest\\n4\\ntste\\ntest\\n\", \"5\\n2\\nab\\naa\\n2\\nab\\naa\\n2\\nbb\\nab\\n2\\nbb\\nba\\n3\\naab\\nabb\\n\", \"5\\n2\\nab\\nba\\n2\\nab\\naa\\n2\\nab\\nba\\n2\\nbb\\nab\\n3\\nabb\\nabb\\n\", \"5\\n2\\nab\\nab\\n2\\nab\\nba\\n2\\nab\\nba\\n2\\nbb\\nba\\n3\\nbab\\nabb\\n\", \"5\\n2\\nab\\nab\\n2\\naa\\naa\\n2\\nab\\nbb\\n2\\nbb\\nac\\n3\\naab\\nbaa\\n\", \"5\\n2\\nab\\naa\\n2\\nab\\naa\\n2\\nab\\nba\\n2\\nbb\\nab\\n3\\naab\\nabb\\n\", \"4\\n1\\na\\nz\\n5\\nadhas\\nahsad\\n5\\naashd\\ndatha\\n5\\naahsd\\ndasha\\n\", \"4\\n1\\na\\nz\\n5\\nadhas\\nahsad\\n5\\naashd\\ndauha\\n5\\naahsd\\ndasha\\n\", \"5\\n2\\nab\\naa\\n2\\nba\\naa\\n2\\nab\\nba\\n2\\nbb\\nba\\n3\\naab\\nabb\\n\", \"5\\n2\\nab\\naa\\n2\\naa\\naa\\n2\\nab\\nba\\n2\\nbb\\nab\\n3\\naab\\nbba\\n\", \"5\\n2\\nab\\naa\\n2\\naa\\naa\\n2\\nba\\nba\\n2\\nbb\\nab\\n3\\nbaa\\nabb\\n\", \"3\\n9\\nepiopderi\\noiedpiper\\n4\\nestt\\ntest\\n4\\ntste\\nsest\\n\", \"5\\n2\\nab\\nab\\n2\\naa\\naa\\n2\\nab\\nba\\n2\\nbb\\nab\\n3\\naab\\naba\\n\", \"5\\n2\\nab\\naa\\n2\\naa\\naa\\n2\\nab\\nba\\n2\\nbb\\naa\\n3\\naab\\nabb\\n\", \"5\\n2\\nab\\naa\\n2\\nab\\naa\\n2\\nab\\nab\\n2\\nbb\\nba\\n3\\naab\\nabb\\n\", \"5\\n2\\nab\\naa\\n2\\nba\\naa\\n2\\nab\\nba\\n2\\nbb\\nab\\n3\\naab\\nabb\\n\", \"4\\n1\\na\\nz\\n5\\nadhas\\nahsad\\n5\\ndhsaa\\ndatha\\n5\\naahsd\\ndasha\\n\", \"4\\n1\\nb\\nz\\n5\\nadhas\\nahsad\\n5\\naashd\\ndauha\\n5\\naahsd\\ndasha\\n\", \"5\\n2\\nab\\naa\\n2\\naa\\naa\\n2\\nab\\nab\\n2\\nbb\\nab\\n3\\naab\\nbba\\n\", \"5\\n2\\nba\\naa\\n2\\nba\\naa\\n2\\nba\\nba\\n2\\nbb\\nba\\n3\\naab\\nabb\\n\", \"5\\n2\\nbb\\nba\\n2\\nab\\nba\\n2\\nab\\nba\\n2\\nbb\\nba\\n3\\naab\\nabc\\n\", \"5\\n2\\nab\\nab\\n2\\naa\\naa\\n2\\nab\\nba\\n2\\nbb\\nac\\n3\\naab\\nbaa\\n\", \"5\\n2\\nab\\nab\\n2\\naa\\naa\\n2\\nab\\nba\\n2\\nbb\\nba\\n3\\naab\\naba\\n\", \"5\\n2\\nba\\naa\\n2\\naa\\naa\\n2\\nbb\\nba\\n2\\nbb\\nab\\n3\\nbaa\\naba\\n\", \"5\\n2\\nab\\naa\\n2\\naa\\naa\\n2\\nab\\nab\\n2\\nbb\\naa\\n3\\naab\\nabb\\n\", \"4\\n1\\na\\nz\\n5\\nadhas\\ndasha\\n5\\naashd\\ndahta\\n5\\naahsd\\nahsad\\n\", \"4\\n1\\nb\\nz\\n5\\nadhas\\ndasha\\n5\\naashd\\ndauha\\n5\\naahsd\\ndasha\\n\", \"5\\n2\\nab\\naa\\n2\\naa\\naa\\n2\\nab\\nab\\n2\\nbb\\nab\\n3\\nbab\\nbba\\n\", \"5\\n2\\nba\\naa\\n2\\nba\\naa\\n2\\nab\\nba\\n2\\nbb\\nba\\n3\\naab\\nabb\\n\", \"3\\n9\\niredppipe\\noiedpiper\\n4\\nestt\\ntett\\n4\\ntste\\nsest\\n\", \"3\\n9\\niredppipe\\npiedpiper\\n4\\nestt\\ntest\\n4\\ntste\\ntest\\n\", \"4\\n1\\na\\nz\\n5\\nadhas\\ndasha\\n5\\naashd\\ndasha\\n5\\naahsd\\ndasha\\n\"], \"outputs\": [\"2\\n1\\n2\\n\", \"-1\\n2\\n2\\n3\\n\", \"3\\n4\\n4\\n1\\n0\\n1\\n\", \"-1\\n0\\n1\\n-1\\n-1\\n\", \"-1\\n0\\n1\\n-1\\n-1\\n\", \"3\\n4\\n4\\n1\\n0\\n1\\n\", \"-1\\n-1\\n1\\n-1\\n-1\\n\", \"-1\\n-1\\n1\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\"-1\\n2\\n-1\\n3\\n\", \"-1\\n2\\n-1\\n3\\n\", \"-1\\n0\\n0\\n-1\\n-1\\n\", \"-1\\n-1\\n0\\n-1\\n-1\\n\", \"-1\\n1\\n1\\n-1\\n-1\\n\", \"0\\n0\\n1\\n-1\\n1\\n\", \"0\\n0\\n1\\n-1\\n1\\n\", \"-1\\n0\\n-1\\n-1\\n1\\n\", \"-1\\n0\\n0\\n-1\\n-1\\n\", \"-1\\n2\\n-1\\n2\\n\", \"-1\\n2\\n-1\\n3\\n\", \"-1\\n0\\n0\\n-1\\n1\\n\", \"-1\\n-1\\n1\\n-1\\n-1\\n\", \"-1\\n-1\\n-1\\n\", \"2\\n1\\n2\\n\", \"-1\\n2\\n2\\n3\\n\"]}", "source": "primeintellect"}
The problem was inspired by Pied Piper story. After a challenge from Hooli's compression competitor Nucleus, Richard pulled an all-nighter to invent a new approach to compression: middle-out. You are given two strings $s$ and $t$ of the same length $n$. Their characters are numbered from $1$ to $n$ from left to right (i.e. from the beginning to the end). In a single move you can do the following sequence of actions: choose any valid index $i$ ($1 \le i \le n$), move the $i$-th character of $s$ from its position to the beginning of the string or move the $i$-th character of $s$ from its position to the end of the string. Note, that the moves don't change the length of the string $s$. You can apply a move only to the string $s$. For example, if $s=$"test" in one move you can obtain: if $i=1$ and you move to the beginning, then the result is "test" (the string doesn't change), if $i=2$ and you move to the beginning, then the result is "etst", if $i=3$ and you move to the beginning, then the result is "stet", if $i=4$ and you move to the beginning, then the result is "ttes", if $i=1$ and you move to the end, then the result is "estt", if $i=2$ and you move to the end, then the result is "tste", if $i=3$ and you move to the end, then the result is "tets", if $i=4$ and you move to the end, then the result is "test" (the string doesn't change). You want to make the string $s$ equal to the string $t$. What is the minimum number of moves you need? If it is impossible to transform $s$ to $t$, print -1. -----Input----- The first line contains integer $q$ ($1 \le q \le 100$) — the number of independent test cases in the input. Each test case is given in three lines. The first line of a test case contains $n$ ($1 \le n \le 100$) — the length of the strings $s$ and $t$. The second line contains $s$, the third line contains $t$. Both strings $s$ and $t$ have length $n$ and contain only lowercase Latin letters. There are no constraints on the sum of $n$ in the test (i.e. the input with $q=100$ and all $n=100$ is allowed). -----Output----- For every test print minimum possible number of moves, which are needed to transform $s$ into $t$, or -1, if it is impossible to do. -----Examples----- Input 3 9 iredppipe piedpiper 4 estt test 4 tste test Output 2 1 2 Input 4 1 a z 5 adhas dasha 5 aashd dasha 5 aahsd dasha Output -1 2 2 3 -----Note----- In the first example, the moves in one of the optimal answers are: for the first test case $s=$"iredppipe", $t=$"piedpiper": "iredppipe" $\rightarrow$ "iedppiper" $\rightarrow$ "piedpiper"; for the second test case $s=$"estt", $t=$"test": "estt" $\rightarrow$ "test"; for the third test case $s=$"tste", $t=$"test": "tste" $\rightarrow$ "etst" $\rightarrow$ "test". Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [\"VEEMU:VEEMU:GTE:GTE:KZZEDTUECE:VEEMU:GTE:CGOZKO:CGOZKO:GTE:ZZNAY.,GTE:MHMBC:GTE:VEEMU:CGOZKO:VEEMU:VEEMU.,CGOZKO:ZZNAY..................\\n\", \"V:V:V.,V.,V.,V.,V.,V.,V.,V.,V.,V.,V.,V.,V.,V.,V.,V.,V.,V.,V..,V:V.,V.,V.,V..,V:V.,V.,V.,V.,V..,V:V.,V.,V..,V:V..,V:V.,V..,V.,V:V..,V.,V.,V.,V.,V.,V.,V.,V.,V.,V.,V.,V.,V.,V.,V.,V.,V.,V.,V.,V.,V.,V.,V.,V.,V.,V.,V.,V.,V.,V.,V.,V.,V.,V.,V.,V.,V.,V.,V.,V.,V.,V.,V.,V.,V.,V.,V.,V.,V.,V.,V.,V.,V.,V.,V.,V..\\n\", \"FHMULVSDP:FHMULVSDP:FHMULVSDP:FHMULVSDP..,FHMULVSDP...\\n\", \"Z:NEY:DL:TTKMDPVN.,TTKMDPVN:AMOX:GKDGHYO:DEZEYWDYEX.,PXUVUT:QEIAX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C:WCBHC:PDNTT:JOVEH:PDNTT:MPQPQVD:MPQPQVD:MSYRLMSCL:WCBHC:PHQUHCZ:PHQUHCZ:JOVEH:VWCWBJRF:WCBHC:VWCWBJRF:WCBHC:JOVEH:JOVEG....................\\n\", \"WCBHC:PDNTT:WCCHB:WCBHC:PDNTT:JOVEH:PDNTT:MPQPQVD:MPQPQVD:MSYRLMSCL:WCBHC:PHRUHCZ:PHQUHCZ:JOVEH:VWCWBJRF:WCBHC:VWCWBJRF:WCBHC:JOVEH:JOVEH....................\\n\", \"VEEMU:VEEMU:GTE:GTE:KZZEDTUECE:VEEMU:GTE:CGOZKO:CGOZKO:GTE:ZZNAY.,GTE:LHMBC:GTE:VEEMU:CGOZKO:VEEMU:UEEMU.,CGOZKO:ZZNAY..................\\n\", \"WCBHC:PDNTT:WCBHC:WCBHC:PDNTT:JOVEH:PDNTT:MPQPQVD:MPQPQVD:MSYRLMSCL:WCBHC:PHQUHCZ:PHQUHCZ:JOVEH:VWCWBKRF:WCBHC:VWCWBJRF:WCBHC:JOVEH:JOVEG....................\\n\", \"WCBHC:PDNTT:WCCHB:WCBHC:PDNTT:JOVEH:PDNTT:MPQPQVD:MPQPQVD:MSYRLMSCL:WCBHC:PHRUHCZ:QHQUHCZ:JOVEH:VWCWBJRF:WCBHC:VWCWBJRF:WCBHC:JOVEG:JOVEH....................\\n\", \"UWEJCOA:PPFWB:GKWVDKH:UWEJCOA..,QINJL.,ZVLULGYCBJ..,D:D..,EFEHJKNH:QINJL.,GKWVDKH..,NLBPAHEH.,PPFWB.,MWRKW.,UWEKCOA.,QINJL..\\n\", \"MIKE:MAX.,ARTEM:MIKE..,DMITRY:DMITRY.,DMITRZ...\\n\", \"FIRSY.\\n\", \"XGB:QJNGARRAZV:DWGDCCU:ARDKJV:P:MXBLZKLPYI:FKSBDQVXH:FKSBDQVMH:XXBLZKCPYI..,DWGDLCU..,P...,FKSBDQVXH....,ARDKJV..\\n\", \"ZLWSYH:WNMTNAI:FTCKPGZ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:A..\\n\"], \"outputs\": [\"36\\n\", \"134\\n\", \"8\\n\", \"5\\n\", \"13\\n\", \"0\\n\", \"4\\n\", \"17\\n\", \"1\\n\", \"8\\n\", \"3\\n\", \"42\\n\", \"3\\n\", \"2\\n\", \"27\\n\", \"1\\n\", \"7\\n\", \"19\\n\", \"6\\n\", \"5\\n\", \"4\\n\", \"11\\n\", \"0\\n\", \"2\\n\", \"17\\n\", \"8\\n\", \"22\\n\", \"1\\n\", \"3\\n\", \"4\\n\", \"9\\n\", \"7\\n\", \"36\\n\", \"6\\n\", \"40\\n\", \"24\\n\", \"21\\n\", \"31\\n\", \"23\\n\", \"18\\n\", \"2\\n\", \"2\\n\", \"0\\n\", \"1\\n\", \"4\\n\", \"0\\n\", \"1\\n\", \"1\\n\", \"4\\n\", \"1\\n\", \"7\\n\", \"0\\n\", \"1\\n\", \"1\\n\", \"0\\n\", \"2\\n\", \"0\\n\", \"1\\n\", \"4\\n\", \"7\\n\", \"0\\n\", \"3\\n\", \"4\\n\", \"0\\n\", \"1\\n\", \"4\\n\", \"1\\n\", \"1\\n\", \"2\\n\", \"21\\n\", \"0\\n\", \"0\\n\", \"4\\n\", \"3\\n\", \"1\\n\", \"2\\n\", \"2\\n\", \"1\\n\", \"17\\n\", \"3\\n\", \"6\\n\", \"1\\n\"]}", "source": "primeintellect"}
The Beroil corporation structure is hierarchical, that is it can be represented as a tree. Let's examine the presentation of this structure as follows: * employee ::= name. | name:employee1,employee2, ... ,employeek. * name ::= name of an employee That is, the description of each employee consists of his name, a colon (:), the descriptions of all his subordinates separated by commas, and, finally, a dot. If an employee has no subordinates, then the colon is not present in his description. For example, line MIKE:MAX.,ARTEM:MIKE..,DMITRY:DMITRY.,DMITRY... is the correct way of recording the structure of a corporation where the director MIKE has subordinates MAX, ARTEM and DMITRY. ARTEM has a subordinate whose name is MIKE, just as the name of his boss and two subordinates of DMITRY are called DMITRY, just like himself. In the Beroil corporation every employee can only correspond with his subordinates, at that the subordinates are not necessarily direct. Let's call an uncomfortable situation the situation when a person whose name is s writes a letter to another person whose name is also s. In the example given above are two such pairs: a pair involving MIKE, and two pairs for DMITRY (a pair for each of his subordinates). Your task is by the given structure of the corporation to find the number of uncomfortable pairs in it. <image> Input The first and single line contains the corporation structure which is a string of length from 1 to 1000 characters. It is guaranteed that the description is correct. Every name is a string consisting of capital Latin letters from 1 to 10 symbols in length. Output Print a single number — the number of uncomfortable situations in the company. Examples Input MIKE:MAX.,ARTEM:MIKE..,DMITRY:DMITRY.,DMITRY... Output 3 Input A:A.. Output 1 Input A:C:C:C:C..... Output 6 Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [\"6\\n258 877 696 425 663 934\\n\", \"37\\n280 281 169 68 249 389 977 101 360 43 448 447 368 496 125 507 747 392 338 270 916 150 929 428 118 266 589 470 774 852 263 644 187 817 808 58 637\\n\", \"100\\n469 399 735 925 62 153 707 723 819 529 200 624 57 708 245 384 889 11 639 638 260 419 8 142 403 298 204 169 887 388 241 983 885 267 643 943 417 237 452 562 6 839 149 742 832 896 100 831 712 754 679 743 135 222 445 680 210 955 220 63 960 487 514 824 481 584 441 997 795 290 10 45 510 678 844 503 407 945 850 84 858 934 500 320 936 663 736 592 161 670 606 465 864 969 293 863 868 393 899 744\\n\", \"38\\n488 830 887 566 720 267 583 102 65 200 884 220 263 858 510 481 316 804 754 568 412 166 374 869 356 977 145 421 500 58 664 252 745 70 381 927 670 772\\n\", \"6\\n109 683 214 392 678 10\\n\", \"4\\n4 1 3 2\\n\", \"97\\n976 166 649 81 611 927 480 231 998 711 874 91 969 521 531 414 993 790 317 981 9 261 437 332 173 573 904 777 882 990 658 878 965 64 870 896 271 732 431 53 761 943 418 602 708 949 930 130 512 240 363 458 673 319 131 784 224 48 919 126 208 212 911 59 677 535 450 273 479 423 79 807 336 18 72 290 724 28 123 605 287 228 350 897 250 392 885 655 746 417 643 114 813 378 355 635 905\\n\", \"3\\n269 918 721\\n\", \"4\\n100 10 2 1\\n\", \"100\\n901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000\\n\", \"96\\n292 235 391 180 840 172 218 997 166 287 329 20 886 325 400 471 182 356 448 337 417 319 58 106 366 764 393 614 90 831 924 314 667 532 64 874 3 434 350 352 733 795 78 640 967 63 47 879 635 272 145 569 468 792 153 761 770 878 281 467 209 208 298 37 700 18 334 93 5 750 412 779 523 517 360 649 447 328 311 653 57 578 767 460 647 663 50 670 151 13 511 580 625 907 227 89\\n\", \"1\\n1000\\n\", \"52\\n270 658 808 249 293 707 700 78 791 167 92 772 807 502 830 991 945 102 968 376 556 578 326 980 688 368 280 853 646 256 666 638 424 737 321 996 925 405 199 680 953 541 716 481 727 143 577 919 892 355 346 298\\n\", \"8\\n872 704 973 612 183 274 739 253\\n\", \"8\\n885 879 891 428 522 176 135 983\\n\", \"10\\n10 9 8 7 6 5 4 3 2 1\\n\", \"2\\n457 898\\n\", \"27\\n167 464 924 575 775 97 944 390 297 315 668 296 533 829 851 406 702 366 848 512 71 197 321 900 544 529 116\\n\", \"70\\n12 347 748 962 514 686 192 159 990 4 10 788 602 542 946 215 523 727 799 717 955 796 529 465 897 103 181 515 495 153 710 179 747 145 16 585 943 998 923 708 156 399 770 547 775 285 9 68 713 722 570 143 913 416 663 624 925 218 64 237 797 138 942 213 188 818 780 840 480 758\\n\", \"77\\n482 532 200 748 692 697 171 863 586 547 301 149 326 812 147 698 303 691 527 805 681 387 619 947 598 453 167 799 840 508 893 688 643 974 998 341 804 230 538 669 271 404 477 759 943 596 949 235 880 160 151 660 832 82 969 539 708 889 258 81 224 655 790 144 462 582 646 256 445 52 456 920 67 819 631 484 534\\n\", \"98\\n29 211 984 75 333 96 840 21 352 168 332 433 130 944 215 210 620 442 363 877 91 491 513 955 53 82 351 19 998 706 702 738 770 453 344 117 893 590 723 662 757 16 87 546 312 669 568 931 224 374 927 225 751 962 651 587 361 250 256 240 282 600 95 64 384 589 813 783 39 918 412 648 506 283 886 926 443 173 946 241 310 33 622 565 261 360 547 339 943 367 354 25 479 743 385 485 896 741\\n\", \"76\\n986 504 673 158 87 332 124 218 714 235 212 122 878 370 938 81 686 323 386 348 410 468 875 107 50 960 82 834 234 663 651 422 794 633 294 771 945 607 146 913 950 858 297 88 882 725 247 872 645 749 799 987 115 394 380 382 971 429 593 426 652 353 351 233 868 598 889 116 71 376 916 464 414 976 138 903\\n\", \"93\\n957 395 826 67 185 4 455 880 683 654 463 84 258 878 553 592 124 585 9 133 20 609 43 452 725 125 801 537 700 685 771 155 566 376 19 690 383 352 174 208 177 416 304 1000 533 481 87 509 358 233 681 22 507 659 36 859 952 259 138 271 594 779 576 782 119 69 608 758 283 616 640 523 710 751 34 106 774 92 874 568 864 660 998 992 474 679 180 409 15 297 990 689 501\\n\", \"64\\n591 387 732 260 840 397 563 136 571 876 831 953 799 493 579 13 559 872 53 678 256 232 969 993 847 14 837 365 547 997 604 199 834 529 306 443 739 49 19 276 343 835 904 588 900 870 439 576 975 955 518 117 131 347 800 83 432 882 869 709 32 950 314 450\\n\", \"7\\n920 570 681 428 866 935 795\\n\", \"26\\n656 508 45 189 561 366 96 486 547 386 703 570 780 689 264 26 11 74 466 76 421 48 982 886 215 650\\n\", \"8\\n8 1 7 2 6 3 5 4\\n\", \"100\\n1000 999 998 997 996 995 994 993 992 991 990 989 988 987 986 985 984 983 982 981 980 979 978 977 976 975 974 973 972 971 970 969 968 967 966 965 964 963 962 961 960 959 958 957 956 955 954 953 952 951 950 949 948 947 946 945 944 943 942 941 940 939 938 937 936 935 934 933 932 931 930 929 928 927 926 925 924 923 922 921 920 919 918 917 916 915 914 913 912 911 910 909 908 907 906 905 904 903 902 901\\n\", \"2\\n151 400\\n\", \"9\\n635 707 108 234 52 180 910 203 782\\n\", \"100\\n110 868 147 888 291 282 916 542 917 337 235 595 498 621 814 249 261 713 445 666 142 275 319 49 900 543 333 606 487 670 620 769 852 258 230 867 603 491 714 839 879 37 21 74 590 190 397 506 499 967 152 862 200 107 145 23 614 167 857 475 79 598 270 906 626 116 89 59 651 846 723 201 50 699 522 408 634 132 226 414 824 764 513 586 526 238 556 162 667 173 684 415 527 743 10 442 552 274 350 822\\n\", \"97\\n768 569 306 968 437 779 227 561 412 60 44 807 234 645 169 858 580 396 343 145 842 723 416 80 456 247 81 150 297 116 760 964 312 558 101 850 549 650 299 868 121 435 579 705 118 424 302 812 970 397 659 565 916 183 933 459 6 593 518 717 326 305 744 470 75 981 824 221 294 324 194 293 251 446 481 215 338 861 528 829 921 945 540 89 450 178 24 460 990 392 148 219 934 615 932 340 937\\n\", \"100\\n859 113 290 762 701 63 188 431 810 485 671 673 99 658 194 227 511 435 941 212 551 124 89 222 42 321 657 815 898 171 216 482 707 567 724 491 414 942 820 351 48 653 685 312 586 24 20 627 602 498 533 173 463 262 621 466 119 299 580 964 510 987 40 698 521 998 847 651 746 215 808 563 785 837 631 772 404 923 682 244 232 214 390 350 968 771 517 900 70 543 934 554 681 368 642 575 891 728 478 317\\n\", \"95\\n936 736 17 967 229 607 589 291 242 244 29 698 800 566 630 667 90 416 11 94 812 838 668 520 678 111 490 823 199 973 681 676 683 721 262 896 682 713 402 691 874 44 95 704 56 322 822 887 639 433 406 35 988 61 176 496 501 947 440 384 372 959 577 370 754 802 1 945 427 116 746 408 308 391 397 730 493 183 203 871 831 862 461 565 310 344 504 378 785 137 279 123 475 138 415\\n\", \"94\\n145 703 874 425 277 652 239 496 458 658 339 842 564 699 893 352 625 980 432 121 798 872 499 859 850 721 414 825 543 843 304 111 342 45 219 311 50 748 465 902 781 822 504 985 919 656 280 310 917 438 464 527 491 713 906 329 635 777 223 810 501 535 156 252 806 112 971 719 103 443 165 98 579 554 244 996 221 560 301 51 977 422 314 858 528 772 448 626 185 194 536 66 577 677\\n\", \"74\\n652 446 173 457 760 847 670 25 196 775 998 279 656 809 883 148 969 884 792 502 641 800 663 938 362 339 545 608 107 184 834 666 149 458 864 72 199 658 618 987 126 723 806 643 689 958 626 904 944 415 427 498 628 331 636 261 281 276 478 220 513 595 510 384 354 561 469 462 799 449 747 109 903 456\\n\", \"97\\n70 611 20 30 904 636 583 262 255 501 604 660 212 128 199 138 545 576 506 528 12 410 77 888 783 972 431 188 338 485 148 793 907 678 281 922 976 680 252 724 253 920 177 361 721 798 960 572 99 622 712 466 608 49 612 345 266 751 63 594 40 695 532 789 520 930 825 929 48 59 405 135 109 735 508 186 495 772 375 587 201 324 447 610 230 947 855 318 856 956 313 810 931 175 668 183 688\\n\", \"90\\n643 197 42 218 582 27 66 704 195 445 641 675 285 639 503 686 242 327 57 955 848 287 819 992 756 749 363 48 648 736 580 117 752 921 923 372 114 313 202 337 64 497 399 25 883 331 24 871 917 8 517 486 323 529 325 92 891 406 864 402 263 773 931 253 625 31 17 271 140 131 232 586 893 525 846 54 294 562 600 801 214 55 768 683 389 738 314 284 328 804\\n\", \"100\\n941 283 349 457 52 837 299 284 796 305 893 624 101 972 738 204 121 70 17 704 836 791 95 111 162 952 472 724 733 580 878 177 705 804 11 211 463 417 288 409 410 485 896 755 921 267 164 656 505 765 539 439 535 19 991 689 220 474 114 944 884 144 926 849 486 566 117 35 749 499 797 303 362 905 690 890 976 66 590 183 234 683 39 297 769 787 376 541 571 759 495 200 261 352 73 493 831 442 273 339\\n\", \"2\\n517 331\\n\", \"91\\n493 996 842 9 748 178 1 807 841 519 796 998 84 670 778 143 707 208 165 893 154 943 336 150 761 881 434 112 833 55 412 682 552 945 758 189 209 600 354 325 440 844 410 20 136 665 88 791 688 17 539 821 133 236 94 606 483 446 429 60 960 476 915 134 137 852 754 908 276 482 117 252 297 903 981 203 829 811 471 135 188 667 710 393 370 302 874 872 551 457 692\\n\", \"100\\n321 200 758 415 190 710 920 992 873 898 814 259 359 66 971 210 838 545 663 652 684 277 36 756 963 459 335 484 462 982 532 423 131 703 307 229 391 938 253 847 542 975 635 928 220 980 222 567 557 181 366 824 900 180 107 979 112 564 525 413 300 422 876 615 737 343 902 8 654 628 469 913 967 785 893 314 909 215 912 262 20 709 363 915 997 954 986 454 596 124 74 159 660 550 787 418 895 786 293 50\\n\", \"6\\n258 877 696 425 182 934\\n\", \"37\\n280 281 169 68 249 520 977 101 360 43 448 447 368 496 125 507 747 392 338 270 916 150 929 428 118 266 589 470 774 852 263 644 187 817 808 58 637\\n\", \"100\\n469 399 735 925 62 153 707 723 819 529 200 624 57 928 245 384 889 11 639 638 260 419 8 142 403 298 204 169 887 388 241 983 885 267 643 943 417 237 452 562 6 839 149 742 832 896 100 831 712 754 679 743 135 222 445 680 210 955 220 63 960 487 514 824 481 584 441 997 795 290 10 45 510 678 844 503 407 945 850 84 858 934 500 320 936 663 736 592 161 670 606 465 864 969 293 863 868 393 899 744\\n\", \"38\\n488 830 887 566 720 267 583 102 65 200 884 220 263 858 510 481 316 804 754 568 412 166 374 585 356 977 145 421 500 58 664 252 745 70 381 927 670 772\\n\", \"6\\n109 683 214 392 678 8\\n\", \"4\\n4 1 4 2\\n\", \"97\\n976 166 649 81 611 927 480 231 998 711 874 91 969 521 129 414 993 790 317 981 9 261 437 332 173 573 904 777 882 990 658 878 965 64 870 896 271 732 431 53 761 943 418 602 708 949 930 130 512 240 363 458 673 319 131 784 224 48 919 126 208 212 911 59 677 535 450 273 479 423 79 807 336 18 72 290 724 28 123 605 287 228 350 897 250 392 885 655 746 417 643 114 813 378 355 635 905\\n\", \"3\\n269 918 90\\n\", \"4\\n110 10 2 1\\n\", \"100\\n901 902 903 904 905 906 907 908 909 695 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000\\n\", \"96\\n292 235 391 180 840 172 218 997 166 287 329 20 886 325 400 471 182 356 448 337 417 319 58 106 366 764 393 614 90 831 924 314 667 532 64 874 3 434 350 352 733 795 78 640 967 63 47 879 635 272 145 569 468 792 153 761 770 878 281 467 209 208 298 37 700 18 334 93 5 750 412 779 523 517 360 649 447 328 311 653 57 578 767 460 647 663 50 670 151 13 511 580 625 907 197 89\\n\", \"1\\n1010\\n\", \"52\\n270 658 808 249 293 707 700 78 791 167 92 772 807 502 830 991 945 102 968 376 556 578 326 980 688 368 280 853 646 256 666 638 424 737 321 996 925 405 199 680 953 836 716 481 727 143 577 919 892 355 346 298\\n\", \"8\\n872 704 1084 612 183 274 739 253\\n\", \"8\\n885 879 891 428 929 176 135 983\\n\", \"10\\n10 9 8 7 6 5 4 3 3 1\\n\", \"2\\n843 898\\n\", \"27\\n167 464 924 575 775 97 944 390 297 315 668 296 533 1636 851 406 702 366 848 512 71 197 321 900 544 529 116\\n\", \"70\\n12 347 748 962 514 686 192 159 990 4 10 788 602 542 946 215 523 727 799 717 955 796 529 465 897 103 181 515 495 153 710 179 747 145 16 585 943 998 923 708 156 399 770 547 775 285 9 68 713 722 570 143 913 416 663 624 925 218 64 237 797 138 942 213 63 818 780 840 480 758\\n\", \"77\\n482 532 200 748 692 697 171 863 586 547 301 149 326 812 147 698 303 691 527 805 681 387 619 947 598 453 167 1508 840 508 893 688 643 974 998 341 804 230 538 669 271 404 477 759 943 596 949 235 880 160 151 660 832 82 969 539 708 889 258 81 224 655 790 144 462 582 646 256 445 52 456 920 67 819 631 484 534\\n\", \"98\\n29 211 984 75 555 96 840 21 352 168 332 433 130 944 215 210 620 442 363 877 91 491 513 955 53 82 351 19 998 706 702 738 770 453 344 117 893 590 723 662 757 16 87 546 312 669 568 931 224 374 927 225 751 962 651 587 361 250 256 240 282 600 95 64 384 589 813 783 39 918 412 648 506 283 886 926 443 173 946 241 310 33 622 565 261 360 547 339 943 367 354 25 479 743 385 485 896 741\\n\", \"76\\n986 504 673 158 87 332 124 218 714 235 212 122 878 370 938 81 686 323 386 348 410 468 875 107 50 960 82 834 234 663 651 422 794 633 294 771 945 607 146 913 950 858 297 88 882 725 247 872 645 749 799 987 115 394 380 382 971 429 593 426 652 353 351 233 868 598 889 116 71 376 916 464 414 1693 138 903\\n\", \"93\\n957 395 826 67 185 4 455 880 683 654 463 84 258 878 553 592 124 585 9 133 20 609 43 452 725 125 801 537 700 685 771 155 566 376 19 690 383 352 174 208 177 416 304 1000 533 481 87 509 358 233 681 22 507 659 36 744 952 259 138 271 594 779 576 782 119 69 608 758 283 616 640 523 710 751 34 106 774 92 874 568 864 660 998 992 474 679 180 409 15 297 990 689 501\\n\", \"64\\n591 387 732 260 840 397 563 136 571 876 831 953 799 493 579 13 559 872 53 678 256 232 969 993 847 14 837 365 547 997 266 199 834 529 306 443 739 49 19 276 343 835 904 588 900 870 439 576 975 955 518 117 131 347 800 83 432 882 869 709 32 950 314 450\\n\", \"7\\n920 570 681 428 866 935 492\\n\", \"26\\n656 508 45 189 561 366 96 486 547 386 1183 570 780 689 264 26 11 74 466 76 421 48 982 886 215 650\\n\", \"8\\n8 1 7 2 6 3 4 4\\n\", \"100\\n1000 999 998 997 996 995 994 993 992 991 990 989 988 987 986 985 984 983 982 981 980 979 978 977 976 975 974 973 972 971 970 969 968 967 966 965 964 897 962 961 960 959 958 957 956 955 954 953 952 951 950 949 948 947 946 945 944 943 942 941 940 939 938 937 936 935 934 933 932 931 930 929 928 927 926 925 924 923 922 921 920 919 918 917 916 915 914 913 912 911 910 909 908 907 906 905 904 903 902 901\\n\", \"2\\n151 299\\n\", \"9\\n635 707 108 234 7 180 910 203 782\\n\", \"100\\n110 868 147 888 291 282 916 542 917 337 235 595 498 621 814 249 261 713 445 666 142 275 319 49 900 543 333 606 487 670 620 769 852 258 230 867 603 491 1401 839 879 37 21 74 590 190 397 506 499 967 152 862 200 107 145 23 614 167 857 475 79 598 270 906 626 116 89 59 651 846 723 201 50 699 522 408 634 132 226 414 824 764 513 586 526 238 556 162 667 173 684 415 527 743 10 442 552 274 350 822\\n\", \"97\\n768 569 306 968 437 779 227 561 412 60 44 807 234 645 169 858 580 396 343 145 842 723 416 80 456 247 81 150 297 116 760 964 312 558 101 850 549 650 299 868 121 435 579 705 118 424 302 812 970 397 659 565 156 183 933 459 6 593 518 717 326 305 744 470 75 981 824 221 294 324 194 293 251 446 481 215 338 861 528 829 921 945 540 89 450 178 24 460 990 392 148 219 934 615 932 340 937\\n\", \"100\\n859 113 290 762 701 63 188 431 810 485 671 673 99 658 194 227 511 435 941 212 551 124 89 222 42 321 657 815 898 171 216 482 707 567 724 491 414 942 820 351 48 653 685 312 586 24 20 627 602 498 533 173 463 262 621 466 119 299 580 964 510 987 40 698 521 998 1601 651 746 215 808 563 785 837 631 772 404 923 682 244 232 214 390 350 968 771 517 900 70 543 934 554 681 368 642 575 891 728 478 317\\n\", \"95\\n936 736 17 967 229 607 589 291 242 244 29 698 800 566 630 667 90 416 11 94 812 838 668 520 678 111 535 823 199 973 681 676 683 721 262 896 682 713 402 691 874 44 95 704 56 322 822 887 639 433 406 35 988 61 176 496 501 947 440 384 372 959 577 370 754 802 1 945 427 116 746 408 308 391 397 730 493 183 203 871 831 862 461 565 310 344 504 378 785 137 279 123 475 138 415\\n\", \"94\\n145 703 874 425 277 652 239 496 458 658 339 842 564 699 893 352 625 980 432 121 798 872 499 859 850 721 414 825 543 843 304 111 342 45 219 311 50 748 465 902 781 822 504 985 919 656 280 310 1468 438 464 527 491 713 906 329 635 777 223 810 501 535 156 252 806 112 971 719 103 443 165 98 579 554 244 996 221 560 301 51 977 422 314 858 528 772 448 626 185 194 536 66 577 677\\n\", \"74\\n652 446 173 457 760 847 670 25 196 775 998 279 656 809 883 148 969 884 792 502 641 800 663 938 362 339 545 608 107 184 834 666 149 458 864 72 199 658 618 987 126 723 806 643 689 958 626 904 944 415 427 498 628 331 636 261 281 517 478 220 513 595 510 384 354 561 469 462 799 449 747 109 903 456\\n\", \"97\\n70 611 20 30 904 636 583 262 255 501 604 660 212 128 199 138 545 576 506 528 12 410 77 888 783 972 431 188 338 485 148 793 907 678 281 922 976 903 252 724 253 920 177 361 721 798 960 572 99 622 712 466 608 49 612 345 266 751 63 594 40 695 532 789 520 930 825 929 48 59 405 135 109 735 508 186 495 772 375 587 201 324 447 610 230 947 855 318 856 956 313 810 931 175 668 183 688\\n\", \"90\\n643 197 42 218 582 27 66 704 195 445 641 675 285 639 503 686 242 327 57 955 848 287 819 992 756 749 363 48 648 736 580 117 209 921 923 372 114 313 202 337 64 497 399 25 883 331 24 871 917 8 517 486 323 529 325 92 891 406 864 402 263 773 931 253 625 31 17 271 140 131 232 586 893 525 846 54 294 562 600 801 214 55 768 683 389 738 314 284 328 804\\n\", \"100\\n941 283 349 457 52 837 299 284 796 305 893 624 101 972 738 204 121 70 17 704 836 791 95 111 162 952 472 724 733 580 878 177 705 804 11 211 463 417 288 409 410 485 896 755 921 267 164 656 505 765 539 439 535 19 991 689 220 474 114 944 884 144 926 849 486 566 117 35 749 499 797 303 362 905 690 890 976 97 590 183 234 683 39 297 769 787 376 541 571 759 495 200 261 352 73 493 831 442 273 339\\n\", \"2\\n104 331\\n\", \"91\\n493 996 842 9 748 178 1 807 841 519 796 998 84 670 778 143 707 208 165 893 154 943 336 150 761 881 434 112 833 55 412 682 552 945 758 189 209 600 354 325 440 844 410 20 136 665 88 791 688 17 539 821 133 236 94 606 483 446 429 60 960 476 915 134 137 852 754 908 276 482 117 252 297 903 981 203 829 811 471 135 188 667 710 393 370 329 874 872 551 457 692\\n\", \"100\\n321 200 758 415 190 710 920 992 873 898 814 259 359 66 971 210 838 545 663 652 684 277 36 756 963 459 335 484 462 982 532 423 131 703 307 229 391 938 253 847 542 975 635 928 220 980 222 567 557 181 366 824 900 180 107 979 112 564 525 413 300 422 876 615 737 343 902 8 654 628 469 913 967 785 893 314 909 215 912 262 20 709 363 915 997 954 986 454 596 124 74 159 660 550 787 418 895 175 293 50\\n\", \"1\\n2\\n\", \"3\\n1 4 1\\n\", \"6\\n258 356 696 425 182 934\\n\", \"37\\n280 281 169 68 249 520 977 101 360 43 448 447 368 496 125 507 747 392 338 270 916 150 929 428 118 266 1002 470 774 852 263 644 187 817 808 58 637\\n\", \"100\\n469 399 735 925 62 153 707 723 819 529 200 624 57 928 245 384 889 11 639 638 145 419 8 142 403 298 204 169 887 388 241 983 885 267 643 943 417 237 452 562 6 839 149 742 832 896 100 831 712 754 679 743 135 222 445 680 210 955 220 63 960 487 514 824 481 584 441 997 795 290 10 45 510 678 844 503 407 945 850 84 858 934 500 320 936 663 736 592 161 670 606 465 864 969 293 863 868 393 899 744\\n\", \"38\\n488 830 887 566 720 267 583 102 65 200 884 220 263 858 510 481 316 804 754 568 412 166 374 585 356 977 145 421 500 102 664 252 745 70 381 927 670 772\\n\", \"6\\n109 683 214 392 678 2\\n\", \"4\\n4 1 0 2\\n\", \"97\\n976 166 649 81 611 927 480 231 998 711 874 91 969 521 129 414 993 790 317 981 9 261 437 332 173 573 904 777 882 990 658 878 965 64 870 896 271 732 431 53 761 943 418 602 708 949 930 130 512 240 363 458 673 319 28 784 224 48 919 126 208 212 911 59 677 535 450 273 479 423 79 807 336 18 72 290 724 28 123 605 287 228 350 897 250 392 885 655 746 417 643 114 813 378 355 635 905\\n\", \"3\\n268 918 90\\n\", \"4\\n110 9 2 1\\n\", \"100\\n901 902 903 904 905 906 907 908 909 695 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 1058 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000\\n\", \"96\\n292 235 391 180 840 172 218 997 166 287 329 20 886 325 400 471 182 356 448 337 417 319 58 106 366 764 376 614 90 831 924 314 667 532 64 874 3 434 350 352 733 795 78 640 967 63 47 879 635 272 145 569 468 792 153 761 770 878 281 467 209 208 298 37 700 18 334 93 5 750 412 779 523 517 360 649 447 328 311 653 57 578 767 460 647 663 50 670 151 13 511 580 625 907 197 89\\n\", \"1\\n1011\\n\", \"52\\n270 658 808 249 293 707 700 78 791 167 92 772 807 502 830 991 945 102 968 376 556 578 326 1749 688 368 280 853 646 256 666 638 424 737 321 996 925 405 199 680 953 836 716 481 727 143 577 919 892 355 346 298\\n\", \"8\\n872 704 681 612 183 274 739 253\\n\", \"8\\n885 879 891 428 929 176 135 1413\\n\", \"10\\n3 9 8 7 6 5 4 3 3 1\\n\", \"2\\n843 1151\\n\", \"27\\n167 464 924 575 775 97 944 390 297 315 668 296 533 1636 851 807 702 366 848 512 71 197 321 900 544 529 116\\n\", \"70\\n12 347 748 962 514 686 192 159 990 4 10 788 602 542 946 215 523 727 799 717 76 796 529 465 897 103 181 515 495 153 710 179 747 145 16 585 943 998 923 708 156 399 770 547 775 285 9 68 713 722 570 143 913 416 663 624 925 218 64 237 797 138 942 213 63 818 780 840 480 758\\n\", \"77\\n482 532 200 748 692 697 171 863 586 547 301 149 326 812 147 698 303 691 527 805 681 404 619 947 598 453 167 1508 840 508 893 688 643 974 998 341 804 230 538 669 271 404 477 759 943 596 949 235 880 160 151 660 832 82 969 539 708 889 258 81 224 655 790 144 462 582 646 256 445 52 456 920 67 819 631 484 534\\n\", \"98\\n29 211 984 75 555 96 840 21 352 168 332 433 130 944 215 210 620 442 363 877 91 491 513 955 53 82 351 19 998 706 702 738 770 453 344 117 893 590 723 662 757 16 87 546 312 669 568 931 224 374 927 225 751 962 651 587 361 250 256 240 282 600 95 64 384 589 813 783 39 918 412 648 506 283 886 926 443 173 946 241 310 33 622 565 261 360 547 339 294 367 354 25 479 743 385 485 896 741\\n\", \"76\\n986 504 673 158 87 332 124 218 714 235 212 122 878 370 938 81 686 323 386 348 410 468 875 107 50 631 82 834 234 663 651 422 794 633 294 771 945 607 146 913 950 858 297 88 882 725 247 872 645 749 799 987 115 394 380 382 971 429 593 426 652 353 351 233 868 598 889 116 71 376 916 464 414 1693 138 903\\n\", \"93\\n957 395 826 67 185 4 455 880 683 654 463 84 258 878 553 592 124 585 9 133 20 609 43 452 725 125 801 537 700 685 771 155 566 376 19 690 702 352 174 208 177 416 304 1000 533 481 87 509 358 233 681 22 507 659 36 744 952 259 138 271 594 779 576 782 119 69 608 758 283 616 640 523 710 751 34 106 774 92 874 568 864 660 998 992 474 679 180 409 15 297 990 689 501\\n\", \"64\\n591 387 732 260 840 397 563 136 416 876 831 953 799 493 579 13 559 872 53 678 256 232 969 993 847 14 837 365 547 997 266 199 834 529 306 443 739 49 19 276 343 835 904 588 900 870 439 576 975 955 518 117 131 347 800 83 432 882 869 709 32 950 314 450\\n\", \"7\\n920 570 473 428 866 935 492\\n\", \"26\\n656 508 45 189 561 121 96 486 547 386 1183 570 780 689 264 26 11 74 466 76 421 48 982 886 215 650\\n\", \"8\\n8 1 7 2 6 4 4 4\\n\", \"100\\n1000 999 998 997 996 995 994 993 992 991 990 989 988 987 986 985 984 983 982 981 980 979 978 977 976 975 974 973 972 971 970 969 968 967 966 965 964 897 962 961 960 959 958 957 956 955 954 953 952 951 950 949 948 947 946 293 944 943 942 941 940 939 938 937 936 935 934 933 932 931 930 929 928 927 926 925 924 923 922 921 920 919 918 917 916 915 914 913 912 911 910 909 908 907 906 905 904 903 902 901\\n\", \"2\\n262 299\\n\", \"9\\n635 1356 108 234 7 180 910 203 782\\n\", \"100\\n110 868 147 888 291 282 916 542 917 337 235 595 498 621 814 249 261 713 445 666 142 275 319 49 900 543 333 606 487 670 620 769 852 258 230 867 603 491 1401 839 879 37 21 74 590 190 397 506 499 967 152 862 200 107 145 23 614 167 857 475 79 598 270 906 626 116 89 59 651 846 723 201 50 699 522 408 143 132 226 414 824 764 513 586 526 238 556 162 667 173 684 415 527 743 10 442 552 274 350 822\\n\", \"97\\n768 569 306 968 437 779 227 561 412 60 44 807 234 645 169 858 580 396 343 145 842 723 416 90 456 247 81 150 297 116 760 964 312 558 101 850 549 650 299 868 121 435 579 705 118 424 302 812 970 397 659 565 156 183 933 459 6 593 518 717 326 305 744 470 75 981 824 221 294 324 194 293 251 446 481 215 338 861 528 829 921 945 540 89 450 178 24 460 990 392 148 219 934 615 932 340 937\\n\", \"100\\n859 113 290 762 701 63 188 431 810 485 671 673 99 658 194 227 511 435 941 212 551 124 89 222 42 321 657 815 898 171 216 482 707 567 724 491 414 942 820 351 48 653 685 312 586 24 20 627 602 498 533 173 463 262 621 466 119 299 580 964 510 987 40 698 521 998 1601 651 746 215 808 563 1134 837 631 772 404 923 682 244 232 214 390 350 968 771 517 900 70 543 934 554 681 368 642 575 891 728 478 317\\n\", \"95\\n936 736 17 967 229 607 589 291 242 244 29 698 800 566 630 667 90 416 11 94 812 838 668 520 678 111 535 823 199 973 681 676 683 721 262 896 682 713 402 691 874 44 95 704 56 322 822 887 639 433 406 35 988 61 176 496 501 947 440 524 372 959 577 370 754 802 1 945 427 116 746 408 308 391 397 730 493 183 203 871 831 862 461 565 310 344 504 378 785 137 279 123 475 138 415\\n\", \"94\\n145 703 874 425 277 652 239 496 458 658 339 842 564 699 893 352 625 980 432 121 798 872 499 859 850 721 414 825 543 843 304 111 342 45 219 311 50 748 465 902 781 822 504 985 919 656 280 310 1468 438 464 527 491 713 906 329 635 777 223 810 501 535 156 252 806 112 971 1412 103 443 165 98 579 554 244 996 221 560 301 51 977 422 314 858 528 772 448 626 185 194 536 66 577 677\\n\", \"74\\n652 446 173 457 760 310 670 25 196 775 998 279 656 809 883 148 969 884 792 502 641 800 663 938 362 339 545 608 107 184 834 666 149 458 864 72 199 658 618 987 126 723 806 643 689 958 626 904 944 415 427 498 628 331 636 261 281 517 478 220 513 595 510 384 354 561 469 462 799 449 747 109 903 456\\n\", \"97\\n70 611 20 30 904 636 583 262 255 501 604 660 212 128 199 138 545 576 506 528 12 410 77 888 783 972 431 188 338 485 148 793 907 678 281 922 976 903 252 724 253 920 177 361 721 798 960 572 99 622 712 466 608 85 612 345 266 751 63 594 40 695 532 789 520 930 825 929 48 59 405 135 109 735 508 186 495 772 375 587 201 324 447 610 230 947 855 318 856 956 313 810 931 175 668 183 688\\n\", \"90\\n643 197 42 218 582 27 66 704 195 445 641 675 285 639 503 686 242 327 57 955 848 288 819 992 756 749 363 48 648 736 580 117 209 921 923 372 114 313 202 337 64 497 399 25 883 331 24 871 917 8 517 486 323 529 325 92 891 406 864 402 263 773 931 253 625 31 17 271 140 131 232 586 893 525 846 54 294 562 600 801 214 55 768 683 389 738 314 284 328 804\\n\", \"100\\n941 283 349 457 52 837 299 284 796 305 893 624 101 972 738 204 121 70 17 704 836 791 95 111 162 952 472 724 733 580 878 177 705 804 11 211 463 417 288 409 410 485 896 755 921 267 164 656 505 765 539 439 535 19 991 689 220 474 114 944 884 144 926 849 486 566 117 14 749 499 797 303 362 905 690 890 976 97 590 183 234 683 39 297 769 787 376 541 571 759 495 200 261 352 73 493 831 442 273 339\\n\", \"2\\n206 331\\n\", \"91\\n493 996 842 9 748 178 1 807 841 519 796 998 84 670 778 143 707 208 165 893 154 943 336 150 761 881 434 112 833 55 412 682 552 945 758 189 209 600 354 325 440 844 410 20 136 665 88 791 688 17 539 821 133 236 94 606 483 446 429 60 960 476 915 134 137 852 754 908 276 482 46 252 297 903 981 203 829 811 471 135 188 667 710 393 370 329 874 872 551 457 692\\n\", \"100\\n321 200 758 415 190 710 920 992 873 898 814 259 359 66 971 210 838 545 663 652 684 277 36 756 963 459 335 484 462 982 532 423 131 703 307 229 391 938 253 847 542 975 1018 928 220 980 222 567 557 181 366 824 900 180 107 979 112 564 525 413 300 422 876 615 737 343 902 8 654 628 469 913 967 785 893 314 909 215 912 262 20 709 363 915 997 954 986 454 596 124 74 159 660 550 787 418 895 175 293 50\\n\", \"1\\n3\\n\", \"3\\n0 4 1\\n\", \"6\\n258 356 696 425 182 1716\\n\", \"37\\n280 281 169 68 249 520 977 101 360 43 448 447 368 496 125 507 747 392 338 270 916 150 1589 428 118 266 1002 470 774 852 263 644 187 817 808 58 637\\n\", \"100\\n469 399 735 925 62 153 707 723 819 529 200 624 57 928 245 384 889 11 639 638 145 419 8 142 2 298 204 169 887 388 241 983 885 267 643 943 417 237 452 562 6 839 149 742 832 896 100 831 712 754 679 743 135 222 445 680 210 955 220 63 960 487 514 824 481 584 441 997 795 290 10 45 510 678 844 503 407 945 850 84 858 934 500 320 936 663 736 592 161 670 606 465 864 969 293 863 868 393 899 744\\n\", \"38\\n488 830 398 566 720 267 583 102 65 200 884 220 263 858 510 481 316 804 754 568 412 166 374 585 356 977 145 421 500 102 664 252 745 70 381 927 670 772\\n\", \"6\\n109 128 214 392 678 2\\n\", \"97\\n976 166 649 81 611 927 480 231 998 711 874 91 969 521 129 414 993 790 317 981 9 261 437 332 173 573 904 777 882 990 658 878 965 64 870 896 271 732 431 53 761 943 418 602 708 949 930 130 512 240 363 458 673 319 28 784 224 48 919 126 208 212 911 59 677 535 450 273 479 423 79 807 336 18 72 290 724 28 123 605 287 228 350 897 250 392 885 655 746 417 643 114 813 378 644 635 905\\n\", \"3\\n467 918 90\\n\", \"4\\n110 9 4 1\\n\", \"100\\n901 902 903 904 905 906 907 908 909 695 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 1058 943 944 945 946 947 948 949 271 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000\\n\", \"1\\n1\\n\", \"3\\n1 4 2\\n\"], \"outputs\": [\"823521.3902487605\\n\", \"1495219.032327487\\n\", \"1556458.0979239128\\n\", \"1479184.3434235647\\n\", \"397266.9574170437\\n\", \"31.41592653589793\\n\", \"1615601.7212203941\\n\", \"1241695.6467754443\\n\", \"31111.19204849972\\n\", \"298608.3817237098\\n\", \"1419726.5608617242\\n\", \"3141592.653589793\\n\", \"1272941.9273080484\\n\", \"1780774.0965755312\\n\", \"895488.9947571954\\n\", \"172.78759594743863\\n\", \"1877274.398115849\\n\", \"1573959.9105970615\\n\", \"1741821.4892636712\\n\", \"2045673.1891262224\\n\", \"2042921.1539616778\\n\", \"1528494.78171431\\n\", \"1310703.8710041975\\n\", \"1258248.6984672088\\n\", \"1469640.1849419589\\n\", \"1818821.9252031571\\n\", \"113.09733552923255\\n\", \"298608.3817237098\\n\", \"431023.37047986605\\n\", \"1100144.9065826489\\n\", \"1567230.6191330722\\n\", \"1577239.7333274093\\n\", \"1447969.4788174964\\n\", \"1611115.526911068\\n\", \"1624269.3753516483\\n\", \"1510006.508947934\\n\", \"1686117.9099228706\\n\", \"1569819.2914796302\\n\", \"1597889.421839455\\n\", \"495517.1260654109\\n\", \"1806742.5014501044\\n\", \"1775109.8050211088\\n\", \"1383739.61701485\\n\", \"1436518.37359516\\n\", \"1587490.75015607\\n\", \"1937165.72046388\\n\", \"397380.05475257\\n\", \"9.42477796\\n\", \"1638196.05558501\\n\", \"2445613.64189147\\n\", \"37708.53662104\\n\", \"1325799.22370470\\n\", \"1431903.37398704\\n\", \"3204738.66592695\\n\", \"1358069.66344237\\n\", \"2498084.52239173\\n\", \"2249732.19834749\\n\", \"188.49555922\\n\", \"300823.20454449\\n\", \"6849356.85202423\\n\", \"1767717.63750721\\n\", \"5688321.59662970\\n\", \"1880701.87570092\\n\", \"7528079.09527639\\n\", \"1112051.54273975\\n\", \"1236942.41709056\\n\", \"1822249.40278822\\n\", \"2818608.65446688\\n\", \"141.37166941\\n\", \"321397.49483285\\n\", \"209230.07072908\\n\", \"1091803.97808737\\n\", \"4239579.28601943\\n\", \"1534313.01130876\\n\", \"6546315.68306631\\n\", \"1619004.06606423\\n\", \"4961429.31322006\\n\", \"1487949.38692708\\n\", \"1463652.30934422\\n\", \"1468430.67177033\\n\", \"1587123.18381560\\n\", \"310216.56657872\\n\", \"1843829.00272573\\n\", \"1644171.36481214\\n\", \"12.56637061\\n\", \"50.26548246\\n\", \"1493101.59887897\\n\", \"1808749.97915575\\n\", \"1616987.16358063\\n\", \"1919290.05826496\\n\", \"397568.55031179\\n\", \"40.84070450\\n\", \"1645311.76294539\\n\", \"2447300.67714645\\n\", \"37768.22688146\\n\", \"1700610.07683388\\n\", \"1400685.36778832\\n\", \"3211087.82467985\\n\", \"7888595.70183174\\n\", \"1809890.37728900\\n\", \"5486452.27748799\\n\", \"147.65485472\\n\", \"1929415.41138748\\n\", \"6470999.14078914\\n\", \"1290921.26206454\\n\", \"5730566.59304253\\n\", \"1290324.35946036\\n\", \"7349620.92458922\\n\", \"1145562.91157560\\n\", \"1142609.81448122\\n\", \"2055858.23250916\\n\", \"2913525.59330979\\n\", \"119.38052084\\n\", \"2556716.06608567\\n\", \"65210.03871056\\n\", \"3937254.40018652\\n\", \"4646946.46381776\\n\", \"1537517.43581542\\n\", \"5600925.63059949\\n\", \"1548676.37292097\\n\", \"2145704.64080917\\n\", \"1380981.29866500\\n\", \"1458028.85849429\\n\", \"1470237.08754614\\n\", \"1584342.87431718\\n\", \"210879.40687221\\n\", \"1838705.06510773\\n\", \"1471022.48570954\\n\", \"28.27433388\\n\", \"47.12388980\\n\", \"8003424.05491310\\n\", \"6718839.38523084\\n\", \"1743062.41836184\\n\", \"1131846.71805002\\n\", \"1091103.40292562\\n\", \"1510289.25228676\\n\", \"1987795.62766914\\n\", \"37805.92599330\\n\", \"1960089.92205713\\n\", \"3.141592653589793\\n\", \"40.840704496667314\\n\"]}", "source": "primeintellect"}
One day, as Sherlock Holmes was tracking down one very important criminal, he found a wonderful painting on the wall. This wall could be represented as a plane. The painting had several concentric circles that divided the wall into several parts. Some parts were painted red and all the other were painted blue. Besides, any two neighboring parts were painted different colors, that is, the red and the blue color were alternating, i. e. followed one after the other. The outer area of the wall (the area that lied outside all circles) was painted blue. Help Sherlock Holmes determine the total area of red parts of the wall. Let us remind you that two circles are called concentric if their centers coincide. Several circles are called concentric if any two of them are concentric. Input The first line contains the single integer n (1 ≤ n ≤ 100). The second line contains n space-separated integers ri (1 ≤ ri ≤ 1000) — the circles' radii. It is guaranteed that all circles are different. Output Print the single real number — total area of the part of the wall that is painted red. The answer is accepted if absolute or relative error doesn't exceed 10 - 4. Examples Input 1 1 Output 3.1415926536 Input 3 1 4 2 Output 40.8407044967 Note In the first sample the picture is just one circle of radius 1. Inner part of the circle is painted red. The area of the red part equals π × 12 = π. In the second sample there are three circles of radii 1, 4 and 2. Outside part of the second circle is painted blue. Part between the second and the third circles is painted red. Part between the first and the third is painted blue. And, finally, the inner part of the first circle is painted red. Overall there are two red parts: the ring between the second and the third circles and the inner part of the first circle. Total area of the red parts is equal (π × 42 - π × 22) + π × 12 = π × 12 + π = 13π Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0.75
{"tests": "{\"inputs\": [[10], [20], [0], [1], [200]], \"outputs\": [[23], [78], [0], [0], [9168]]}", "source": "primeintellect"}
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Finish the solution so that it returns the sum of all the multiples of 3 or 5 **below** the number passed in. > Note: If the number is a multiple of **both** 3 and 5, only count it *once*. > Also, if a number is negative, return 0(for languages that do have them) ###### *Courtesy of projecteuler.net* Write your solution by modifying this code: ```python def solution(number): ``` Your solution should implemented in the function "solution". The i Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [[1892376], [189237], [18922314324324234423437], [189223141324324234423437], [1892231413243242344321432142343423437], [0]], \"outputs\": [[true], [false], [false], [true], [true], [true]]}", "source": "primeintellect"}
###Lucky number Write a function to find if a number is lucky or not. If the sum of all digits is 0 or multiple of 9 then the number is lucky. `1892376 => 1+8+9+2+3+7+6 = 36`. 36 is divisble by 9, hence number is lucky. Function will return `true` for lucky numbers and `false` for others. Write your solution by modifying this code: ```python def is_lucky(n): ``` Your solution should implemented in the function "is_lucky". The i Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [[100, 12], [99, 0], [10, 15], [85, 5], [55, 3], [55, 0], [20, 2]], \"outputs\": [[100], [100], [100], [90], [75], [0], [0]]}", "source": "primeintellect"}
Create a function finalGrade, which calculates the final grade of a student depending on two parameters: a grade for the exam and a number of completed projects. This function should take two arguments: exam - grade for exam (from 0 to 100); projects - number of completed projects (from 0 and above); This function should return a number (final grade). There are four types of final grades: - 100, if a grade for the exam is more than 90 or if a number of completed projects more than 10. - 90, if a grade for the exam is more than 75 and if a number of completed projects is minimum 5. - 75, if a grade for the exam is more than 50 and if a number of completed projects is minimum 2. - 0, in other cases Examples: ~~~if-not:nasm ```python final_grade(100, 12) # 100 final_grade(99, 0) # 100 final_grade(10, 15) # 100 final_grade(85, 5) # 90 final_grade(55, 3) # 75 final_grade(55, 0) # 0 final_grade(20, 2) # 0 ``` ~~~ *Use Comparison and Logical Operators. Write your solution by modifying this code: ```python def final_grade(exam, projects): ``` Your solution should implemented in the function "final_grade". The i Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [\"AA\\n\", \"A\\n\", \"ABCDEF\\n\", \"BA\\n\", \"CC\\n\", \"B\\n\", \"FEDCBA\\n\", \"CBWBB\\n\", \"BBWBWB\\n\", \"BVWB\\n\", \"WWWOONOOOWWW\\n\", \"AB\\n\", \"C\\n\", \"EEDCBA\\n\", \"BBWBC\\n\", \"BBWBWA\\n\", \"BVXB\\n\", \"WWWOONOOOVWW\\n\", \"AC\\n\", \"D\\n\", \"DEECBA\\n\", \"BBWCB\\n\", \"BBBWWA\\n\", \"BXVB\\n\", \"WVWOONOOOVWW\\n\", \"@C\\n\", \"@\\n\", \"DCEEBA\\n\", \"BBBCW\\n\", \"BABWWA\\n\", \"BXBV\\n\", \"WOWOONVOOVWW\\n\", \"C@\\n\", \"E\\n\", \"CCEEBA\\n\", \"ABBCW\\n\", \"BAAWWA\\n\", \"CXBV\\n\", \"WOWONOVOOVWW\\n\", \"B@\\n\", \"F\\n\", \"ABEECC\\n\", \"ACBCW\\n\", \"AWWAAB\\n\", \"CXBU\\n\", \"WWVOOVONOWOW\\n\", \"A@\\n\", \"G\\n\", \"ABEEBC\\n\", \"@CBCW\\n\", \"AWWAAC\\n\", \"CXBT\\n\", \"WWVPOVONOWOW\\n\", \"BC\\n\", \"H\\n\", \"ABEEBD\\n\", \"@CBWC\\n\", \"CAAWWA\\n\", \"TBXC\\n\", \"WWVPOVONOWOV\\n\", \"CB\\n\", \"I\\n\", \"BBEEAC\\n\", \"WCB@C\\n\", \"AAAWWC\\n\", \"CXAT\\n\", \"WWVPOVONOWOU\\n\", \"J\\n\", \"CAEEBB\\n\", \"WCB?C\\n\", \"ABAWWC\\n\", \"DXAT\\n\", \"WOVPOVONWWOU\\n\", \"CD\\n\", \"K\\n\", \"CAEEBC\\n\", \"WCC?C\\n\", \"ABAWXC\\n\", \"TAXD\\n\", \"UOWWNOVOPVOW\\n\", \"DC\\n\", \"L\\n\", \"CADEBC\\n\", \"XCC?C\\n\", \"ACAWXC\\n\", \"UAXD\\n\", \"UOWWNOVOQVOW\\n\", \"EC\\n\", \"M\\n\", \"CCDEBA\\n\", \"C?CCX\\n\", \"CXWABA\\n\", \"DXAU\\n\", \"UOWWNOVOQVPW\\n\", \"OOOWWW\\n\", \"BBWBB\\n\", \"BBWWBB\\n\", \"BWWB\\n\", \"WWWOOOOOOWWW\\n\"], \"outputs\": [\"3\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"3\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"3\\n\", \"0\\n\", \"7\\n\"]}", "source": "primeintellect"}
Balph is learning to play a game called Buma. In this game, he is given a row of colored balls. He has to choose the color of one new ball and the place to insert it (between two balls, or to the left of all the balls, or to the right of all the balls). When the ball is inserted the following happens repeatedly: if some segment of balls of the same color became longer as a result of a previous action and its length became at least 3, then all the balls of this segment are eliminated. Consider, for example, a row of balls 'AAABBBWWBB'. Suppose Balph chooses a ball of color 'W' and the place to insert it after the sixth ball, i. e. to the left of the two 'W's. After Balph inserts this ball, the balls of color 'W' are eliminated, since this segment was made longer and has length 3 now, so the row becomes 'AAABBBBB'. The balls of color 'B' are eliminated now, because the segment of balls of color 'B' became longer and has length 5 now. Thus, the row becomes 'AAA'. However, none of the balls are eliminated now, because there is no elongated segment. Help Balph count the number of possible ways to choose a color of a new ball and a place to insert it that leads to the elimination of all the balls. Input The only line contains a non-empty string of uppercase English letters of length at most 3 ⋅ 10^5. Each letter represents a ball with the corresponding color. Output Output the number of ways to choose a color and a position of a new ball in order to eliminate all the balls. Examples Input BBWWBB Output 3 Input BWWB Output 0 Input BBWBB Output 0 Input OOOWWW Output 0 Input WWWOOOOOOWWW Output 7 Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0.25
{"tests": "{\"inputs\": [\"2\\nwhite 10\\nblack 10\\n4\\nblack\\nwhite\", \"3\\nwgite 10\\nerd 40\\nwhite 30\\n2\\nwhite\\nerd\\nwhite\", \"2\\nwhite 20\\nblack 10\\n2\\nkcalb\\norange\", \"2\\nwhite 20\\nblack 10\\n2\\nblack\\nhwite\", \"4\\nred 3444\\nred 3018\\nred 3098\\nred 3319\\n4\\nred\\nred\\nrec\\nred\", \"3\\nwhite 10\\nred 40\\nwhite 30\\n3\\nwhite\\nred\\nwhite\", \"2\\nwhite 10\\nblack 10\\n4\\nblack\\netihw\", \"2\\nxhite 20\\nblack 10\\n2\\nkcalb\\norange\", \"2\\nwhite 20\\nblack 18\\n2\\nblack\\nhwite\", \"4\\nred 3444\\nder 3018\\nred 3098\\nred 3319\\n4\\nred\\nred\\nrec\\nred\", \"3\\nwgite 10\\nred 40\\nwhite 30\\n3\\nwhite\\nred\\nwhite\", \"2\\nwhite 10\\nblack 10\\n4\\nkcalb\\netihw\", \"2\\nxhite 20\\nblack 19\\n2\\nkcalb\\norange\", \"2\\nwhite 20\\nblack 26\\n2\\nblack\\nhwite\", \"4\\nred 2133\\nder 3018\\nred 3098\\nred 3319\\n4\\nred\\nred\\nrec\\nred\", \"3\\nwgite 10\\nred 40\\nwhite 30\\n3\\nwhite\\nerd\\nwhite\", \"2\\nwhite 10\\nblacj 10\\n4\\nkcalb\\netihw\", \"2\\nxhite 20\\nbladk 19\\n2\\nkcalb\\norange\", \"2\\nwhite 20\\nblack 26\\n4\\nblack\\nhwite\", \"4\\nred 2133\\nder 3018\\nred 3098\\nred 3319\\n4\\nred\\nred\\ncer\\nred\", \"3\\nwgite 10\\nerd 40\\nwhite 30\\n3\\nwhite\\nerd\\nwhite\", \"2\\nwhite 10\\nblacj 10\\n4\\nblack\\netihw\", \"2\\nxhite 20\\nbmadk 19\\n2\\nkcalb\\norange\", \"2\\nwhite 20\\nblack 26\\n4\\nkcalb\\nhwite\", \"4\\nrec 2133\\nder 3018\\nred 3098\\nred 3319\\n4\\nred\\nred\\ncer\\nred\", \"2\\nwiite 10\\nblacj 10\\n4\\nblack\\netihw\", \"2\\nxhite 20\\nbmadk 19\\n2\\nkcalb\\negnaro\", \"2\\nwihte 20\\nblack 26\\n4\\nkcalb\\nhwite\", \"4\\nrec 2133\\nder 3018\\nred 3098\\nred 3319\\n4\\nred\\nrdd\\ncer\\nred\", \"3\\nwgite 10\\nerd 40\\nwhite 22\\n2\\nwhite\\nerd\\nwhite\", \"2\\nwiite 10\\nblacj 10\\n5\\nblack\\netihw\", \"2\\nxhite 20\\nbmadk 19\\n4\\nkcalb\\negnaro\", \"2\\nwihte 20\\nblack 26\\n4\\nkcalb\\nhwitf\", \"4\\nrec 2133\\nder 3018\\nred 3098\\nred 3319\\n4\\nsed\\nrdd\\ncer\\nred\", \"3\\nwgite 10\\neqd 40\\nwhite 22\\n2\\nwhite\\nerd\\nwhite\", \"2\\nwiite 10\\nblacj 19\\n5\\nblack\\netihw\", \"2\\nxhite 20\\nbmadk 19\\n4\\nbcalk\\negnaro\", \"2\\nwihte 20\\nkcalb 26\\n4\\nkcalb\\nhwitf\", \"4\\nrec 2133\\nder 3018\\nred 3098\\nred 3319\\n4\\nsde\\nrdd\\ncer\\nred\", \"3\\nwgite 10\\neqd 40\\nxhite 22\\n2\\nwhite\\nerd\\nwhite\", \"2\\nwiite 4\\nblacj 19\\n5\\nblack\\netihw\", \"2\\nxhite 34\\nbmadk 19\\n4\\nbcalk\\negnaro\", \"2\\nwihte 20\\nkcalb 26\\n4\\nblack\\nhwitf\", \"4\\nrec 2133\\nder 3018\\nred 3098\\nrec 3319\\n4\\nsde\\nrdd\\ncer\\nred\", \"3\\nwgite 10\\neqd 40\\nxhite 22\\n0\\nwhite\\nerd\\nwhite\", \"2\\nwihte 4\\nblacj 19\\n5\\nblack\\netihw\", \"2\\nxhite 34\\nbmadk 19\\n4\\nbcalk\\norange\", \"2\\nwihte 20\\nkcalb 26\\n4\\nblack\\nftiwh\", \"4\\nrec 2133\\nder 3018\\nred 3098\\nrec 3319\\n4\\nsde\\nddr\\ncer\\nred\", \"3\\nwgite 10\\neqd 40\\nxhite 22\\n0\\nwhite\\nere\\nwhite\", \"2\\nwieth 4\\nblacj 19\\n5\\nblack\\netihw\", \"2\\nxhite 34\\nbmadk 17\\n4\\nbcalk\\norange\", \"2\\nwihte 32\\nkcalb 26\\n4\\nblack\\nftiwh\", \"4\\nrec 2133\\nder 3018\\nred 3098\\nrec 3319\\n4\\nsde\\nddr\\ncer\\nrde\", \"3\\nwgite 10\\neqd 57\\nxhite 22\\n0\\nwhite\\nere\\nwhite\", \"2\\nwieth 8\\nblacj 19\\n5\\nblack\\netihw\", \"2\\netihx 34\\nbmadk 17\\n4\\nbcalk\\norange\", \"2\\nwihte 32\\nkcalb 26\\n7\\nblack\\nftiwh\", \"4\\nrec 2133\\nder 3018\\nred 3098\\ncer 3319\\n4\\nsde\\nddr\\ncer\\nrde\", \"3\\nwgite 10\\ndqe 57\\nxhite 22\\n0\\nwhite\\nere\\nwhite\", \"2\\nwieth 8\\nblacj 19\\n8\\nblack\\netihw\", \"2\\netihx 34\\nbmadk 17\\n4\\nbcamk\\norange\", \"2\\nwihte 35\\nkcalb 26\\n7\\nblack\\nftiwh\", \"4\\nrec 2133\\nder 4487\\nred 3098\\ncer 3319\\n4\\nsde\\nddr\\ncer\\nrde\", \"3\\nwgite 10\\ndqe 57\\nxhite 40\\n0\\nwhite\\nere\\nwhite\", \"2\\nwieth 8\\nblacj 19\\n8\\nbcalk\\netihw\", \"2\\netihx 34\\nkdamb 17\\n4\\nbcamk\\norange\", \"2\\nwihte 35\\nkcamb 26\\n7\\nblack\\nftiwh\", \"4\\nrec 2133\\nder 6618\\nred 3098\\ncer 3319\\n4\\nsde\\nddr\\ncer\\nrde\", \"3\\nwgite 10\\ndqe 8\\nxhite 40\\n0\\nwhite\\nere\\nwhite\", \"2\\nwieth 8\\nblacj 21\\n8\\nbcalk\\netihw\", \"2\\nesihx 34\\nkdamb 17\\n4\\nbcamk\\norange\", \"2\\nwihte 35\\nkcamb 26\\n7\\nclack\\nftiwh\", \"4\\nrec 2133\\nder 6618\\nred 3098\\nrec 3319\\n4\\nsde\\nddr\\ncer\\nrde\", \"3\\nwgite 18\\ndqe 8\\nxhite 40\\n0\\nwhite\\nere\\nwhite\", \"2\\nwieth 8\\nblacj 21\\n2\\nbcalk\\netihw\", \"2\\nesihx 34\\nkdamb 17\\n8\\nbcamk\\norange\", \"2\\nwihte 35\\nkcamb 26\\n11\\nclack\\nftiwh\", \"4\\ncer 2133\\nder 6618\\nred 3098\\nrec 3319\\n4\\nsde\\nddr\\ncer\\nrde\", \"3\\nwgite 18\\neqd 8\\nxhite 40\\n0\\nwhite\\nere\\nwhite\", \"2\\nwieth 8\\nblacj 40\\n2\\nbcalk\\netihw\", \"2\\nesihx 34\\nkdamb 17\\n8\\nkmacb\\norange\", \"2\\nwihte 66\\nkcamb 26\\n11\\nclack\\nftiwh\", \"4\\ncer 2133\\nder 6618\\nred 3098\\nrec 3319\\n5\\nsde\\nddr\\ncer\\nrde\", \"3\\nwgite 18\\neqd 8\\nxhite 40\\n0\\nwhite\\nese\\nwhite\", \"2\\nwieth 8\\njcalb 40\\n2\\nbcalk\\netihw\", \"2\\nesihx 34\\nkdamb 17\\n0\\nkmacb\\norange\", \"2\\nwihte 66\\nkcamb 26\\n11\\nkcalc\\nftiwh\", \"4\\ncre 2133\\nder 6618\\nred 3098\\nrec 3319\\n5\\nsde\\nddr\\ncer\\nrde\", \"3\\nwgite 18\\neqd 8\\nxhite 40\\n0\\nwiite\\nese\\nwhite\", \"2\\nwieth 6\\njcalb 40\\n2\\nbcalk\\netihw\", \"2\\nesihx 34\\nkdamb 17\\n0\\nkmaca\\norange\", \"2\\nwiite 66\\nkcamb 26\\n11\\nclack\\nftiwh\", \"4\\ncre 2133\\nder 6618\\nred 3098\\nrce 3319\\n5\\nsde\\nddr\\ncer\\nrde\", \"2\\nwieth 6\\njcalb 40\\n3\\nbcalk\\netihw\", \"2\\nesihx 34\\nkdamb 17\\n1\\nkmaca\\norange\", \"2\\nwiite 49\\nkcamb 26\\n11\\nclack\\nftiwh\", \"4\\ncre 2133\\nder 6618\\nqed 3098\\nrce 3319\\n5\\nsde\\nddr\\ncer\\nrde\", \"2\\nwieth 6\\njcalb 40\\n0\\nbcalk\\netihw\", \"2\\nesihx 34\\nkdamb 17\\n1\\ncmaka\\norange\", \"2\\nwhite 10\\nblack 10\\n2\\nblack\\nwhite\", \"2\\nwhite 20\\nblack 10\\n2\\nblack\\norange\", \"2\\nwhite 20\\nblack 10\\n2\\nblack\\nwhite\", \"4\\nred 3444\\nred 3018\\nred 3098\\nred 3319\\n4\\nred\\nred\\nred\\nred\", \"3\\nwhite 10\\nred 20\\nwhite 30\\n3\\nwhite\\nred\\nwhite\"], \"outputs\": [\"No\\n\", \"Yes\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"Yes\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"Yes\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"Yes\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"Yes\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"Yes\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"Yes\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"Yes\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"Yes\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"Yes\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"Yes\\n\", \"No\\n\", \"Yes\\n\", \"No\\n\", \"No\\n\", \"Yes\\n\", \"No\\n\", \"Yes\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"Yes\\n\", \"No\\n\", \"No\", \"No\", \"Yes\", \"Yes\", \"Yes\"]}", "source": "primeintellect"}
In the Jambo Amusement Garden (JAG), you sell colorful drinks consisting of multiple color layers. This colorful drink can be made by pouring multiple colored liquids of different density from the bottom in order. You have already prepared several colored liquids with various colors and densities. You will receive a drink request with specified color layers. The colorful drink that you will serve must satisfy the following conditions. * You cannot use a mixed colored liquid as a layer. Thus, for instance, you cannot create a new liquid with a new color by mixing two or more different colored liquids, nor create a liquid with a density between two or more liquids with the same color by mixing them. * Only a colored liquid with strictly less density can be an upper layer of a denser colored liquid in a drink. That is, you can put a layer of a colored liquid with density $x$ directly above the layer of a colored liquid with density $y$ if $x < y$ holds. Your task is to create a program to determine whether a given request can be fulfilled with the prepared colored liquids under the above conditions or not. Input The input consists of a single test case in the format below. $N$ $C_1$ $D_1$ $\vdots$ $C_N$ $D_N$ $M$ $O_1$ $\vdots$ $O_M$ The first line consists of an integer $N$ ($1 \leq N \leq 10^5$), which represents the number of the prepared colored liquids. The following $N$ lines consists of $C_i$ and $D_i$ ($1 \leq i \leq N$). $C_i$ is a string consisting of lowercase alphabets and denotes the color of the $i$-th prepared colored liquid. The length of $C_i$ is between $1$ and $20$ inclusive. $D_i$ is an integer and represents the density of the $i$-th prepared colored liquid. The value of $D_i$ is between $1$ and $10^5$ inclusive. The ($N+2$)-nd line consists of an integer $M$ ($1 \leq M \leq 10^5$), which represents the number of color layers of a drink request. The following $M$ lines consists of $O_i$ ($1 \leq i \leq M$). $O_i$ is a string consisting of lowercase alphabets and denotes the color of the $i$-th layer from the top of the drink request. The length of $O_i$ is between $1$ and $20$ inclusive. Output If the requested colorful drink can be served by using some of the prepared colored liquids, print 'Yes'. Otherwise, print 'No'. Examples Input 2 white 20 black 10 2 black white Output Yes Input 2 white 10 black 10 2 black white Output No Input 2 white 20 black 10 2 black orange Output No Input 3 white 10 red 20 white 30 3 white red white Output Yes Input 4 red 3444 red 3018 red 3098 red 3319 4 red red red red Output Yes Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [[1, 1, 2], [2, 0, 3], [423, 100, 150], [1, 2, 0], [1, 2, 2], [-1.0, 2, 2]], \"outputs\": [[[2, 6]], [[0, 4, 12, 24]], [[4272300, 4357746, 4444038, 4531176, 4619160, 4707990, 4797666, 4888188, 4979556, 5071770, 5164830, 5258736, 5353488, 5449086, 5545530, 5642820, 5740956, 5839938, 5939766, 6040440, 6141960, 6244326, 6347538, 6451596, 6556500, 6662250, 6768846, 6876288, 6984576, 7093710, 7203690, 7314516, 7426188, 7538706, 7652070, 7766280, 7881336, 7997238, 8113986, 8231580, 8350020, 8469306, 8589438, 8710416, 8832240, 8954910, 9078426, 9202788, 9327996, 9454050, 9580950]], [[]], [[6]], [[]]]}", "source": "primeintellect"}
Quantum mechanics tells us that a molecule is only allowed to have specific, discrete amounts of internal energy. The 'rigid rotor model', a model for describing rotations, tells us that the amount of rotational energy a molecule can have is given by: `E = B * J * (J + 1)`, where J is the state the molecule is in, and B is the 'rotational constant' (specific to the molecular species). Write a function that returns an array of allowed energies for levels between Jmin and Jmax. Notes: * return empty array if Jmin is greater than Jmax (as it make no sense). * Jmin, Jmax are integers. * physically B must be positive, so return empty array if B <= 0 Write your solution by modifying this code: ```python def rot_energies(B, Jmin, Jmax): ``` Your solution should implemented in the function "rot_energies". The i Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [[\"Jimmy\"], [\"Samantha\"], [\"Sam\"], [\"Kayne\"], [\"Melissa\"], [\"James\"], [\"Gregory\"], [\"Jeannie\"], [\"Kimberly\"], [\"Timothy\"], [\"Dani\"], [\"Saamy\"], [\"Saemy\"], [\"Saimy\"], [\"Saomy\"], [\"Saumy\"], [\"Boyna\"], [\"Kiyna\"], [\"Sayma\"], [\"Ni\"], [\"Jam\"], [\"Suv\"]], \"outputs\": [[\"Jim\"], [\"Sam\"], [\"Error: Name too short\"], [\"Kay\"], [\"Mel\"], [\"Jam\"], [\"Greg\"], [\"Jean\"], [\"Kim\"], [\"Tim\"], [\"Dan\"], [\"Saam\"], [\"Saem\"], [\"Saim\"], [\"Saom\"], [\"Saum\"], [\"Boy\"], [\"Kiy\"], [\"Say\"], [\"Error: Name too short\"], [\"Error: Name too short\"], [\"Error: Name too short\"]]}", "source": "primeintellect"}
Nickname Generator Write a function, `nicknameGenerator` that takes a string name as an argument and returns the first 3 or 4 letters as a nickname. If the 3rd letter is a consonant, return the first 3 letters. If the 3rd letter is a vowel, return the first 4 letters. If the string is less than 4 characters, return "Error: Name too short". **Notes:** - Vowels are "aeiou", so discount the letter "y". - Input will always be a string. - Input will always have the first letter capitalised and the rest lowercase (e.g. Sam). - The input can be modified Write your solution by modifying this code: ```python def nickname_generator(name): ``` Your solution should implemented in the function "nickname_generator". The i Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [\"2\\n0 2\", \"2\\n-1 4\", \"2\\n0 4\", \"2\\n0 1\", \"2\\n1 0\", \"2\\n0 7\", \"2\\n-1 2\", \"2\\n2 0\", \"2\\n-1 10\", \"2\\n-2 2\", \"2\\n2 -1\", \"2\\n-2 4\", \"2\\n4 -1\", \"2\\n-2 8\", \"2\\n4 0\", \"2\\n-2 5\", \"2\\n5 0\", \"2\\n1 1\", \"2\\n2 2\", \"2\\n2 4\", \"2\\n4 4\", \"2\\n0 0\", \"2\\n1 4\", \"2\\n0 3\", \"2\\n0 -2\", \"2\\n2 1\", \"2\\n2 8\", \"2\\n0 8\", \"2\\n0 10\", \"2\\n-4 2\", \"2\\n-2 3\", \"2\\n4 1\", \"2\\n-3 8\", \"2\\n3 0\", \"2\\n3 2\", \"2\\n2 7\", \"2\\n4 2\", \"2\\n1 5\", \"2\\n5 1\", \"2\\n8 1\", \"2\\n2 3\", \"2\\n1 8\", \"2\\n1 10\", \"2\\n6 2\", \"2\\n0 9\", \"2\\n3 1\", \"2\\n3 4\", \"2\\n1 7\", \"2\\n6 0\", \"2\\n1 6\", \"2\\n6 1\", \"2\\n4 3\", \"2\\n4 8\", \"2\\n1 13\", \"2\\n-2 0\", \"2\\n1 9\", \"2\\n2 -2\", \"2\\n3 5\", \"2\\n1 15\", \"2\\n6 -1\", \"2\\n2 6\", \"2\\n7 1\", \"2\\n12 0\", \"2\\n7 8\", \"2\\n0 13\", \"2\\n2 9\", \"2\\n2 -4\", \"2\\n10 0\", \"2\\n0 15\", \"2\\n4 -2\", \"2\\n7 0\", \"2\\n21 0\", \"2\\n7 9\", \"2\\n2 15\", \"2\\n4 -4\", \"2\\n10 -1\", \"2\\n0 11\", \"2\\n14 0\", \"2\\n34 0\", \"2\\n5 9\", \"2\\n4 15\", \"2\\n0 -4\", \"2\\n10 -2\", \"2\\n14 -1\", \"2\\n24 0\", \"2\\n7 18\", \"2\\n4 10\", \"2\\n13 -2\", \"2\\n24 1\", \"2\\n7 36\", \"2\\n5 10\", \"2\\n15 1\", \"2\\n13 36\", \"2\\n5 3\", \"2\\n19 1\", \"2\\n13 38\", \"2\\n1 3\", \"2\\n19 0\", \"2\\n13 26\", \"2\\n38 0\", \"2\\n1 2\"], \"outputs\": [\"Second\\n\", \"First\\n\", \"Second\\n\", \"First\\n\", \"First\\n\", \"First\\n\", \"First\\n\", \"Second\\n\", \"First\\n\", \"Second\\n\", \"First\\n\", \"Second\\n\", \"First\\n\", \"Second\\n\", \"Second\\n\", \"First\\n\", \"First\\n\", \"First\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"First\\n\", \"First\\n\", \"Second\\n\", \"First\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"First\\n\", \"First\\n\", \"First\\n\", \"First\\n\", \"First\\n\", \"First\\n\", \"Second\\n\", \"First\\n\", \"First\\n\", \"First\\n\", \"First\\n\", \"First\\n\", \"First\\n\", \"Second\\n\", \"First\\n\", \"First\\n\", \"First\\n\", \"First\\n\", \"Second\\n\", \"First\\n\", \"First\\n\", \"First\\n\", \"Second\\n\", \"First\\n\", \"Second\\n\", \"First\\n\", \"Second\\n\", \"First\\n\", \"First\\n\", \"First\\n\", \"Second\\n\", \"First\\n\", \"Second\\n\", \"First\\n\", \"First\\n\", \"First\\n\", \"Second\\n\", \"Second\\n\", \"First\\n\", \"Second\\n\", \"First\\n\", \"First\\n\", \"First\\n\", \"First\\n\", \"Second\\n\", \"First\\n\", \"First\\n\", \"Second\\n\", \"Second\\n\", \"First\\n\", \"First\\n\", \"Second\\n\", \"Second\\n\", \"First\\n\", \"Second\\n\", \"First\\n\", \"Second\\n\", \"First\\n\", \"First\\n\", \"First\\n\", \"First\\n\", \"First\\n\", \"First\\n\", \"First\\n\", \"First\\n\", \"First\\n\", \"First\\n\", \"First\\n\", \"First\\n\", \"Second\\n\", \"First\"]}", "source": "primeintellect"}
Problem statement There is a positive integer sequence $ a_1, a_2, \ ldots, a_N $ of length $ N $. Consider the following game, which uses this sequence and is played by $ 2 $ players on the play and the play. * Alternately select one of the following operations for the first move and the second move. * Select a positive term in the sequence for $ 1 $ and decrement its value by $ 1 $. * When all terms in the sequence are positive, decrement the values ​​of all terms by $ 1 $. The one who cannot operate first is the loser. When $ 2 $ players act optimally, ask for the first move or the second move. Constraint * $ 1 \ leq N \ leq 2 \ times 10 ^ 5 $ * $ 1 \ leq a_i \ leq 10 ^ 9 $ * All inputs are integers * * * input Input is given from standard input in the following format. $ N $ $ a_1 $ $ a_2 $ $ ... $ $ a_N $ output Output `First` when the first move wins, and output` Second` when the second move wins. * * * Input example 1 2 1 2 Output example 1 First The first move has to reduce the value of the $ 1 $ term by $ 1 $ first, and then the second move has to reduce the value of the $ 2 $ term by $ 1 $. If the first move then decrements the value of the $ 2 $ term by $ 1 $, the value of all terms in the sequence will be $ 0 $, and the second move will not be able to perform any operations. * * * Input example 2 Five 3 1 4 1 5 Output example 2 Second * * * Input example 3 8 2 4 8 16 32 64 128 256 Output example 3 Second * * * Input example 4 3 999999999 1000000000 1000000000 Output example 4 First Example Input 2 1 2 Output First Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [\"5\\n0 1 0 1 0\\n1 1 0 0 1\\n1 0 1 0 1\\n0 0 1 1 0\\n\", \"3\\n1 0 0\\n0 0 0\\n0 0 0\\n0 0 0\\n\", \"1\\n0\\n1\\n1\\n0\\n\", \"7\\n1 0 0 1 1 0 1\\n1 0 0 0 1 1 1\\n1 1 1 0 0 1 0\\n0 1 1 1 0 0 0\\n\", \"7\\n0 0 1 0 1 0 1\\n0 0 0 0 0 0 1\\n0 1 0 1 0 1 0\\n1 0 0 0 0 0 0\\n\", \"7\\n0 0 0 0 0 0 0\\n1 0 0 0 0 0 0\\n0 0 0 0 0 1 0\\n0 0 0 0 0 0 0\\n\", \"7\\n0 0 0 0 0 0 0\\n1 0 0 0 0 0 0\\n0 1 0 0 0 0 0\\n0 0 0 0 0 0 0\\n\", \"7\\n0 0 1 0 0 0 0\\n1 1 0 0 1 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1 1 1 0 1 1 1 0 0 0 1 0 1 0 1 0 0 0 1 0 0 1 0 0 1 1 1 0 1 0\\n\"], \"outputs\": [\"5\\n\", \"-1\\n\", \"1\\n\", \"-1\\n\", \"9\\n\", \"6\\n\", \"2\\n\", \"9\\n\", \"12\\n\", \"11\\n\", \"24\\n\", \"0\\n\", \"20\\n\", \"22\\n\", \"13\\n\", \"35\\n\", \"39\\n\", \"74\\n\", \"81\\n\", \"85\\n\", \"144\\n\", \"252\\n\", \"117\\n\", \"106\\n\"]}", "source": "primeintellect"}
Pupils Alice and Ibragim are best friends. It's Ibragim's birthday soon, so Alice decided to gift him a new puzzle. The puzzle can be represented as a matrix with $2$ rows and $n$ columns, every element of which is either $0$ or $1$. In one move you can swap two values in neighboring cells. More formally, let's number rows $1$ to $2$ from top to bottom, and columns $1$ to $n$ from left to right. Also, let's denote a cell in row $x$ and column $y$ as $(x, y)$. We consider cells $(x_1, y_1)$ and $(x_2, y_2)$ neighboring if $|x_1 - x_2| + |y_1 - y_2| = 1$. Alice doesn't like the way in which the cells are currently arranged, so she came up with her own arrangement, with which she wants to gift the puzzle to Ibragim. Since you are her smartest friend, she asked you to help her find the minimal possible number of operations in which she can get the desired arrangement. Find this number, or determine that it's not possible to get the new arrangement. -----Input----- The first line contains an integer $n$ ($1 \leq n \leq 200000$) — the number of columns in the puzzle. Following two lines describe the current arrangement on the puzzle. Each line contains $n$ integers, every one of which is either $0$ or $1$. The last two lines describe Alice's desired arrangement in the same format. -----Output----- If it is possible to get the desired arrangement, print the minimal possible number of steps, otherwise print $-1$. -----Examples----- Input 5 0 1 0 1 0 1 1 0 0 1 1 0 1 0 1 0 0 1 1 0 Output 5 Input 3 1 0 0 0 0 0 0 0 0 0 0 0 Output -1 -----Note----- In the first example the following sequence of swaps will suffice: $(2, 1), (1, 1)$, $(1, 2), (1, 3)$, $(2, 2), (2, 3)$, $(1, 4), (1, 5)$, $(2, 5), (2, 4)$. It can be shown that $5$ is the minimal possible answer in this case. In the second example no matter what swaps you do, you won't get the desired arrangement, so the answer is $-1$. Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [[[1, 2]], [[1, 3]], [[1, 5]], [[]], [[0]], [[0, 1]], [[1, 3, 5, 7]], [[2, 4]], [[-1]], [[-1, -1]], [[-1, 0, 1]], [[-3, 3]], [[-5, 3]]], \"outputs\": [[1], [3], [null], [null], [0], [1], [7], [null], [-1], [null], [-1], [3], [null]]}", "source": "primeintellect"}
Integral numbers can be even or odd. Even numbers satisfy `n = 2m` ( with `m` also integral ) and we will ( completely arbitrarily ) think of odd numbers as `n = 2m + 1`. Now, some odd numbers can be more odd than others: when for some `n`, `m` is more odd than for another's. Recursively. :] Even numbers are just not odd. # Task Given a finite list of integral ( not necessarily non-negative ) numbers, determine the number that is _odder than the rest_. If there is no single such number, no number is odder than the rest; return `Nothing`, `null` or a similar empty value. # Examples ```python oddest([1,2]) => 1 oddest([1,3]) => 3 oddest([1,5]) => None ``` # Hint Do you _really_ want one? Point or tap here. Write your solution by modifying this code: ```python def oddest(a): ``` Your solution should implemented in the function "oddest". The i Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [[\"a\"], [\"b\"], [\"c\"], [\"\"], [\"aaa\"], [\"abc\"], [\"Mary Had A Little Lamb\"], [\"Mary had a little lamb\"], [\"CodeWars rocks\"], [\"And so does Strive\"]], \"outputs\": [[97], [98], [99], [0], [291], [294], [1873], [2001], [1370], [1661]]}", "source": "primeintellect"}
You'll be given a string, and have to return the total of all the unicode characters as an int. Should be able to handle any characters sent at it. examples: uniTotal("a") == 97 uniTotal("aaa") == 291 Write your solution by modifying this code: ```python def uni_total(string): ``` Your solution should implemented in the function "uni_total". The i Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [\"341143514535\\n158\\n143565553551655311343411652235654535651124615163\\n551544654451431564\\n4\\n3411\\n6363636363\\n153414\", \"341143514535\\n314\\n10141283183115209195186599000583233654691126402\\n551544654451431564\\n4\\n3411\\n6363636363\\n153414\", \"341143514535\\n158\\n143565553551655311343411652235654535651124615163\\n551544654451431564\\n4\\n2934\\n6363636363\\n153414\", \"341143514535\\n315\\n143565553551655311343411652235654535651124615163\\n551544654451431564\\n4\\n3411\\n6363636363\\n286878\", \"341143514535\\n314\\n10141283183115209195186599000583233654691126402\\n551544654451431564\\n4\\n5438\\n6363636363\\n153414\", \"341143514535\\n315\\n134434432068311350616294587682501914319399594776\\n551544654451431564\\n4\\n3411\\n6363636363\\n286878\", \"341143514535\\n314\\n10141283183115209195186599000583233654691126402\\n551544654451431564\\n4\\n2886\\n6363636363\\n187636\", \"341143514535\\n181\\n143565553551655311343411652235654535651124615163\\n551544654451431564\\n4\\n2566\\n944133637\\n153414\", \"341143514535\\n314\\n10141283183115209195186599000583233654691126402\\n282179687988515070\\n8\\n2886\\n6363636363\\n187636\", \"341143514535\\n181\\n143565553551655311343411652235654535651124615163\\n115800800717045334\\n4\\n3636\\n944133637\\n153414\", \"341143514535\\n314\\n10141283183115209195186599000583233654691126402\\n282179687988515070\\n13\\n2886\\n6363636363\\n187636\", \"341143514535\\n181\\n32046002108896980375797364913448132483569780115\\n115800800717045334\\n4\\n3636\\n944133637\\n153414\", \"341143514535\\n181\\n32046002108896980375797364913448132483569780115\\n115800800717045334\\n4\\n3636\\n926957805\\n226283\", \"341143514535\\n41\\n37162501094979428233651696205621400978554503807\\n282027569597679523\\n2\\n2497\\n8100605990\\n32262\", \"341143514535\\n4\\n57416920605994760048925235855038060245069725244\\n2676207125938811\\n16\\n892\\n2344655145\\n113538\", \"341143514535\\n41\\n184446995852376586192732086039967558479859887996\\n369297301045414755\\n1\\n4412\\n15230971988\\n27\", \"341143514535\\n62\\n184446995852376586192732086039967558479859887996\\n369297301045414755\\n1\\n4412\\n15230971988\\n27\", \"341143514535\\n315\\n143565553551655311343411652235654535651124615163\\n551544654451431564\\n4\\n3411\\n3125343369\\n153414\", \"341143514535\\n315\\n143565553551655311343411652235654535651124615163\\n551544654451431564\\n4\\n3411\\n18682587\\n286878\", \"341143514535\\n12\\n134434432068311350616294587682501914319399594776\\n551544654451431564\\n4\\n3411\\n6363636363\\n286878\", \"341143514535\\n181\\n143565553551655311343411652235654535651124615163\\n551544654451431564\\n4\\n2566\\n944133637\\n189969\", \"341143514535\\n181\\n217268323167730556873628418879974796689502460470\\n551544654451431564\\n4\\n3636\\n944133637\\n153414\", \"341143514535\\n314\\n10141283183115209195186599000583233654691126402\\n282179687988515070\\n13\\n2886\\n9463978611\\n187636\", \"341143514535\\n181\\n32046002108896980375797364913448132483569780115\\n115800800717045334\\n4\\n3636\\n926957805\\n315414\", \"341143514535\\n314\\n30898720832098000876026338206663650229398181059\\n282179687988515070\\n16\\n1312\\n1774794917\\n113538\", \"341143514535\\n15\\n30898720832098000876026338206663650229398181059\\n2676207125938811\\n16\\n2886\\n1774794917\\n113538\", \"341143514535\\n314\\n30898720832098000876026338206663650229398181059\\n2676207125938811\\n15\\n892\\n2194480272\\n113538\", \"341143514535\\n3\\n57416920605994760048925235855038060245069725244\\n2676207125938811\\n1\\n1315\\n2344655145\\n221643\", \"341143514535\\n41\\n184446995852376586192732086039967558479859887996\\n205297297129669275\\n2\\n3654\\n9144392746\\n45\", \"341143514535\\n62\\n184446995852376586192732086039967558479859887996\\n369297301045414755\\n1\\n2335\\n15230971988\\n27\", \"341143514535\\n314\\n125923231755564817894069768408189922984281004281\\n102889087146575028\\n4\\n3411\\n6363636363\\n153414\", \"341143514535\\n314\\n10141283183115209195186599000583233654691126402\\n551544654451431564\\n4\\n3411\\n1596976849\\n204903\", \"341143514535\\n34\\n10141283183115209195186599000583233654691126402\\n551544654451431564\\n4\\n5438\\n6363636363\\n153414\", \"341143514535\\n315\\n134434432068311350616294587682501914319399594776\\n551544654451431564\\n2\\n3522\\n6363636363\\n476174\", \"341143514535\\n181\\n143565553551655311343411652235654535651124615163\\n234111792188021198\\n4\\n2566\\n944133637\\n189969\", \"341143514535\\n314\\n10141283183115209195186599000583233654691126402\\n551544654451431564\\n8\\n3870\\n10982863501\\n187636\", \"341143514535\\n41\\n65381078271673290232735155892140400888196361877\\n282027569597679523\\n2\\n3654\\n4678369764\\n6512\", \"341143514535\\n4\\n57416920605994760048925235855038060245069725244\\n4315398340179219\\n1\\n483\\n2344655145\\n3562\", \"341143514535\\n13\\n184446995852376586192732086039967558479859887996\\n369297301045414755\\n1\\n2335\\n15230971988\\n27\", \"341143514535\\n314\\n10141283183115209195186599000583233654691126402\\n658086598628596146\\n4\\n3411\\n1596976849\\n204903\", \"341143514535\\n34\\n10141283183115209195186599000583233654691126402\\n597176611475512765\\n4\\n5438\\n6363636363\\n153414\", \"341143514535\\n21\\n40600485682933788523415793109169629735840429955\\n551544654451431564\\n4\\n3411\\n6363636363\\n286878\", \"341143514535\\n181\\n217268323167730556873628418879974796689502460470\\n551544654451431564\\n2\\n4362\\n944133637\\n153414\", \"341143514535\\n62\\n32046002108896980375797364913448132483569780115\\n3043193507085101\\n4\\n3636\\n926957805\\n153414\", \"341143514535\\n531\\n37162501094979428233651696205621400978554503807\\n551544654451431564\\n7\\n1221\\n6363636363\\n158596\", \"341143514535\\n4\\n57416920605994760048925235855038060245069725244\\n2676207125938811\\n12\\n892\\n381840708\\n210580\", \"341143514535\\n4\\n37399701148259227720821529344819936896153605650\\n2676207125938811\\n12\\n758\\n2344655145\\n211356\", \"341143514535\\n41\\n184446995852376586192732086039967558479859887996\\n205297297129669275\\n2\\n1437\\n9144392746\\n34\", \"341143514535\\n13\\n184446995852376586192732086039967558479859887996\\n369297301045414755\\n1\\n4298\\n15230971988\\n27\", \"341143514535\\n53\\n10141283183115209195186599000583233654691126402\\n597176611475512765\\n4\\n5438\\n6363636363\\n153414\", \"341143514535\\n315\\n197449213697249494482601297880256428166369373159\\n551544654451431564\\n2\\n3522\\n6537062539\\n476174\", \"341143514535\\n314\\n18269162309686324710123374771799119703741778791\\n525739556089971699\\n22\\n1669\\n7326895675\\n113538\", \"341143514535\\n247\\n37162501094979428233651696205621400978554503807\\n282027569597679523\\n2\\n54\\n6363636363\\n18080\", \"341143514535\\n51\\n29783341012351940289658165982850381294333272161\\n282027569597679523\\n2\\n3003\\n8100605990\\n5862\", \"341143514535\\n52\\n115594971191498200927022084247910438448390243498\\n85612849220156641\\n2\\n3654\\n4901577317\\n8\", \"341143514535\\n46\\n184446995852376586192732086039967558479859887996\\n93525119426646135\\n4\\n3654\\n14315392071\\n23\", \"341143514535\\n314\\n10141283183115209195186599000583233654691126402\\n658086598628596146\\n4\\n3411\\n1596976849\\n213522\", \"341143514535\\n53\\n10141283183115209195186599000583233654691126402\\n597176611475512765\\n4\\n5438\\n9495385163\\n153414\", \"341143514535\\n181\\n19825000303799288081485376679544670767852795880\\n38503409770577147\\n5\\n45\\n6363636363\\n83979\", \"341143514535\\n531\\n37162501094979428233651696205621400978554503807\\n282027569597679523\\n4\\n872\\n1933238719\\n2334\", \"341143514535\\n4\\n57416920605994760048925235855038060245069725244\\n2676207125938811\\n25\\n1721\\n5872974446\\n19929\", \"341143514535\\n72\\n3076486307450056489538247907517896239068515318\\n282027569597679523\\n2\\n978\\n4678369764\\n6512\", \"341143514535\\n63\\n115594971191498200927022084247910438448390243498\\n85612849220156641\\n2\\n3654\\n4901577317\\n8\", \"341143514535\\n448\\n193116182628118295904261439594415083914751086107\\n137528655344406976\\n4\\n3411\\n6363636363\\n208864\", \"341143514535\\n290\\n30898720832098000876026338206663650229398181059\\n17352232542053536\\n14\\n1312\\n1774794917\\n102377\", \"341143514535\\n247\\n18567775233544482973034888475783419745934051775\\n282027569597679523\\n2\\n54\\n6363636363\\n5361\", \"341143514535\\n13\\n30898720832098000876026338206663650229398181059\\n2676207125938811\\n15\\n1393\\n4270665842\\n113538\", \"341143514535\\n314\\n18378654077924835003166058323764793081194911052\\n658086598628596146\\n4\\n963\\n1596976849\\n213522\", \"341143514535\\n65\\n143565553551655311343411652235654535651124615163\\n113166202513197773\\n3\\n3696\\n11336774140\\n279322\", \"341143514535\\n21\\n42443804740720571425221499465094514081038277326\\n551544654451431564\\n2\\n1458\\n6363636363\\n286878\", \"341143514535\\n181\\n19825000303799288081485376679544670767852795880\\n38503409770577147\\n5\\n45\\n8837961198\\n125291\", \"341143514535\\n11\\n30898720832098000876026338206663650229398181059\\n2676207125938811\\n15\\n1393\\n4270665842\\n113538\", \"341143514535\\n385\\n71824655952207740901311455438096728011967778146\\n551544654451431564\\n15\\n2934\\n574683466\\n190759\", \"341143514535\\n21\\n42443804740720571425221499465094514081038277326\\n1059545874915856537\\n2\\n1458\\n6363636363\\n286878\", \"341143514535\\n42\\n38214796081874822096200569325615860221659832255\\n119023580899048464\\n4\\n1814\\n1962155200\\n271812\", \"341143514535\\n716\\n37162501094979428233651696205621400978554503807\\n720524643915987824\\n7\\n1221\\n6363636363\\n27088\", \"341143514535\\n355\\n18035278010800399267121408158985052229288143132\\n282179687988515070\\n33\\n3700\\n5382360231\\n153067\", \"341143514535\\n279\\n42377013992733378815798372875856762676512892368\\n6970289269838656\\n2\\n4423\\n926957805\\n226283\", \"341143514535\\n232\\n32046002108896980375797364913448132483569780115\\n66578530082653522\\n4\\n4331\\n926957805\\n7459\", \"341143514535\\n234\\n37162501094979428233651696205621400978554503807\\n599068204338957948\\n2\\n4372\\n12549756109\\n34\", \"341143514535\\n4\\n54006127823908085499122309644186136569355580523\\n4412551451445422\\n25\\n1359\\n5872974446\\n19929\", \"341143514535\\n65\\n184446995852376586192732086039967558479859887996\\n48851490094833147\\n5\\n3654\\n9819338479\\n4\", \"341143514535\\n333\\n30454996331578992914462330581351594845790018452\\n282179687988515070\\n1\\n6315\\n3228386496\\n192312\", \"341143514535\\n11\\n30898720832098000876026338206663650229398181059\\n2676207125938811\\n21\\n1393\\n5345507448\\n113538\", \"341143514535\\n1\\n37162501094979428233651696205621400978554503807\\n98431333038118151\\n2\\n2441\\n838527013\\n14017\", \"341143514535\\n8\\n58142494878361992805410320338006660666574236572\\n2676207125938811\\n13\\n758\\n2344655145\\n83020\", \"341143514535\\n63\\n176148955982438742549278076157068587034179176431\\n85612849220156641\\n3\\n3654\\n4901577317\\n12\", \"341143514535\\n4\\n2628504932669101613029881637936342059028211893\\n4681474653965067\\n2\\n483\\n1973970059\\n1522\", \"341143514535\\n11\\n57416920605994760048925235855038060245069725244\\n295970426956453\\n2\\n321\\n857945608\\n33920\", \"341143514535\\n531\\n134434432068311350616294587682501914319399594776\\n551544654451431564\\n12\\n6734\\n371152768\\n567\", \"341143514535\\n11\\n30898720832098000876026338206663650229398181059\\n2676207125938811\\n31\\n1393\\n5345507448\\n113538\", \"341143514535\\n234\\n14606625495965263072462227259073979016841604425\\n77996439312031059\\n2\\n4372\\n12549756109\\n64\", \"341143514535\\n102\\n176148955982438742549278076157068587034179176431\\n85612849220156641\\n3\\n3654\\n1399854718\\n12\", \"341143514535\\n506\\n32046002108896980375797364913448132483569780115\\n1292438870134678934\\n14\\n4793\\n154446917\\n286401\", \"341143514535\\n8\\n54006127823908085499122309644186136569355580523\\n4412551451445422\\n42\\n1359\\n7212471124\\n16994\", \"341143514535\\n652\\n37162501094979428233651696205621400978554503807\\n1525359881703302780\\n7\\n1221\\n6986316617\\n27088\", \"341143514535\\n22\\n18269162309686324710123374771799119703741778791\\n113737592225256219\\n29\\n191\\n7695515663\\n139698\", \"341143514535\\n213\\n9847033797941223760026525496657618436475016601\\n282179687988515070\\n44\\n3700\\n735224264\\n94448\", \"341143514535\\n287\\n32046002108896980375797364913448132483569780115\\n164382963489396257\\n1\\n4331\\n926957805\\n2161\", \"341143514535\\n234\\n82010430586822946922000437502153184712784069\\n77996439312031059\\n2\\n2151\\n12549756109\\n126\", \"341143514535\\n314\\n143565553551655311343411652235654535651124615163\\n551544654451431564\\n4\\n3411\\n6363636363\\n153414\"], \"outputs\": [\"naruto\\nNA\\ndo you wanna go to aizu?\\nyes sure!\\nNA\\nna\\n?????\\nend\\n\", \"naruto\\nNA\\nNA\\nyes sure!\\nNA\\nna\\n?????\\nend\\n\", \"naruto\\nNA\\ndo you wanna go to aizu?\\nyes sure!\\nNA\\nNA\\n?????\\nend\\n\", \"naruto\\nNA\\ndo you wanna go to aizu?\\nyes sure!\\nNA\\nna\\n?????\\nNA\\n\", \"naruto\\nNA\\nNA\\nyes sure!\\nNA\\nNA\\n?????\\nend\\n\", \"naruto\\nNA\\nNA\\nyes sure!\\nNA\\nna\\n?????\\nNA\\n\", \"naruto\\nNA\\nNA\\nyes sure!\\nNA\\nNA\\n?????\\nNA\\n\", \"naruto\\nNA\\ndo you wanna go to aizu?\\nyes sure!\\nNA\\nNA\\nNA\\nend\\n\", \"naruto\\nNA\\nNA\\nNA\\nNA\\nNA\\n?????\\nNA\\n\", \"naruto\\nNA\\ndo you wanna go to aizu?\\nNA\\nNA\\nNA\\nNA\\nend\\n\", \"naruto\\nNA\\nNA\\nNA\\nc\\nNA\\n?????\\nNA\\n\", \"naruto\\nNA\\nNA\\nNA\\nNA\\nNA\\nNA\\nend\\n\", \"naruto\\nNA\\nNA\\nNA\\nNA\\nNA\\nNA\\nNA\\n\", \"naruto\\np\\nNA\\nNA\\nNA\\nNA\\nNA\\nNA\\n\", \"naruto\\nNA\\nNA\\nNA\\nNA\\nNA\\nhs ut\\nNA\\n\", \"naruto\\np\\nNA\\nNA\\nNA\\nsb\\nNA\\nNA\\n\", \"naruto\\n.\\nNA\\nNA\\nNA\\nsb\\nNA\\nNA\\n\", \"naruto\\nNA\\ndo you wanna go to aizu?\\nyes sure!\\nNA\\nna\\nNA\\nend\\n\", \"naruto\\nNA\\ndo you wanna go to aizu?\\nyes sure!\\nNA\\nna\\nNA\\nNA\\n\", \"naruto\\nb\\nNA\\nyes sure!\\nNA\\nna\\n?????\\nNA\\n\", \"naruto\\nNA\\ndo you wanna go to aizu?\\nyes sure!\\nNA\\nNA\\nNA\\nNA\\n\", \"naruto\\nNA\\nNA\\nyes sure!\\nNA\\nNA\\nNA\\nend\\n\", \"naruto\\nNA\\nNA\\nNA\\nc\\nNA\\nNA\\nNA\\n\", \"naruto\\nNA\\nNA\\nNA\\nNA\\nNA\\nNA\\nkxd\\n\", \"naruto\\nNA\\nNA\\nNA\\nNA\\ncb\\nNA\\nNA\\n\", \"naruto\\ne\\nNA\\nNA\\nNA\\nNA\\nNA\\nNA\\n\", \"naruto\\nNA\\nNA\\nNA\\ne\\nNA\\nNA\\nNA\\n\", \"naruto\\nNA\\nNA\\nNA\\nNA\\nce\\nhs ut\\nNA\\n\", \"naruto\\np\\nNA\\nNA\\nNA\\nNA\\nNA\\nt\\n\", \"naruto\\n.\\nNA\\nNA\\nNA\\nho\\nNA\\nNA\\n\", \"naruto\\nNA\\nNA\\nNA\\nNA\\nna\\n?????\\nend\\n\", \"naruto\\nNA\\nNA\\nyes sure!\\nNA\\nna\\nNA\\nNA\\n\", \"naruto\\nn\\nNA\\nyes sure!\\nNA\\nNA\\n?????\\nend\\n\", \"naruto\\nNA\\nNA\\nyes sure!\\nNA\\nog\\n?????\\nNA\\n\", \"naruto\\nNA\\ndo you wanna go to aizu?\\nNA\\nNA\\nNA\\nNA\\nNA\\n\", \"naruto\\nNA\\nNA\\nyes sure!\\nNA\\nNA\\nNA\\nNA\\n\", \"naruto\\np\\nNA\\nNA\\nNA\\nNA\\nNA\\n b\\n\", \"naruto\\nNA\\nNA\\nNA\\nNA\\nNA\\nhs ut\\no.\\n\", \"naruto\\nc\\nNA\\nNA\\nNA\\nho\\nNA\\nNA\\n\", \"naruto\\nNA\\nNA\\nNA\\nNA\\nna\\nNA\\nNA\\n\", \"naruto\\nn\\nNA\\nNA\\nNA\\nNA\\n?????\\nend\\n\", \"naruto\\nf\\nNA\\nyes sure!\\nNA\\nna\\n?????\\nNA\\n\", \"naruto\\nNA\\nNA\\nyes sure!\\nNA\\nr.\\nNA\\nend\\n\", \"naruto\\n.\\nNA\\nNA\\nNA\\nNA\\nNA\\nend\\n\", \"naruto\\nNA\\nNA\\nyes sure!\\nNA\\nbf\\n?????\\nNA\\n\", \"naruto\\nNA\\nNA\\nNA\\nb\\nNA\\nNA\\nNA\\n\", \"naruto\\nNA\\nNA\\nNA\\nb\\nNA\\nhs ut\\nNA\\n\", \"naruto\\np\\nNA\\nNA\\nNA\\nNA\\nNA\\nn\\n\", \"naruto\\nc\\nNA\\nNA\\nNA\\nNA\\nNA\\nNA\\n\", \"naruto\\nw\\nNA\\nNA\\nNA\\nNA\\n?????\\nend\\n\", \"naruto\\nNA\\nNA\\nyes sure!\\nNA\\nog\\nNA\\nNA\\n\", \"naruto\\nNA\\nNA\\nNA\\ng\\nNA\\nNA\\nNA\\n\", \"naruto\\nNA\\nNA\\nNA\\nNA\\nx\\n?????\\nNA\\n\", \"naruto\\nu\\nNA\\nNA\\nNA\\nNA\\nNA\\nNA\\n\", \"naruto\\nv\\nNA\\nNA\\nNA\\nNA\\nNA\\nNA\\n\", \"naruto\\nNA\\nNA\\nNA\\nNA\\nNA\\nNA\\nh\\n\", \"naruto\\nNA\\nNA\\nNA\\nNA\\nna\\nNA\\nfog\\n\", \"naruto\\nw\\nNA\\nNA\\nNA\\nNA\\nNA\\nend\\n\", \"naruto\\nNA\\nNA\\nNA\\nNA\\nt\\n?????\\nNA\\n\", \"naruto\\nNA\\nNA\\nNA\\nNA\\nNA\\nNA\\nhn\\n\", \"naruto\\nNA\\nNA\\nNA\\nj\\nNA\\nNA\\nNA\\n\", \"naruto\\nNA\\nNA\\nNA\\nNA\\nNA\\nNA\\n b\\n\", \"naruto\\n?\\nNA\\nNA\\nNA\\nNA\\nNA\\nNA\\n\", \"naruto\\nNA\\nNA\\nNA\\nNA\\nna\\n?????\\nNA\\n\", \"naruto\\nNA\\nNA\\nNA\\nd\\ncb\\nNA\\nNA\\n\", \"naruto\\nNA\\nNA\\nNA\\nNA\\nx\\n?????\\nwz\\n\", \"naruto\\nc\\nNA\\nNA\\ne\\nNA\\nNA\\nNA\\n\", \"naruto\\nNA\\nNA\\nNA\\nNA\\nNA\\nNA\\nfog\\n\", \"naruto\\n \\ndo you wanna go to aizu?\\nNA\\nNA\\nNA\\nNA\\nNA\\n\", \"naruto\\nf\\nNA\\nyes sure!\\nNA\\nNA\\n?????\\nNA\\n\", \"naruto\\nNA\\nNA\\nNA\\nNA\\nt\\nNA\\nNA\\n\", \"naruto\\na\\nNA\\nNA\\ne\\nNA\\nNA\\nNA\\n\", \"naruto\\nNA\\nNA\\nyes sure!\\ne\\nNA\\nNA\\nNA\\n\", \"naruto\\nf\\nNA\\nNA\\nNA\\nNA\\n?????\\nNA\\n\", \"naruto\\nq\\nNA\\nNA\\nNA\\nNA\\nNA\\nNA\\n\", \"naruto\\nNA\\nNA\\nNA\\nNA\\nbf\\n?????\\nNA\\n\", \"naruto\\nNA\\nNA\\nNA\\nm\\nNA\\nNA\\nNA\\n\", \"naruto\\nNA\\nNA\\nNA\\nNA\\nsh\\nNA\\nNA\\n\", \"naruto\\nNA\\nNA\\nNA\\nNA\\nrk\\nNA\\nNA\\n\", \"naruto\\nNA\\nNA\\nNA\\nNA\\nNA\\nNA\\nn\\n\", \"naruto\\nNA\\nNA\\nsbydusxg\\nj\\nNA\\nNA\\nNA\\n\", \"naruto\\n \\nNA\\nNA\\nNA\\nNA\\nNA\\nNA\\n\", \"naruto\\nNA\\nNA\\nNA\\nNA\\n?e\\nNA\\nNA\\n\", \"naruto\\na\\nNA\\nNA\\nf\\nNA\\nNA\\nNA\\n\", \"naruto\\nNA\\nNA\\nNA\\nNA\\nip\\nNA\\nNA\\n\", \"naruto\\nNA\\nNA\\nNA\\nc\\nNA\\nhs ut\\nNA\\n\", \"naruto\\n?\\nNA\\nNA\\nNA\\nNA\\nNA\\nb\\n\", \"naruto\\nNA\\nNA\\nNA\\nNA\\nNA\\nNA\\neg\\n\", \"naruto\\na\\nNA\\nNA\\nNA\\nNA\\nNA\\nNA\\n\", \"naruto\\nNA\\nNA\\nyes sure!\\nb\\nNA\\nNA\\nNA\\n\", \"naruto\\na\\nNA\\nNA\\nk\\nNA\\nNA\\nNA\\n\", \"naruto\\nNA\\nNA\\nNA\\nNA\\nNA\\nNA\\n!\\n\", \"naruto\\nNA\\nNA\\nNA\\nNA\\nNA\\nNA\\nb\\n\", \"naruto\\nNA\\nNA\\nNA\\nd\\nNA\\nNA\\nNA\\n\", \"naruto\\nNA\\nNA\\nsbydusxg\\nq\\nNA\\nNA\\nNA\\n\", \"naruto\\nNA\\nNA\\nNA\\nNA\\nbf\\nNA\\nNA\\n\", \"naruto\\ng\\nNA\\nNA\\nNA\\nNA\\nNA\\nNA\\n\", \"naruto\\nNA\\nNA\\nNA\\ns\\nNA\\nNA\\nNA\\n\", \"naruto\\nNA\\nNA\\nNA\\nNA\\nrk\\nNA\\nfz\\n\", \"naruto\\nNA\\nNA\\nNA\\nNA\\nfu\\nNA\\nNA\\n\", \"naruto\\nNA\\ndo you wanna go to aizu?\\nyes sure!\\nNA\\nna\\n?????\\nend\"]}", "source": "primeintellect"}
One day, Taro received a strange email with only the number "519345213244" in the text. The email was from my cousin, who was 10 years older than me, so when I called and asked, "Oh, I sent it with a pocket bell because I was in a hurry. It's convenient. Nice to meet you!" I got it. You know this cousin, who is always busy and a little bit aggressive, and when you have no choice but to research "pager hitting" yourself, you can see that it is a method of input that prevailed in the world about 10 years ago. I understand. In "Pokebell Strike", enter one character with two numbers, such as 11 for "A" and 15 for "O" according to the conversion table shown in Fig. 1. For example, to enter the string "Naruto", type "519345". Therefore, any letter can be entered with two numbers. <image> Figure 1 When mobile phones weren't widespread, high school students used this method to send messages from payphones to their friends' pagers. Some high school girls were able to pager at a tremendous speed. Recently, my cousin, who has been busy with work, has unknowingly started typing emails with a pager. Therefore, in order to help Taro who is having a hard time deciphering every time, please write a program that converts the pager message into a character string and outputs it. However, the conversion table shown in Fig. 2 is used for conversion, and only lowercase letters, ".", "?", "!", And blanks are targeted. Output NA for messages that contain characters that cannot be converted. <image> Figure 2 Input Multiple messages are given. One message (up to 200 characters) is given on each line. The total number of messages does not exceed 50. Output For each message, output the converted message or NA on one line. Example Input 341143514535 314 143565553551655311343411652235654535651124615163 551544654451431564 4 3411 6363636363 153414 Output naruto NA do you wanna go to aizu? yes sure! NA na ????? end Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [[6, 11, 2], [11, 345, 17], [0, 1, 7], [20, 20, 2], [20, 20, 8], [19, 20, 2], [0, 10, 1], [11, 14, 2], [101, 9999999999999999999999999999999999999999999, 11], [1005, 9999999999999999999999999999999999999999999, 109]], \"outputs\": [[3], [20], [1], [1], [0], [1], [11], [2], [909090909090909090909090909090909090909081], [91743119266055045871559633027522935779807]]}", "source": "primeintellect"}
Complete the function that takes 3 numbers `x, y and k` (where `x ≤ y`), and returns the number of integers within the range `[x..y]` (both ends included) that are divisible by `k`. More scientifically: `{ i : x ≤ i ≤ y, i mod k = 0 }` ## Example Given ```x = 6, y = 11, k = 2``` the function should return `3`, because there are three numbers divisible by `2` between `6` and `11`: `6, 8, 10` - **Note**: The test cases are very large. You will need a O(log n) solution or better to pass. (A constant time solution is possible.) Write your solution by modifying this code: ```python def divisible_count(x,y,k): ``` Your solution should implemented in the function "divisible_count". The i Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [\"4\\n2\\n1 2\\n3\\n5 5 5\\n4\\n1 3 3 7\\n6\\n3 4 2 1 3 3\\n\", \"1\\n74\\n9 3 10 8 6 6 1 6 9 3 7 3 2 8 1 5 8 4 6 4 1 6 5 6 10 3 6 6 6 4 9 5 8 7 2 1 6 2 4 9 10 9 5 4 7 5 7 2 10 10 1 5 2 4 1 7 7 3 8 10 2 5 8 4 3 9 2 9 9 8 6 8 4 1\\n\", \"1\\n3\\n11 11 154\\n\", \"1\\n3\\n11 11 154\\n\", \"1\\n74\\n9 3 10 8 6 6 1 6 9 3 7 3 2 8 1 5 8 4 6 4 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9 3 7 3 2 8 1 5 8 4 6 4 1 6 8 6 10 3 6 6 6 4 11 5 8 7 2 1 6 2 4 9 10 9 5 4 7 5 7 2 10 10 1 5 2 4 1 7 7 1 8 10 2 5 4 4 3 9 2 9 9 8 6 8 4 1\\n\", \"1\\n74\\n9 3 10 8 6 6 1 6 9 3 7 3 2 8 1 5 8 4 10 4 1 6 5 6 10 0 6 6 6 4 11 5 7 7 2 1 6 2 4 9 10 9 0 4 7 5 7 2 10 10 1 5 2 4 1 7 7 3 8 10 2 5 8 4 3 9 2 9 9 8 6 8 4 1\\n\", \"1\\n74\\n9 3 10 8 6 6 0 6 9 3 7 3 2 8 1 5 8 4 7 4 1 6 5 7 10 3 6 6 6 4 11 5 8 7 0 1 6 2 4 9 10 9 5 4 7 5 7 2 10 10 1 5 2 4 1 7 7 3 8 10 2 5 8 4 3 9 2 9 9 8 6 8 4 1\\n\", \"1\\n74\\n9 4 10 8 0 6 1 6 9 3 7 3 2 8 1 5 8 4 7 4 1 6 5 6 10 3 6 6 6 4 11 5 8 7 2 1 6 4 4 9 10 9 1 4 7 5 7 2 10 10 1 5 2 4 1 7 7 3 8 10 2 5 8 4 3 9 2 9 9 8 6 8 4 1\\n\", \"1\\n74\\n9 3 10 8 0 6 1 6 9 1 7 3 2 8 1 5 8 4 7 4 1 6 5 6 10 2 6 6 6 4 11 5 8 7 2 1 6 2 7 9 10 9 5 4 7 5 7 2 10 10 1 5 2 4 1 7 7 3 8 10 2 5 8 4 3 9 2 15 9 8 6 8 4 1\\n\", \"4\\n2\\n1 2\\n3\\n5 5 5\\n4\\n1 3 3 7\\n6\\n3 4 2 1 3 3\\n\"], \"outputs\": [\"1\\n6\\n0\\n540\\n\", \"420779088\\n\", \"0\\n\", \"0\\n\", \"420779088\\n\", \"0\\n\", \"645880462\\n\", \"1\\n6\\n0\\n540\\n\", \"368181702\\n\", \"420779088\\n\", \"0\\n6\\n0\\n540\\n\", \"350649240\\n\", \"210389544\\n\", \"0\\n6\\n0\\n720\\n\", \"645880462\\n\", \"645880462\\n\", \"645880462\\n\", \"645880462\\n\", \"645880462\\n\", \"645880462\\n\", \"645880462\\n\", \"645880462\\n\", \"420779088\\n\", \"420779088\\n\", \"420779088\\n\", \"420779088\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"645880462\\n\", \"368181702\\n\", \"645880462\\n\", \"645880462\\n\", \"645880462\\n\", \"645880462\\n\", \"645880462\\n\", \"645880462\\n\", \"645880462\\n\", \"420779088\\n\", \"420779088\\n\", \"420779088\\n\", \"420779088\\n\", \"420779088\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"645880462\\n\", \"368181702\\n\", \"645880462\\n\", \"645880462\\n\", \"645880462\\n\", \"645880462\\n\", \"645880462\\n\", \"350649240\\n\", \"350649240\\n\", \"0\\n\", \"420779088\\n\", \"420779088\\n\", \"420779088\\n\", \"420779088\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"210389544\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"420779088\\n\", \"0\\n\", \"645880462\\n\", \"368181702\\n\", \"645880462\\n\", \"645880462\\n\", \"0\\n\", \"1\\n6\\n0\\n540\\n\"]}", "source": "primeintellect"}
$n$ people gathered to hold a jury meeting of the upcoming competition, the $i$-th member of the jury came up with $a_i$ tasks, which they want to share with each other. First, the jury decides on the order which they will follow while describing the tasks. Let that be a permutation $p$ of numbers from $1$ to $n$ (an array of size $n$ where each integer from $1$ to $n$ occurs exactly once). Then the discussion goes as follows: If a jury member $p_1$ has some tasks left to tell, then they tell one task to others. Otherwise, they are skipped. If a jury member $p_2$ has some tasks left to tell, then they tell one task to others. Otherwise, they are skipped. ... If a jury member $p_n$ has some tasks left to tell, then they tell one task to others. Otherwise, they are skipped. If there are still members with tasks left, then the process repeats from the start. Otherwise, the discussion ends. A permutation $p$ is nice if none of the jury members tell two or more of their own tasks in a row. Count the number of nice permutations. The answer may be really large, so print it modulo $998\,244\,353$. -----Input----- The first line contains a single integer $t$ ($1 \le t \le 10^4$) — the number of test cases. The first line of the test case contains a single integer $n$ ($2 \le n \le 2 \cdot 10^5$) — number of jury members. The second line contains $n$ integers $a_1, a_2, \dots, a_n$ ($1 \le a_i \le 10^9$) — the number of problems that the $i$-th member of the jury came up with. The sum of $n$ over all test cases does not exceed $2 \cdot 10^5$. -----Output----- For each test case, print one integer — the number of nice permutations, taken modulo $998\,244\,353$. -----Examples----- Input 4 2 1 2 3 5 5 5 4 1 3 3 7 6 3 4 2 1 3 3 Output 1 6 0 540 -----Note----- Explanation of the first test case from the example: There are two possible permutations, $p = [1, 2]$ and $p = [2, 1]$. For $p = [1, 2]$, the process is the following: the first jury member tells a task; the second jury member tells a task; the first jury member doesn't have any tasks left to tell, so they are skipped; the second jury member tells a task. So, the second jury member has told two tasks in a row (in succession), so the permutation is not nice. For $p = [2, 1]$, the process is the following: the second jury member tells a task; the first jury member tells a task; the second jury member tells a task. So, this permutation is nice. Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [\"500 3\\n2002 1 1\\n2003 500 500\\n2004 500 500\\n\", \"2 3\\n1 1 1\\n100 2 2\\n10000 1 1\\n\", \"500 2\\n950 500 500\\n3000 1 1\\n\", \"500 1\\n26969 164 134\\n\", \"4 3\\n851 4 3\\n1573 1 4\\n2318 3 4\\n\", \"500 2\\n2000 1 1\\n4000 1 1\\n\", \"10 3\\n26 10 9\\n123 2 2\\n404 5 6\\n\", \"727 2\\n950 500 500\\n3000 1 1\\n\", \"4 3\\n851 4 4\\n1573 1 4\\n2318 3 4\\n\", \"500 2\\n3196 1 1\\n4000 1 1\\n\", \"6 9\\n0 2 6\\n7 5 1\\n8 5 5\\n10 3 1\\n12 4 4\\n13 6 2\\n17 6 6\\n20 1 4\\n21 5 4\\n\", \"1140 1\\n950 601 500\\n3000 1 0\\n\", \"500 1\\n26969 258 134\\n\", \"10 3\\n26 10 9\\n123 2 2\\n622 5 6\\n\", \"500 10\\n69 477 122\\n73 186 235\\n341 101 145\\n372 77 497\\n404 117 440\\n494 471 37\\n522 300 498\\n682 149 379\\n821 486 359\\n855 157 386\\n\", \"727 2\\n950 500 500\\n3000 1 0\\n\", \"500 1\\n2886 258 134\\n\", \"4 3\\n851 4 4\\n1573 1 4\\n2318 0 4\\n\", \"500 10\\n69 477 111\\n73 186 235\\n341 101 145\\n372 77 497\\n404 117 440\\n494 471 37\\n522 300 498\\n682 149 379\\n821 486 359\\n855 157 386\\n\", \"6 9\\n0 2 6\\n7 5 1\\n8 5 5\\n10 3 1\\n12 4 4\\n13 6 2\\n17 6 8\\n20 1 4\\n21 5 4\\n\", \"727 2\\n950 601 500\\n3000 1 0\\n\", \"450 1\\n2886 258 134\\n\", \"500 10\\n69 477 111\\n73 186 235\\n341 101 145\\n372 77 497\\n404 5 440\\n494 471 37\\n522 300 498\\n682 149 379\\n821 486 359\\n855 157 386\\n\", \"6 9\\n0 2 6\\n7 5 1\\n8 5 5\\n10 3 1\\n12 4 4\\n13 6 2\\n17 6 8\\n13 1 4\\n21 5 4\\n\", \"727 2\\n950 601 500\\n3000 2 0\\n\", \"500 10\\n69 477 111\\n73 186 235\\n341 101 145\\n372 77 497\\n404 5 440\\n494 471 37\\n522 300 498\\n682 149 379\\n821 486 359\\n855 122 386\\n\", \"500 10\\n69 477 111\\n73 186 235\\n341 101 145\\n372 77 497\\n404 1 440\\n494 471 37\\n522 300 498\\n682 149 379\\n821 486 359\\n855 122 386\\n\", \"500 3\\n2002 1 1\\n2003 500 597\\n2004 500 500\\n\", \"2 3\\n1 1 1\\n100 2 2\\n10010 1 1\\n\", \"500 2\\n950 500 500\\n3000 0 1\\n\", \"500 1\\n42495 164 134\\n\", \"4 3\\n851 4 2\\n1573 1 4\\n2318 3 4\\n\", \"500 2\\n2000 1 0\\n4000 1 1\\n\", \"10 2\\n26 10 9\\n123 2 2\\n404 5 6\\n\", \"500 10\\n69 477 122\\n73 186 397\\n341 101 145\\n372 77 497\\n390 117 440\\n494 471 37\\n522 300 498\\n682 149 379\\n821 486 359\\n855 157 386\\n\", \"6 9\\n1 2 6\\n7 5 2\\n8 5 5\\n10 3 1\\n12 4 4\\n13 6 2\\n17 6 6\\n20 1 4\\n21 5 4\\n\", \"10 1\\n14 6 8\\n\", \"4 3\\n926 4 4\\n1573 1 4\\n2318 3 4\\n\", \"500 2\\n3196 1 1\\n7045 1 1\\n\", \"10 3\\n26 10 9\\n123 2 3\\n622 5 6\\n\", \"500 10\\n69 477 122\\n73 186 235\\n341 101 145\\n372 77 497\\n404 117 440\\n494 471 37\\n522 251 498\\n682 149 379\\n821 486 359\\n855 157 386\\n\", \"500 1\\n2886 258 80\\n\", \"4 3\\n851 4 4\\n1573 2 4\\n2318 0 4\\n\", \"500 10\\n69 477 111\\n73 186 235\\n341 101 145\\n372 77 497\\n404 62 440\\n494 471 37\\n522 300 498\\n682 149 379\\n821 486 359\\n855 157 386\\n\", \"6 9\\n0 2 6\\n7 5 1\\n4 5 5\\n10 3 1\\n12 4 4\\n13 6 2\\n17 6 8\\n20 1 4\\n21 5 4\\n\", \"1140 2\\n950 601 500\\n3000 1 0\\n\", \"500 10\\n69 477 111\\n73 186 235\\n341 101 145\\n372 77 497\\n447 5 440\\n494 471 37\\n522 300 498\\n682 149 379\\n821 486 359\\n855 157 386\\n\", \"6 9\\n1 2 6\\n7 5 1\\n8 5 5\\n10 3 1\\n12 4 4\\n13 6 2\\n17 6 8\\n13 1 4\\n21 5 4\\n\", \"727 2\\n950 601 500\\n3000 0 0\\n\", \"500 10\\n69 477 111\\n73 186 235\\n341 101 145\\n372 77 522\\n404 5 440\\n494 471 37\\n522 300 498\\n682 149 379\\n821 486 359\\n855 122 386\\n\", \"500 10\\n69 477 111\\n73 186 235\\n341 101 145\\n372 77 497\\n404 1 440\\n494 637 37\\n522 300 498\\n682 149 379\\n821 486 359\\n855 122 386\\n\", \"500 3\\n2002 1 1\\n2003 500 597\\n2004 680 500\\n\", \"4 3\\n1 1 1\\n100 2 2\\n10010 1 1\\n\", \"500 2\\n23 500 500\\n3000 0 1\\n\", \"500 1\\n70274 164 134\\n\", \"4 3\\n851 4 2\\n1573 1 4\\n2318 4 4\\n\", \"10 1\\n26 10 9\\n123 2 2\\n404 5 6\\n\", \"500 10\\n69 477 122\\n73 186 397\\n341 101 145\\n372 77 497\\n390 117 440\\n494 471 37\\n522 300 498\\n682 152 379\\n821 486 359\\n855 157 386\\n\", \"6 9\\n1 2 6\\n7 5 2\\n8 5 5\\n10 3 1\\n12 4 4\\n13 6 2\\n17 3 6\\n20 1 4\\n21 5 4\\n\", \"4 3\\n926 4 4\\n1573 1 4\\n2318 3 3\\n\", \"500 2\\n4952 1 1\\n7045 1 1\\n\", \"4 3\\n851 4 4\\n1354 2 4\\n2318 0 4\\n\", \"500 10\\n69 477 111\\n73 186 237\\n341 101 145\\n372 77 497\\n447 5 440\\n494 471 37\\n522 300 498\\n682 149 379\\n821 486 359\\n855 157 386\\n\", \"6 9\\n1 2 6\\n7 5 1\\n8 5 5\\n10 3 0\\n12 4 4\\n13 6 2\\n17 6 8\\n13 1 4\\n21 5 4\\n\", \"500 10\\n69 477 111\\n73 186 235\\n341 101 145\\n372 77 522\\n404 5 440\\n494 471 37\\n522 300 498\\n682 152 379\\n821 486 359\\n855 122 386\\n\", \"500 10\\n69 477 111\\n73 186 235\\n341 101 145\\n372 77 497\\n404 1 440\\n494 637 37\\n522 300 498\\n682 149 379\\n821 486 359\\n855 122 217\\n\", \"500 3\\n2002 1 1\\n2003 500 597\\n2004 222 500\\n\", \"4 3\\n1 1 1\\n000 2 2\\n10010 1 1\\n\", \"500 2\\n23 500 381\\n3000 0 1\\n\", \"500 1\\n70274 164 95\\n\", \"10 1\\n26 10 9\\n123 2 2\\n404 7 6\\n\", \"500 10\\n69 477 122\\n73 186 397\\n341 100 145\\n372 77 497\\n390 117 440\\n494 471 37\\n522 300 498\\n682 152 379\\n821 486 359\\n855 157 386\\n\", \"6 9\\n1 2 6\\n7 8 2\\n8 5 5\\n10 3 1\\n12 4 4\\n13 6 2\\n17 3 6\\n20 1 4\\n21 5 4\\n\", \"4 3\\n851 4 4\\n1354 0 4\\n2318 0 4\\n\", \"1140 2\\n950 601 500\\n3563 1 0\\n\", \"500 10\\n69 477 111\\n73 186 237\\n341 101 145\\n372 77 497\\n447 5 440\\n494 471 37\\n522 300 498\\n682 149 379\\n821 486 359\\n855 109 386\\n\", \"6 9\\n1 2 6\\n7 5 1\\n8 5 5\\n10 3 0\\n12 4 4\\n13 6 2\\n17 6 8\\n13 1 4\\n21 8 4\\n\", \"500 10\\n69 477 111\\n73 186 235\\n341 101 145\\n372 77 522\\n404 5 440\\n494 471 37\\n522 300 498\\n682 152 354\\n821 486 359\\n855 122 386\\n\", \"500 10\\n69 477 111\\n73 186 235\\n341 101 145\\n372 77 497\\n404 1 440\\n494 637 37\\n522 300 526\\n682 149 379\\n821 486 359\\n855 122 217\\n\", \"500 2\\n7 500 381\\n3000 0 1\\n\", \"419 1\\n70274 164 95\\n\", \"10 1\\n26 10 9\\n123 2 4\\n404 7 6\\n\", \"500 10\\n69 477 122\\n73 186 235\\n341 101 145\\n372 77 497\\n390 117 440\\n494 471 37\\n522 300 498\\n682 149 379\\n821 486 359\\n855 157 386\\n\", \"10 4\\n1 2 1\\n5 10 9\\n13 8 8\\n15 9 9\\n\", \"6 9\\n1 2 6\\n7 5 1\\n8 5 5\\n10 3 1\\n12 4 4\\n13 6 2\\n17 6 6\\n20 1 4\\n21 5 4\\n\", \"10 1\\n11 6 8\\n\"], \"outputs\": [\"2\\n\", \"3\\n\", \"1\\n\", \"1\\n\", \"3\\n\", \"2\\n\", \"3\\n\", \"1\\n\", \"3\\n\", \"2\\n\", \"4\\n\", \"0\\n\", \"1\\n\", \"3\\n\", \"3\\n\", \"1\\n\", \"1\\n\", \"3\\n\", \"3\\n\", \"3\\n\", \"1\\n\", \"1\\n\", \"3\\n\", \"3\\n\", \"1\\n\", \"3\\n\", \"3\\n\", \"1\\n\", \"3\\n\", \"1\\n\", \"1\\n\", \"3\\n\", \"2\\n\", \"2\\n\", \"3\\n\", \"4\\n\", \"1\\n\", \"3\\n\", \"2\\n\", \"3\\n\", \"3\\n\", \"1\\n\", \"3\\n\", \"3\\n\", \"3\\n\", \"1\\n\", \"3\\n\", \"3\\n\", \"1\\n\", \"3\\n\", \"3\\n\", \"1\\n\", \"3\\n\", \"1\\n\", \"1\\n\", \"3\\n\", \"1\\n\", \"3\\n\", \"4\\n\", \"3\\n\", \"2\\n\", \"3\\n\", \"3\\n\", \"3\\n\", \"3\\n\", \"2\\n\", \"1\\n\", \"2\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"3\\n\", \"4\\n\", \"3\\n\", \"1\\n\", \"3\\n\", \"3\\n\", \"3\\n\", \"2\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"3\\n\", \"1\\n\", \"4\\n\", \"0\\n\"]}", "source": "primeintellect"}
You are a paparazzi working in Manhattan. Manhattan has r south-to-north streets, denoted by numbers 1, 2,…, r in order from west to east, and r west-to-east streets, denoted by numbers 1,2,…,r in order from south to north. Each of the r south-to-north streets intersects each of the r west-to-east streets; the intersection between the x-th south-to-north street and the y-th west-to-east street is denoted by (x, y). In order to move from the intersection (x,y) to the intersection (x', y') you need |x-x'|+|y-y'| minutes. You know about the presence of n celebrities in the city and you want to take photos of as many of them as possible. More precisely, for each i=1,..., n, you know that the i-th celebrity will be at the intersection (x_i, y_i) in exactly t_i minutes from now (and he will stay there for a very short time, so you may take a photo of him only if at the t_i-th minute from now you are at the intersection (x_i, y_i)). You are very good at your job, so you are able to take photos instantaneously. You know that t_i < t_{i+1} for any i=1,2,…, n-1. Currently you are at your office, which is located at the intersection (1, 1). If you plan your working day optimally, what is the maximum number of celebrities you can take a photo of? Input The first line of the input contains two positive integers r, n (1≤ r≤ 500, 1≤ n≤ 100,000) – the number of south-to-north/west-to-east streets and the number of celebrities. Then n lines follow, each describing the appearance of a celebrity. The i-th of these lines contains 3 positive integers t_i, x_i, y_i (1≤ t_i≤ 1,000,000, 1≤ x_i, y_i≤ r) — denoting that the i-th celebrity will appear at the intersection (x_i, y_i) in t_i minutes from now. It is guaranteed that t_i<t_{i+1} for any i=1,2,…, n-1. Output Print a single integer, the maximum number of celebrities you can take a photo of. Examples Input 10 1 11 6 8 Output 0 Input 6 9 1 2 6 7 5 1 8 5 5 10 3 1 12 4 4 13 6 2 17 6 6 20 1 4 21 5 4 Output 4 Input 10 4 1 2 1 5 10 9 13 8 8 15 9 9 Output 1 Input 500 10 69 477 122 73 186 235 341 101 145 372 77 497 390 117 440 494 471 37 522 300 498 682 149 379 821 486 359 855 157 386 Output 3 Note Explanation of the first testcase: There is only one celebrity in the city, and he will be at intersection (6,8) exactly 11 minutes after the beginning of the working day. Since you are initially at (1,1) and you need |1-6|+|1-8|=5+7=12 minutes to reach (6,8) you cannot take a photo of the celebrity. Thus you cannot get any photo and the answer is 0. Explanation of the second testcase: One way to take 4 photos (which is the maximum possible) is to take photos of celebrities with indexes 3, 5, 7, 9 (see the image for a visualization of the strategy): * To move from the office at (1,1) to the intersection (5,5) you need |1-5|+|1-5|=4+4=8 minutes, so you arrive at minute 8 and you are just in time to take a photo of celebrity 3. * Then, just after you have taken a photo of celebrity 3, you move toward the intersection (4,4). You need |5-4|+|5-4|=1+1=2 minutes to go there, so you arrive at minute 8+2=10 and you wait until minute 12, when celebrity 5 appears. * Then, just after you have taken a photo of celebrity 5, you go to the intersection (6,6). You need |4-6|+|4-6|=2+2=4 minutes to go there, so you arrive at minute 12+4=16 and you wait until minute 17, when celebrity 7 appears. * Then, just after you have taken a photo of celebrity 7, you go to the intersection (5,4). You need |6-5|+|6-4|=1+2=3 minutes to go there, so you arrive at minute 17+3=20 and you wait until minute 21 to take a photo of celebrity 9. <image> Explanation of the third testcase: The only way to take 1 photo (which is the maximum possible) is to take a photo of the celebrity with index 1 (since |2-1|+|1-1|=1, you can be at intersection (2,1) after exactly one minute, hence you are just in time to take a photo of celebrity 1). Explanation of the fourth testcase: One way to take 3 photos (which is the maximum possible) is to take photos of celebrities with indexes 3, 8, 10: * To move from the office at (1,1) to the intersection (101,145) you need |1-101|+|1-145|=100+144=244 minutes, so you can manage to be there when the celebrity 3 appears (at minute 341). * Then, just after you have taken a photo of celebrity 3, you move toward the intersection (149,379). You need |101-149|+|145-379|=282 minutes to go there, so you arrive at minute 341+282=623 and you wait until minute 682, when celebrity 8 appears. * Then, just after you have taken a photo of celebrity 8, you go to the intersection (157,386). You need |149-157|+|379-386|=8+7=15 minutes to go there, so you arrive at minute 682+15=697 and you wait until minute 855 to take a photo of celebrity 10. Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0.75
{"tests": "{\"inputs\": [[5], [3], [9], [10], [20]], \"outputs\": [[[1, 2, 3, 4, 5]], [[1, 2, 3]], [[1, 2, 3, 4, 5, 6, 7, 8, 9]], [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]], [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]]]}", "source": "primeintellect"}
You take your son to the forest to see the monkeys. You know that there are a certain number there (n), but your son is too young to just appreciate the full number, he has to start counting them from 1. As a good parent, you will sit and count with him. Given the number (n), populate an array with all numbers up to and including that number, but excluding zero. For example: ```python monkeyCount(10) # --> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] monkeyCount(1) # --> [1] ``` Write your solution by modifying this code: ```python def monkey_count(n): ``` Your solution should implemented in the function "monkey_count". The i Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [\"6\\nAIZU 10\\nLINER 6\\nLINE 4\\nALL 2\\nAS 1\\nCIEL 10\\nASLA\\nCILI\\nIRZN\\nUELE\\n21\", \"6\\nAIZU 10\\nLINER 6\\nLHNE 4\\nALL 2\\nAS 1\\nCIEL 10\\nASLA\\nCILI\\nIRZN\\nUELE\\n21\", \"6\\nAIZU 10\\nLINER 6\\nLHNE 3\\nALL 2\\nAS 1\\nCIEL 10\\nBSLA\\nCILI\\nIRZN\\nUELE\\n21\", \"6\\nUZI@ 4\\nLINER 12\\nLGNE 9\\nALL 2\\nAS 1\\nCIEL 10\\nBSLA\\nILIC\\nIRZN\\nUELE\\n21\", \"6\\nUZI@ 4\\nLINER 12\\nLGNE 1\\nBLL 2\\nAS 1\\nCIEL 10\\nALSB\\nILIC\\nIRZN\\nUELE\\n21\", \"6\\nAIZU 10\\nLINER 6\\nLINE 4\\nALL 2\\nAS 1\\nCIEL 10\\nALSA\\nCILI\\nIRZN\\nELEU\\n21\", \"6\\nAIZU 10\\nLINER 6\\nLINE 4\\nALL 2\\nAS 1\\nCIEL 10\\nASLA\\nCILI\\nNZRI\\nUELE\\n21\", \"6\\nAIZU 10\\nLINER 6\\nLHNE 3\\nALL 2\\nAS 1\\nCIEL 15\\nASLA\\nCILI\\nIRZN\\nUELE\\n21\", \"6\\nAIZU 10\\nLINER 6\\nLHNE 3\\nALL 3\\nAS 1\\nCIEL 10\\nBSLA\\nCILI\\nIRZN\\nUELE\\n21\", \"6\\nAIZU 10\\nLINER 6\\nLGNE 3\\nLLA 2\\nAS 1\\nCIEL 10\\nBSMA\\nCILI\\nIRZN\\nUELE\\n21\", \"6\\nUZIA 4\\nLINER 12\\nLGNE 5\\nALL 2\\nAS 1\\nCIEL 10\\nBSLA\\nCILI\\nIRZN\\nUDLE\\n21\", \"6\\nU@IZ 4\\nLINFR 14\\nKGNE 0\\nLBL 0\\nAS 1\\nLEHC 16\\nBSAK\\nILIC\\nIRZO\\nUELE\\n21\", \"6\\nAIZU 10\\nLINER 6\\nLINE 4\\nALL 2\\nAS 1\\nCIEL 10\\nALSA\\nICLI\\nIRZN\\nELEU\\n21\", \"6\\nAIZU 10\\nLINER 6\\nLHNE 3\\nALL 3\\nAS 1\\nCIEL 10\\nBSLA\\nCILI\\nNZRI\\nUELE\\n21\", \"6\\nUZI@ 4\\nLINER 24\\nKGNE 1\\nBLL 2\\nAS 1\\nCHEL 10\\nALSB\\nCILI\\nHRZN\\nUELE\\n21\", \"6\\nUZI@ 4\\nLINER 3\\nKGNE 1\\nBLL 2\\nAS 1\\nCHEL 10\\nBSKA\\nILIC\\nNRZI\\nUELE\\n21\", \"6\\nAIZU 10\\nLINER 6\\nLINE 4\\nALL 2\\nAS 1\\nCIEL 10\\nALSA\\nICLI\\nNRZI\\nELEU\\n21\", \"6\\nAHZU 10\\nLINER 6\\nLINE 4\\nALL 2\\nSA 1\\nCIEL 10\\nASLA\\nCILI\\nNZRI\\nUELE\\n21\", \"6\\nAIZU 12\\nLINER 6\\nLINE 4\\nALL 2\\nAS 1\\nCIEL 10\\nALSA\\nICLI\\nNRZI\\nELEU\\n21\", \"6\\nUZIA 2\\nLINER 12\\nLGNE 9\\nALL 2\\nSA 1\\nCIEL 9\\nBSLA\\nCJLI\\nIRZN\\nUELE\\n21\", \"6\\nUZI@ 4\\nLINER 12\\nLGOE 9\\nALL 2\\nAS 0\\nCIEL 5\\nBSLA\\nCILI\\nINZR\\nUELE\\n21\", \"6\\nAIZU 10\\nLINER 6\\nLHNE 3\\nALL 2\\nAS 1\\nCIEL 10\\nASLA\\nCILI\\nIRZN\\nUELE\\n21\", \"6\\nAIZU 10\\nLINER 6\\nLHNE 3\\nLLA 2\\nAS 1\\nCIEL 10\\nBSLA\\nCILI\\nIRZN\\nUELE\\n21\", \"6\\nAIZU 10\\nLINER 6\\nLGNE 3\\nLLA 2\\nAS 1\\nCIEL 10\\nBSLA\\nCILI\\nIRZN\\nUELE\\n21\", \"6\\nAIZU 4\\nLINER 6\\nLGNE 3\\nLLA 2\\nAS 1\\nCIEL 10\\nBSLA\\nCILI\\nIRZN\\nUELE\\n21\", \"6\\nAIZU 4\\nLINER 6\\nLGNE 5\\nLLA 2\\nAS 1\\nCIEL 10\\nBSLA\\nCILI\\nIRZN\\nUELE\\n21\", \"6\\nAIZU 4\\nLINER 6\\nLGNE 5\\nALL 2\\nAS 1\\nCIEL 10\\nBSLA\\nCILI\\nIRZN\\nUELE\\n21\", \"6\\nUZIA 4\\nLINER 6\\nLGNE 5\\nALL 2\\nAS 1\\nCIEL 10\\nBSLA\\nCILI\\nIRZN\\nUELE\\n21\", \"6\\nUZIA 4\\nLINER 12\\nLGNE 5\\nALL 2\\nAS 1\\nCIEL 10\\nBSLA\\nCILI\\nIRZN\\nUELE\\n21\", \"6\\nUZIA 4\\nLINER 12\\nLGNE 9\\nALL 2\\nAS 1\\nCIEL 10\\nBSLA\\nCILI\\nIRZN\\nUELE\\n21\", \"6\\nUZI@ 4\\nLINER 12\\nLGNE 9\\nALL 2\\nAS 1\\nCIEL 10\\nBSLA\\nCILI\\nIRZN\\nUELE\\n21\", \"6\\nUZI@ 4\\nLINER 12\\nLGNE 1\\nALL 2\\nAS 1\\nCIEL 10\\nBSLA\\nILIC\\nIRZN\\nUELE\\n21\", \"6\\nUZI@ 4\\nLINER 12\\nLGNE 1\\nBLL 2\\nAS 1\\nCIEL 10\\nBSLA\\nILIC\\nIRZN\\nUELE\\n21\", \"6\\nUZI@ 4\\nLINER 12\\nLGNE 1\\nBLL 2\\nAS 1\\nCHEL 10\\nALSB\\nILIC\\nIRZN\\nUELE\\n21\", \"6\\nUZI@ 4\\nLINER 12\\nKGNE 1\\nBLL 2\\nAS 1\\nCHEL 10\\nALSB\\nILIC\\nIRZN\\nUELE\\n21\", \"6\\nUZI@ 4\\nLINER 24\\nKGNE 1\\nBLL 2\\nAS 1\\nCHEL 10\\nALSB\\nILIC\\nIRZN\\nUELE\\n21\", \"6\\nUZI@ 4\\nLINER 24\\nKGNE 1\\nBLL 2\\nAS 1\\nCHEL 10\\nAKSB\\nILIC\\nIRZN\\nUELE\\n21\", \"6\\nUZI@ 4\\nLINER 14\\nKGNE 1\\nBLL 2\\nAS 1\\nCHEL 10\\nAKSB\\nILIC\\nIRZN\\nUELE\\n21\", \"6\\nUZI@ 4\\nLINER 14\\nKGN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\\n@S 2\\nKFHD 15\\nBSKA\\nILIC\\nPZRH\\nEDLU\\n1\", \"6\\n[I?U 1\\nRFNIL 14\\nKNGE -1\\nLCL -1\\n@S 2\\nKFHD 15\\nBSKA\\nILIC\\nPZRH\\nEDLU\\n1\", \"6\\n[I?U 1\\nRFNIL 14\\nKOGE -1\\nLCL -1\\n@S 2\\nKFHD 15\\nBSKA\\nILIC\\nPZRH\\nEDLU\\n1\", \"6\\nAIZU 10\\nLINER 6\\nLINE 4\\nALL 2\\nAS 1\\nCIEL 10\\nASLA\\nCILI\\nIRZN\\nELEU\\n21\"], \"outputs\": [\"23\\n\", \"15\\n\", \"14\\n\", \"2\\n\", \"0\\n\", \"40\\n\", \"28\\n\", \"20\\n\", \"16\\n\", \"10\\n\", \"4\\n\", \"1\\n\", \"32\\n\", \"18\\n\", \"12\\n\", \"3\\n\", \"25\\n\", \"22\\n\", \"27\\n\", \"13\\n\", \"9\\n\", \"15\\n\", \"14\\n\", \"14\\n\", \"14\\n\", \"14\\n\", \"14\\n\", \"14\\n\", \"14\\n\", \"14\\n\", \"14\\n\", \"2\\n\", \"2\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"40\"]}", "source": "primeintellect"}
Problem Statement Mr. Takatsuki, who is planning to participate in the Aizu training camp, is enthusiastic about studying and has been studying English recently. She tries to learn as many English words as possible by playing the following games on her mobile phone. The mobile phone she has is a touch panel type that operates the screen with her fingers. On the screen of the mobile phone, 4 * 4 squares are drawn, and each square has an uppercase alphabet. In this game, you will find many English words hidden in the squares within the time limit of T seconds, and compete for points according to the types of English words you can find. The procedure for finding one word is as follows. First, determine the starting cell corresponding to the first letter of the word and place your finger there. Then, trace with your finger from the square where you are currently placing your finger toward any of the eight adjacent squares, up, down, left, right, or diagonally. However, squares that have already been traced from the starting square to the current square cannot pass. When you reach the end of the word, release your finger there. At that moment, the score of one word traced with the finger from the start square to the end square is added. It takes x seconds to trace one x-letter word. You can ignore the time it takes to move your finger to trace one word and then the next. In the input, a dictionary of words to be added points is also input. Each word in this dictionary is given a score. If you trace a word written in the dictionary with your finger, the score corresponding to that word will be added. However, words that trace the exact same finger from the start square to the end square will be scored only once at the beginning. No points will be added if you trace a word that is not written in the dictionary with your finger. Given the dictionary and the board of the game, output the maximum number of points you can get within the time limit. Constraints * 1 <= N <= 100 * 1 <= wordi string length <= 8 * 1 <= scorei <= 100 * 1 <= T <= 10000 Input Each data set is input in the following format. N word1 score1 word2 score2 ... wordN scoreN line1 line2 line3 line4 T N is an integer representing the number of words contained in the dictionary. The dictionary is then entered over N lines. wordi is a character string composed of uppercase letters representing one word, and scorei is an integer representing the score obtained when the word of wordi is traced with a finger. The same word never appears more than once in the dictionary. Then, the characters of each square are input over 4 lines. linei is a string consisting of only four uppercase letters. The jth character from the left of linei corresponds to the jth character from the left on the i-th line. At the very end, the integer T representing the time limit is entered. Output Output the highest score that can be obtained within the time limit in one line. Example Input 6 AIZU 10 LINER 6 LINE 4 ALL 2 AS 1 CIEL 10 ASLA CILI IRZN ELEU 21 Output 40 Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0.25
{"tests": "{\"inputs\": [[1], [2], [5], [0], [-25]], \"outputs\": [[\"1\"], [\"1\\n22\"], [\"1\\n22\\n333\\n4444\\n55555\"], [\"\"], [\"\"]]}", "source": "primeintellect"}
## Task: You have to write a function `pattern` which returns the following Pattern(See Pattern & Examples) upto `n` number of rows. * Note:`Returning` the pattern is not the same as `Printing` the pattern. #### Rules/Note: * If `n < 1` then it should return "" i.e. empty string. * There are `no whitespaces` in the pattern. ### Pattern: 1 22 333 .... ..... nnnnnn ### Examples: + pattern(5): 1 22 333 4444 55555 * pattern(11): 1 22 333 4444 55555 666666 7777777 88888888 999999999 10101010101010101010 1111111111111111111111 ```if-not:cfml * Hint: Use \n in string to jump to next line ``` ```if:cfml * Hint: Use Chr(10) in string to jump to next line ``` [List of all my katas]('http://www.codewars.com/users/curious_db97/authored') Write your solution by modifying this code: ```python def pattern(n): ``` Your solution should implemented in the function "pattern". The i Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [\"((()[8]())[2]())[5](((()[2]())[6](()[3]()))[1]())\\n(()[4]())[3](((()[2]())[1]())[8](()[3]()*)\", \"((()[8]())[2]())[5](((()[3]())[6](()[3]()))[1]())\\n(()[4]())[3](((()[2]())[1]())[8](()[3]()))\", \"((()[8]())[2]())[5](((()[2]())[6](()[3]()))[1]())\\n(()[4]())[3](((()[2]())[0]())[8](()[3]')))\", \"((()[8]())[2]())[5](((()[3]())[6](()[3]()))[1]())\\n(()[4]())[2](((()[2]())[1]())[8](()[3]()))\", \"((()[8]())[2]())[5](((()[2]())[6](()[3]()))[1]())\\n(()[4]())[3](((()[1]())[1]())[8](()[3]()*)\", \"((()[8]())[2]())[5](((()[2]())[6](()[3]()))[1]()(\\n(()[4]())[2](((()[2]())[0]())[8](()[3]')))\", \"((()[1]())[2]())[5](((()[2]())[6](()[3]()))[8]()(\\n(()[4]())[3](((()[2]())[1]())[8](()[4]')))\", \"((()[8]())[2]())[5](((()[2]())[6](()[3]()))[1]()(\\n(()[4]())[2](((()[2]())[1]())[8](()[3]')))\", \"((()[8]())[2]())[5](((()[2]())[6](()[3]()))[0]()(\\n(()[4]())[3](((()[2]())[1]())[8](()[4]')))\", \"((()[8]())[2]())[5](((()[3]())[6](()[3]()))[2]())\\n(()[4]())[2](((()[2]())[1]())[8](()[3]())(\", \"((()[8]())[2]())[5](((()[3]())[5](()[3]()))[1]())\\n(()[4]())[3](((()[2]())[1]())[8](()[3]()))\", \"((()[8]())[2]())[5](((()[2]())[6](()[4]()))[1]())\\n(()[3]())[3](((()[1]())[1]())[8](()[3]()*)\", \"((()[8]())[2]())[5](((()[2]())[5](()[4]()))[1]())\\n(()[3]())[3](((()[1]())[1]())[8](()[3]()*)\", \"((()[9]())[2]())[5](((()[2]())[6](()[3]()))[1]())\\n(()[3]())[3](((()[2]())[0]())[8](()[3]')))\", \"((()[8]())[2]())[5](((()[3]())[6](()[3]()))[2]())\\n(()[4]())[3](((()[2]())[1]())[8](()[3]())(\", \"((()[8]())[2]())[5](((()[3]())[6](()[3]()))[1]())\\n(()[5]())[2](((()[2]())[1]())[8](()[3]()))\", \"((()[8]())[1]())[5](((()[2]())[6](()[3]()))[0]()(\\n(()[4]())[3](((()[2]())[1]())[8](()[3]')))\", \"((()[8]())[2]())[5](((()[3]())[5](()[3]()))[1]())\\n(()[5]())[3](((()[2]())[1]())[8](()[3]()))\", \"((()[8]())[2]())[5](((()[3]())[6](()[3]()))[1]())\\n(()[4]())[4](((()[2]())[1]())[8](()[3]()))\", \"((()[8]())[3]())[5](((()[2]())[6](()[3]()))[1]())\\n(()[4]())[3](((()[2]())[0]())[8](()[3]')))\", \"((()[8]())[2]())[5](((()[2]())[6](()[3]()))[1]()(\\n(()[3]())[3](((()[2]())[1]())[8](()[4]')))\", \"((()[1]())[1]())[5](((()[2]())[6](()[3]()))[8]()(\\n(()[4]())[3](((()[2]())[1]())[8](()[4]')))\", \"((()[8]())[2]())[5](((()[2]())[5](()[4]()))[1]())\\n(()[2]())[3](((()[1]())[1]())[8](()[3]()*)\", \"((()[8]())[3]())[5](((()[2]())[6](()[3]()))[0]()(\\n(()[4]())[3](((()[2]())[1]())[8](()[3]')))\", \"((()[8]())[2]())[5](((()[2]())[6](()[3]()))[1]())\\n(()[4]())[4](((()[2]())[1]())[8](()[3]()*)\", \"((()[8]())[2]())[4](((()[3]())[6](()[3]()))[1]())\\n(()[4]())[2](((()[2]())[1]())[8](()[3]()))\", \"((()[8]())[2]())[5](((()[3]())[6](()[3]()))[1]())\\n(()[5]())[2](((()[2]())[1]())[7](()[3]()))\", \"((()[9]())[3]())[5](((()[2]())[6](()[3]()))[2]())\\n(()[3]())[3](((()[2]())[0]())[8](()[3]')))\", \"((()[8]())[2]())[5](((()[2]())[6](()[3]()))[1]()(\\n(()[4]())[3](((()[8]())[1]())[3](()[3]&)))\", \"((()[8]())[2]())[4](((()[2]())[6](()[4]()))[1]())\\n(()[3]())[3](((()[1]())[1]())[8](()[3]()*)\", \"((()[8]())[2]())[5](((()[3]())[6](()[3]()))[1]()(\\n(()[4]())[3](((()[3]())[1]())[8](()[3]&))*\", \"((()[8]())[3]())[5](((()[3]())[6](()[3]()))[1]()(\\n(()[4]())[3](((()[3]())[1]())[8](()[3]&))*\", \"((()[8]())[2]())[5](((()[2]())[6](()[4]()))[1]())\\n(()[4]())[3](((()[1]())[2]())[8](()[3]()*)\", \"((()[1]())[2]())[5](((()[1]())[6](()[3]()))[8]()(\\n(()[4]())[3](((()[2]())[1]())[8](()[4]')))\", \"((()[8]())[2]())[5](((()[2]())[8](()[3]()))[1]())\\n(()[4]())[3](((()[2]())[0]())[8](()[3]')))\", \"((()[1]())[1]())[5](((()[2]())[6](()[3]()))[8]()(\\n(()[4]())[3](((()[1]())[1]())[8](()[4]')))\", \"((()[8]())[3]())[5](((()[2]())[6](()[3]()))[0]()(\\n(()[4]())[3](((()[1]())[2]())[8](()[3]')))\", \"((()[8]())[2]())[4](((()[2]())[6](()[4]()))[1]())\\n(()[2]())[3](((()[1]())[1]())[8](()[3]()*)\", \"((()[8]())[2]())[5](((()[2]())[5](()[4]()))[1]())\\n(()[4]())[3](((()[1]())[1]())[8](()[3]()*)\", \"((()[8]())[2]())[5](((()[2]())[6](()[3]()))[1]()(\\n(()[3]())[2](((()[2]())[1]())[8](()[3]')))\", \"((()[8]())[3]())[5](((()[3]())[6](()[3]()))[2]())\\n(()[4]())[3](((()[2]())[1]())[8](()[3]())(\", \"((()[8]())[2]())[5](((()[4]())[5](()[3]()))[1]())\\n(()[5]())[3](((()[2]())[1]())[8](()[3]()))\", \"((()[8]())[2]())[5](((()[2]())[6](()[4]()))[1]())\\n(()[4]())[3](((()[1]())[1]())[7](()[4]))*)\", \"((()[8]())[2]())[5](((()[3]())[5](()[3]()))[1]())\\n(()[4]())[4](((()[2]())[1]())[8](()[3]()))\", \"((()[8]())[1]())[5](((()[2]())[6](()[3]()))[1]())\\n(()[4]())[4](((()[2]())[1]())[8](()[3]()*)\", \"((()[8]())[2]())[5](((()[2]())[6](()[3]()))[1]()(\\n(()[5]())[3](((()[8]())[1]())[3](()[3]&)))\", \"((()[1]())[1]())[5](((()[2]())[6](()[3]()))[8]()(\\n(()[4]())[3](((()[1]())[1]())[9](()[4]')))\", \"((()[8]())[2]())[5](((()[1]())[6](()[3]()))[1]())\\n(()[4]())[3](((()[1]())[0]())[8](()[2]')))\", \"((()[8]())[2]())[5](((()[2]())[5](()[3]()))[0]()(\\n(()[4]())[3](((()[2]())[1]())[8](()[4]')))\", \"((()[8]())[1]())[5](((()[2]())[6](()[3]()))[0]()(\\n(()[4]())[3](((()[2]())[0]())[8](()[3]')))\", \"((()[8]())[2]())[5](((()[2]())[6](()[3]()))[1]()(\\n(()[3]())[3](((()[3]())[1]())[8](()[3]&))*\", \"((()[8]())[2]())[5](((()[2]())[6](()[3]()))[1]())\\n(()[4]())[3](((()[2]())[1]())[8](()[3]')))\", \"((()[8]())[2]())[5](((()[2]())[6](()[3]()))[1]()(\\n(()[4]())[3](((()[2]())[1]())[8](()[3]')))\", \"((()[8]())[2]())[5](((()[2]())[6](()[3]()))[1]()(\\n(()[4]())[3](((()[2]())[1]())[8](()[4]')))\", \"((()[8]())[2]())[5](((()[2]())[6](()[3]()))[1]()(\\n(()[4]())[3](((()[2]())[0]())[8](()[3]')))\", \"((()[8]())[2]())[5](((()[2]())[6](()[4]()))[1]())\\n(()[4]())[3](((()[1]())[1]())[8](()[3]()*)\", \"((()[8]())[2]())[5](((()[2]())[6](()[3]()))[1]())\\n(()[4]())[3](((()[2]())[0]())[8](()[4]')))\", \"((()[8]())[2]())[5](((()[3]())[6](()[3]()))[1]())\\n(()[4]())[2](((()[2]())[1]())[8](()[3]())(\", \"((()[8]())[2]())[5](((()[2]())[6](()[3]()))[0]()(\\n(()[4]())[3](((()[2]())[1]())[8](()[3]')))\", \"((()[8]())[2]())[5](((()[2]())[6](()[3]()))[1]()(\\n(()[4]())[3](((()[2]())[1]())[8](()[3]&)))\", \"((()[9]())[2]())[5](((()[2]())[6](()[3]()))[1]())\\n(()[4]())[3](((()[2]())[0]())[8](()[3]')))\", \"((()[8]())[2]())[5](((()[2]())[6](()[3]()))[1]()(\\n(()[4]())[3](((()[2]())[1]())[8](()[3]()))\", \"((()[8]())[2]())[5](((()[2]())[6](()[4]()))[1]())\\n(()[4]())[3](((()[1]())[1]())[8](()[3]))*)\", \"((()[1]())[2]())[5](((()[2]())[6](()[3]()))[8]()(\\n(()[4]())[3](((()[2]())[1]())[8](()[3]')))\", \"((()[8]())[2]())[5](((()[2]())[6](()[4]()))[1]()*\\n(()[4]())[3](((()[1]())[1]())[8](()[3]))*)\", \"((()[8]())[2]())[5](((()[2]())[7](()[3]()))[1]())\\n(()[4]())[3](((()[2]())[0]())[8](()[3]')))\", \"((()[8]())[2]())[5](((()[2]())[6](()[4]()))[1]())\\n(()[3]())[3](((()[1]())[1]())[8](()[4]()*)\", \"((()[9]())[3]())[5](((()[2]())[6](()[3]()))[1]())\\n(()[3]())[3](((()[2]())[0]())[8](()[3]')))\", \"((()[8]())[2]())[5](((()[2]())[6](()[4]()))[1]())\\n(()[4]())[3](((()[1]())[1]())[8](()[4]))*)\", \"((()[8]())[2]())[5](((()[2]())[6](()[3]()))[1]()(\\n(()[4]())[3](((()[2]())[1]())[8](()[2]&)))\", \"((()[8]())[2]())[5](((()[2]())[6](()[3]()))[1]()(\\n(()[4]())[3](((()[1]())[1]())[8](()[3]()))\", \"((()[8]())[2]())[5](((()[2]())[6](()[3]()))[1]())\\n(()[4]())[3](((()[2]())[1]())[8](()[3]&)))\", \"((()[8]())[1]())[5](((()[2]())[6](()[3]()))[1]()(\\n(()[4]())[3](((()[2]())[0]())[8](()[3]')))\", \"((()[8]())[2]())[5](((()[2]())[6](()[3]()))[1]()(\\n(()[4]())[3](((()[3]())[1]())[8](()[3]&)))\", \"((()[8]())[2]())[5](((()[3]())[6](()[3]()))[2]())\\n(()[4]())[3](((()[2]())[1]())[8](()[3]())'\", \"((()[8]())[2]())[5](((()[3]())[6](()[3]()))[1]())\\n(()[5]())[2](((()[2]())[1]())[8](()[3]())*\", \"((()[8]())[2]())[5](((()[2]())[6](()[3]()))[1]()(\\n(()[4]())[3](((()[3]())[1]())[8](()[3]&))*\", \"((()[8]())[2]())[5](((()[2]())[5](()[4]()))[1]())\\n(()[2]())[3](((()[1]())[1]())[8](()[3]()**\", \"((()[8]())[2]())[5](((()[3]())[6](()[3]()))[1]())\\n(()[5]())[2](((()[2]())[1]())[8](()[3]()**\", \"((()[1]())[2]())[5](((()[2]())[6](()[3]()))[8]()(\\n(()[4]())[3](((()[2]())[1]())[8](()[4]()))\", \"((()[9]())[2]())[5](((()[2]())[6](()[3]()))[1]()(\\n(()[4]())[3](((()[3]())[1]())[8](()[3]&))*\", \"((()[8]())[1]())[5](((()[2]())[6](()[3]()))[1]())\\n(()[4]())[3](((()[2]())[0]())[8](()[3]')))\", \"((()[8]())[2]())[5](((()[2]())[6](()[4]()))[1]())\\n(()[3]())[3](((()[1]())[1]())[8](()[3]))*)\", \"((()[8]())[2]())[5](((()[3]())[6](()[2]()))[2]())\\n(()[4]())[3](((()[2]())[1]())[8](()[3]())(\", \"((()[8]())[2]())[5](((()[2]())[6](()[3]()))[1]())\\n(()[4]())[2](((()[2]())[1]())[8](()[3]&)))\", \"((()[9]())[2]())[5](((()[2]())[6](()[3]()))[1]()(\\n(()[4]())[3](((()[3]())[1]())[8](()[3]&))+\", \"((()[8]())[2]())[6](((()[3]())[6](()[3]()))[1]())\\n(()[4]())[2](((()[2]())[1]())[8](()[3]()))\", \"((()[9]())[2]())[5](((()[2]())[6](()[3]()))[1]())\\n(()[3]())[3](((()[2]())[0]())[8](()[3]&)))\", \"((()[8]())[2]())[5](((()[2]())[6](()[3]()))[2]())\\n(()[4]())[3](((()[2]())[0]())[8](()[3]')))\", \"((()[8]())[2]())[5](((()[2]())[6](()[3]()))[0]()(\\n(()[4]())[3](((()[2]())[1]())[8](()[4]))')\", \"((()[8]())[2]())[5](((()[2]())[6](()[4]()))[1]())\\n(()[3]())[3](((()[1]())[1]())[8](()[3]()*(\", \"((()[8]())[1]())[5](((()[2]())[6](()[3]()))[1]())\\n(()[4]())[3](((()[2]())[0]())[8](()[2]')))\", \"((()[8]())[2]())[5](((()[3]())[7](()[2]()))[1]())\\n(()[4]())[3](((()[2]())[0]())[8](()[3]')))\", \"((()[8]())[2]())[4](((()[3]())[6](()[3]()))[1]())\\n(()[4]())[2](((()[2]())[1]())[8](()[4]()))\", \"((()[8]())[2]())[5](((()[2]())[6](()[3]()))[1]())\\n(()[3]())[3](((()[1]())[1]())[8](()[3]))*)\", \"((()[8]())[2]())[5](((()[1]())[6](()[3]()))[1]())\\n(()[4]())[3](((()[2]())[0]())[8](()[2]')))\", \"((()[8]())[2]())[5](((()[2]())[5](()[4]()))[1]())\\n(()[3]())[3](((()[1]())[1]())[8](()[3]))*)\", \"((()[7]())[2]())[5](((()[2]())[6](()[3]()))[1]())\\n(()[4]())[3](((()[2]())[1]())[8](()[3]&)))\", \"((()[8]())[2]())[5](((()[2]())[6](()[2]()))[1]()(\\n(()[4]())[3](((()[3]())[1]())[8](()[3]&)))\", \"((()[8]())[2]())[5](((()[3]())[5](()[3]()))[1]())\\n(()[4]())[4](((()[2]())[1]())[8](()[3]')))\", \"((()[8]())[2]())[5](((()[2]())[6](()[3]()))[1]())\\n(()[4]())[3](((()[2]())[1]())[8](()[3]()))\"], \"outputs\": [\"(()[6]())[8](((()[4]())[7]())[9]())\\n\", \"(()[6]())[8](((()[5]())[7]())[9]())\\n\", \"(()[6]())[8](((()[4]())[6]())[9]())\\n\", \"(()[6]())[7](((()[5]())[7]())[9]())\\n\", \"(()[6]())[8](((()[3]())[7]())[9]())\\n\", \"(()[6]())[7](((()[4]())[6]())[9]())\\n\", \"(()[6]())[8](((()[4]())[7]())[16]())\\n\", \"(()[6]())[7](((()[4]())[7]())[9]())\\n\", \"(()[6]())[8](((()[4]())[7]())[8]())\\n\", \"(()[6]())[7](((()[5]())[7]())[10]())\\n\", \"(()[6]())[8](((()[5]())[6]())[9]())\\n\", \"(()[5]())[8](((()[3]())[7]())[9]())\\n\", \"(()[5]())[8](((()[3]())[6]())[9]())\\n\", \"(()[5]())[8](((()[4]())[6]())[9]())\\n\", \"(()[6]())[8](((()[5]())[7]())[10]())\\n\", \"(()[7]())[7](((()[5]())[7]())[9]())\\n\", \"(()[5]())[8](((()[4]())[7]())[8]())\\n\", \"(()[7]())[8](((()[5]())[6]())[9]())\\n\", \"(()[6]())[9](((()[5]())[7]())[9]())\\n\", \"(()[7]())[8](((()[4]())[6]())[9]())\\n\", \"(()[5]())[8](((()[4]())[7]())[9]())\\n\", \"(()[5]())[8](((()[4]())[7]())[16]())\\n\", \"(()[4]())[8](((()[3]())[6]())[9]())\\n\", \"(()[7]())[8](((()[4]())[7]())[8]())\\n\", \"(()[6]())[9](((()[4]())[7]())[9]())\\n\", \"(()[6]())[6](((()[5]())[7]())[9]())\\n\", \"(()[7]())[7](((()[5]())[7]())[8]())\\n\", \"(()[6]())[8](((()[4]())[6]())[10]())\\n\", \"(()[6]())[8](((()[10]())[7]())[4]())\\n\", \"(()[5]())[7](((()[3]())[7]())[9]())\\n\", \"(()[6]())[8](((()[6]())[7]())[9]())\\n\", \"(()[7]())[8](((()[6]())[7]())[9]())\\n\", \"(()[6]())[8](((()[3]())[8]())[9]())\\n\", \"(()[6]())[8](((()[3]())[7]())[16]())\\n\", \"(()[6]())[8](((()[4]())[8]())[9]())\\n\", \"(()[5]())[8](((()[3]())[7]())[16]())\\n\", \"(()[7]())[8](((()[3]())[8]())[8]())\\n\", \"(()[4]())[7](((()[3]())[7]())[9]())\\n\", \"(()[6]())[8](((()[3]())[6]())[9]())\\n\", \"(()[5]())[7](((()[4]())[7]())[9]())\\n\", \"(()[7]())[8](((()[5]())[7]())[10]())\\n\", \"(()[7]())[8](((()[6]())[6]())[9]())\\n\", \"(()[6]())[8](((()[3]())[7]())[8]())\\n\", \"(()[6]())[9](((()[5]())[6]())[9]())\\n\", \"(()[5]())[9](((()[4]())[7]())[9]())\\n\", \"(()[7]())[8](((()[10]())[7]())[4]())\\n\", \"(()[5]())[8](((()[3]())[7]())[17]())\\n\", \"(()[6]())[8](((()[2]())[6]())[9]())\\n\", \"(()[6]())[8](((()[4]())[6]())[8]())\\n\", \"(()[5]())[8](((()[4]())[6]())[8]())\\n\", \"(()[5]())[8](((()[5]())[7]())[9]())\\n\", \"(()[6]())[8](((()[4]())[7]())[9]())\\n\", \"(()[6]())[8](((()[4]())[7]())[9]())\\n\", \"(()[6]())[8](((()[4]())[7]())[9]())\\n\", \"(()[6]())[8](((()[4]())[6]())[9]())\\n\", \"(()[6]())[8](((()[3]())[7]())[9]())\\n\", \"(()[6]())[8](((()[4]())[6]())[9]())\\n\", \"(()[6]())[7](((()[5]())[7]())[9]())\\n\", \"(()[6]())[8](((()[4]())[7]())[8]())\\n\", \"(()[6]())[8](((()[4]())[7]())[9]())\\n\", \"(()[6]())[8](((()[4]())[6]())[9]())\\n\", \"(()[6]())[8](((()[4]())[7]())[9]())\\n\", \"(()[6]())[8](((()[3]())[7]())[9]())\\n\", \"(()[6]())[8](((()[4]())[7]())[16]())\\n\", \"(()[6]())[8](((()[3]())[7]())[9]())\\n\", \"(()[6]())[8](((()[4]())[7]())[9]())\\n\", \"(()[5]())[8](((()[3]())[7]())[9]())\\n\", \"(()[6]())[8](((()[4]())[6]())[9]())\\n\", \"(()[6]())[8](((()[3]())[7]())[9]())\\n\", \"(()[6]())[8](((()[4]())[7]())[9]())\\n\", \"(()[6]())[8](((()[3]())[7]())[9]())\\n\", \"(()[6]())[8](((()[4]())[7]())[9]())\\n\", \"(()[5]())[8](((()[4]())[6]())[9]())\\n\", \"(()[6]())[8](((()[5]())[7]())[9]())\\n\", \"(()[6]())[8](((()[5]())[7]())[10]())\\n\", \"(()[7]())[7](((()[5]())[7]())[9]())\\n\", \"(()[6]())[8](((()[5]())[7]())[9]())\\n\", \"(()[4]())[8](((()[3]())[6]())[9]())\\n\", \"(()[7]())[7](((()[5]())[7]())[9]())\\n\", \"(()[6]())[8](((()[4]())[7]())[16]())\\n\", \"(()[6]())[8](((()[5]())[7]())[9]())\\n\", \"(()[5]())[8](((()[4]())[6]())[9]())\\n\", \"(()[5]())[8](((()[3]())[7]())[9]())\\n\", \"(()[6]())[8](((()[5]())[7]())[10]())\\n\", \"(()[6]())[7](((()[4]())[7]())[9]())\\n\", \"(()[6]())[8](((()[5]())[7]())[9]())\\n\", \"(()[6]())[8](((()[5]())[7]())[9]())\\n\", \"(()[5]())[8](((()[4]())[6]())[9]())\\n\", \"(()[6]())[8](((()[4]())[6]())[10]())\\n\", \"(()[6]())[8](((()[4]())[7]())[8]())\\n\", \"(()[5]())[8](((()[3]())[7]())[9]())\\n\", \"(()[5]())[8](((()[4]())[6]())[9]())\\n\", \"(()[6]())[8](((()[5]())[7]())[9]())\\n\", \"(()[6]())[6](((()[5]())[7]())[9]())\\n\", \"(()[5]())[8](((()[3]())[7]())[9]())\\n\", \"(()[6]())[8](((()[3]())[6]())[9]())\\n\", \"(()[5]())[8](((()[3]())[6]())[9]())\\n\", \"(()[6]())[8](((()[4]())[7]())[9]())\\n\", \"(()[6]())[8](((()[5]())[7]())[9]())\\n\", \"(()[6]())[9](((()[5]())[6]())[9]())\\n\", \"(()[6]())[8](((()[4]())[7]())[9]())\"]}", "source": "primeintellect"}
C --Misawa's rooted tree Problem Statement You noticed that your best friend Misawa's birthday was near, and decided to give him a rooted binary tree as a gift. Here, the rooted binary tree has the following graph structure. (Figure 1) * Each vertex has exactly one vertex called the parent of that vertex, which is connected to the parent by an edge. However, only one vertex, called the root, has no parent as an exception. * Each vertex has or does not have exactly one vertex called the left child. If you have a left child, it is connected to the left child by an edge, and the parent of the left child is its apex. * Each vertex has or does not have exactly one vertex called the right child. If you have a right child, it is connected to the right child by an edge, and the parent of the right child is its apex. <image> Figure 1. An example of two rooted binary trees and their composition You wanted to give a handmade item, so I decided to buy two commercially available rooted binary trees and combine them on top of each other to make one better rooted binary tree. Each vertex of the two trees you bought has a non-negative integer written on it. Mr. Misawa likes a tree with good cost performance, such as a small number of vertices and large numbers, so I decided to create a new binary tree according to the following procedure. 1. Let the sum of the integers written at the roots of each of the two binary trees be the integers written at the roots of the new binary tree. 2. If both binary trees have a left child, create a binary tree by synthesizing each of the binary trees rooted at them, and use it as the left child of the new binary tree root. Otherwise, the root of the new bifurcation has no left child. 3. If the roots of both binaries have the right child, create a binary tree by synthesizing each of the binary trees rooted at them, and use it as the right child of the root of the new binary tree. Otherwise, the root of the new bifurcation has no right child. You decide to see what the resulting rooted binary tree will look like before you actually do the compositing work. Given the information of the two rooted binary trees you bought, write a program to find the new rooted binary tree that will be synthesized according to the above procedure. Here, the information of the rooted binary tree is expressed as a character string in the following format. > (String representing the left child) [Integer written at the root] (String representing the right child) A tree without nodes is an empty string. For example, the synthesized new rooted binary tree in Figure 1 is `(() [6] ()) [8] (((() [4] ()) [7] ()) [9] () ) `Written as. Input The input is expressed in the following format. $ A $ $ B $ $ A $ and $ B $ are character strings that represent the information of the rooted binary tree that you bought, and the length is $ 7 $ or more and $ 1000 $ or less. The information given follows the format described above and does not include extra whitespace. Also, rooted trees that do not have nodes are not input. You can assume that the integers written at each node are greater than or equal to $ 0 $ and less than or equal to $ 1000 $. However, note that the integers written at each node of the output may not fall within this range. Output Output the information of the new rooted binary tree created by synthesizing the two rooted binary trees in one line. In particular, be careful not to include extra whitespace characters other than line breaks at the end of the line. Sample Input 1 ((() [8] ()) [2] ()) [5] (((() [2] ()) [6] (() [3] ())) [1] ()) (() [4] ()) [3] (((() [2] ()) [1] ()) [8] (() [3] ())) Output for the Sample Input 1 (() [6] ()) [8] (((() [4] ()) [7] ()) [9] ()) Sample Input 2 (() [1] ()) [2] (() [3] ()) (() [1] (() [2] ())) [3] () Output for the Sample Input 2 (() [2] ()) [5] () Sample Input 3 (() [1] ()) [111] () () [999] (() [9] ()) Output for the Sample Input 3 () [1110] () Sample Input 4 (() [2] (() [4] ())) [8] ((() [16] ()) [32] (() [64] ())) ((() [1] ()) [3] ()) [9] (() [27] (() [81] ())) Output for the Sample Input 4 (() [5] ()) [17] (() [59] (() [145] ())) Sample Input 5 () [0] () () [1000] () Output for the Sample Input 5 () [1000] () Example Input ((()[8]())[2]())[5](((()[2]())[6](()[3]()))[1]()) (()[4]())[3](((()[2]())[1]())[8](()[3]())) Output (()[6]())[8](((()[4]())[7]())[9]()) Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [\"1\\n1 1\\nA\\n\", \"1\\n2 2\\nAA\\nAA\\n\", \"1\\n3 3\\nAAA\\nAAA\\nAAA\\n\", \"1\\n4 4\\nAAAA\\nAAAA\\nAAAA\\nAAAA\\n\", \"4\\n7 8\\nAAPAAAAA\\nAAAAPPPP\\nPPPP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\n4\\n\", \"2\\n1\\nMORTAL\\n4\\n\", \"2\\n1\\nMORTAL\\n4\\n\", \"2\\n1\\nMORTAL\\n4\\n\", \"2\\n1\\nMORTAL\\n4\\n\", \"2\\n1\\nMORTAL\\n4\\n\", \"2\\n1\\nMORTAL\\n4\\n\", \"2\\n1\\nMORTAL\\n4\\n\", \"2\\n1\\nMORTAL\\n4\\n\", \"2\\n1\\nMORTAL\\n4\\n\", \"2\\n1\\nMORTAL\\n4\\n\", \"2\\n1\\nMORTAL\\n4\\n\", \"2\\n1\\nMORTAL\\n4\\n\", \"2\\n1\\nMORTAL\\n4\\n\", \"2\\n1\\nMORTAL\\n4\\n\", \"2\\n1\\nMORTAL\\n4\\n\", \"2\\n1\\nMORTAL\\n4\\n\", \"2\\n1\\nMORTAL\\n4\\n\", \"2\\n1\\nMORTAL\\n4\\n\", \"2\\n1\\nMORTAL\\n4\\n\", \"2\\n1\\nMORTAL\\n4\\n\", \"2\\n1\\nMORTAL\\n4\\n\", \"2\\n1\\nMORTAL\\n4\\n\", \"2\\n1\\nMORTAL\\n4\\n\", \"2\\n1\\nMORTAL\\n4\\n\", \"2\\n1\\nMORTAL\\n3\\n\", \"2\\n1\\nMORTAL\\n4\\n\", \"2\\n1\\nMORTAL\\n4\\n\", \"2\\n1\\nMORTAL\\n4\\n\", \"2\\n1\\nMORTAL\\n4\\n\", \"2\\n1\\nMORTAL\\n4\\n\", \"2\\n1\\nMORTAL\\n4\\n\", \"2\\n1\\nMORTAL\\n4\\n\", \"2\\n1\\nMORTAL\\n4\\n\", \"2\\n1\\nMORTAL\\n3\\n\", \"2\\n1\\nMORTAL\\n4\\n\", \"2\\n1\\nMORTAL\\n4\\n\", \"2\\n1\\nMORTAL\\n4\\n\"]}", "source": "primeintellect"}
You are an all-powerful being and you have created a rectangular world. In fact, your world is so bland that it could be represented by a r × c grid. Each cell on the grid represents a country. Each country has a dominant religion. There are only two religions in your world. One of the religions is called Beingawesomeism, who do good for the sake of being good. The other religion is called Pushingittoofarism, who do murders for the sake of being bad. Oh, and you are actually not really all-powerful. You just have one power, which you can use infinitely many times! Your power involves missionary groups. When a missionary group of a certain country, say a, passes by another country b, they change the dominant religion of country b to the dominant religion of country a. In particular, a single use of your power is this: * You choose a horizontal 1 × x subgrid or a vertical x × 1 subgrid. That value of x is up to you; * You choose a direction d. If you chose a horizontal subgrid, your choices will either be NORTH or SOUTH. If you choose a vertical subgrid, your choices will either be EAST or WEST; * You choose the number s of steps; * You command each country in the subgrid to send a missionary group that will travel s steps towards direction d. In each step, they will visit (and in effect convert the dominant religion of) all s countries they pass through, as detailed above. * The parameters x, d, s must be chosen in such a way that any of the missionary groups won't leave the grid. The following image illustrates one possible single usage of your power. Here, A represents a country with dominant religion Beingawesomeism and P represents a country with dominant religion Pushingittoofarism. Here, we've chosen a 1 × 4 subgrid, the direction NORTH, and s = 2 steps. <image> You are a being which believes in free will, for the most part. However, you just really want to stop receiving murders that are attributed to your name. Hence, you decide to use your powers and try to make Beingawesomeism the dominant religion in every country. What is the minimum number of usages of your power needed to convert everyone to Beingawesomeism? With god, nothing is impossible. But maybe you're not god? If it is impossible to make Beingawesomeism the dominant religion in all countries, you must also admit your mortality and say so. Input The first line of input contains a single integer t (1 ≤ t ≤ 2⋅ 10^4) denoting the number of test cases. The first line of each test case contains two space-separated integers r and c denoting the dimensions of the grid (1 ≤ r, c ≤ 60). The next r lines each contains c characters describing the dominant religions in the countries. In particular, the j-th character in the i-th line describes the dominant religion in the country at the cell with row i and column j, where: * "A" means that the dominant religion is Beingawesomeism; * "P" means that the dominant religion is Pushingittoofarism. It is guaranteed that the grid will only contain "A" or "P" characters. It is guaranteed that the sum of the r ⋅ c in a single file is at most 3 ⋅ 10^6. Output For each test case, output a single line containing the minimum number of usages of your power needed to convert everyone to Beingawesomeism, or the string "MORTAL" (without quotes) if it is impossible to do so. Example Input 4 7 8 AAPAAAAA PPPPAAAA PPPPAAAA APAAPPPP APAPPAPP AAAAPPAP AAAAPPAA 6 5 AAAAA AAAAA AAPAA AAPAP AAAPP AAAPP 4 4 PPPP PPPP PPPP PPPP 3 4 PPPP PAAP PPPP Output 2 1 MORTAL 4 Note In the first test case, it can be done in two usages, as follows: Usage 1: <image> Usage 2: <image> In the second test case, it can be done with just one usage of the power. In the third test case, it is impossible to convert everyone to Beingawesomeism, so the answer is "MORTAL". Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [\"4\", \"1026\", \"1000000001000000000\", \"0\", \"530\", \"1100000001000000000\", \"1\", \"706\", \"1100000001000010000\", \"2\", \"152\", \"1100000001001010000\", \"7\", \"192\", \"1100000011001010000\", \"5\", \"292\", \"1100000001001010010\", \"271\", \"1101000001001010010\", \"266\", \"1101000000001010010\", \"76\", \"1101010000001010010\", \"49\", \"1101010000011010010\", \"75\", \"1101110000001010010\", \"126\", \"1101110000001110010\", \"151\", \"1101010000001110010\", \"93\", \"1001010000001110010\", \"58\", \"1001110000001110010\", \"57\", \"1001110001001110010\", \"12\", \"1001110001001110000\", \"8\", \"1001110001101110010\", \"13\", \"1531\", \"1000001000000000000\", \"11\", \"663\", \"1000000001100000000\", \"992\", \"1100000000000000000\", \"6\", \"245\", \"1100000001000110000\", \"198\", \"1100000001001011000\", \"14\", \"218\", \"1000000011001010000\", \"9\", \"16\", \"428\", \"1100010001001010010\", \"182\", \"1101000000011010010\", \"46\", \"1101110000001011010\", \"17\", \"1101110000011010010\", \"61\", \"1101111000001010010\", \"147\", \"1101110000001110000\", \"233\", \"1101010000001110000\", \"150\", \"1001010010001110010\", \"105\", \"1001110000001111010\", \"15\", \"1000110001001110010\", \"1001110101001110000\", \"25\", \"1101110001101110010\", \"20\", \"2681\", \"1010001000000000000\", \"464\", \"1000000000100000000\", \"301\", \"1100000000000000100\", \"10\", \"303\", \"1110000001000110000\", \"159\", \"1101000001001011000\", \"30\", \"406\", \"1000000010001010000\", \"21\", \"26\", \"3\", \"1422\", \"1000000000000000000\"], \"outputs\": [\"8\\n\", \"29565\\n\", \"999867657\\n\", \"1\\n\", \"10220\\n\", \"355035671\\n\", \"2\\n\", \"17242\\n\", \"391646023\\n\", \"4\\n\", \"1472\\n\", \"103347644\\n\", \"14\\n\", \"2201\\n\", \"194416284\\n\", \"10\\n\", \"4022\\n\", \"256110014\\n\", \"3526\\n\", \"646871849\\n\", \"3446\\n\", \"757030135\\n\", \"502\\n\", \"977998448\\n\", \"260\\n\", \"254853750\\n\", \"485\\n\", \"367744975\\n\", \"1093\\n\", \"120014212\\n\", \"1448\\n\", \"845461954\\n\", \"717\\n\", \"944721561\\n\", \"340\\n\", \"175786357\\n\", \"329\\n\", \"507169434\\n\", \"33\\n\", \"965789606\\n\", \"18\\n\", \"598929443\\n\", \"36\\n\", \"58980\\n\", \"572579\\n\", \"28\\n\", \"15197\\n\", \"69882250\\n\", \"28824\\n\", \"822366132\\n\", \"13\\n\", \"3178\\n\", \"926063611\\n\", \"2305\\n\", \"296800001\\n\", \"40\\n\", \"2726\\n\", \"464583195\\n\", \"21\\n\", \"46\\n\", \"7868\\n\", \"87291874\\n\", \"2062\\n\", \"834042114\\n\", \"242\\n\", \"894929003\\n\", \"50\\n\", \"230571839\\n\", \"358\\n\", \"158300591\\n\", \"1369\\n\", \"757424841\\n\", \"2976\\n\", \"580519761\\n\", \"1441\\n\", \"423315064\\n\", \"857\\n\", \"412426526\\n\", \"41\\n\", \"960841410\\n\", \"113194398\\n\", \"94\\n\", \"407444118\\n\", \"68\\n\", \"139596\\n\", \"790875629\\n\", \"8824\\n\", \"898648894\\n\", \"4298\\n\", \"543239468\\n\", \"26\\n\", \"4337\\n\", \"833303215\\n\", \"1581\\n\", \"683897149\\n\", \"121\\n\", \"7176\\n\", \"706170441\\n\", \"73\\n\", \"102\\n\", \"5\", \"52277\", \"787014179\"]}", "source": "primeintellect"}
You are given a positive integer N. Find the number of the pairs of integers u and v (0≦u,v≦N) such that there exist two non-negative integers a and b satisfying a xor b=u and a+b=v. Here, xor denotes the bitwise exclusive OR. Since it can be extremely large, compute the answer modulo 10^9+7. Constraints * 1≦N≦10^{18} Input The input is given from Standard Input in the following format: N Output Print the number of the possible pairs of integers u and v, modulo 10^9+7. Examples Input 3 Output 5 Input 1422 Output 52277 Input 1000000000000000000 Output 787014179 Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [[0], [1], [2], [10], [100], [1000], [10000], [100000], [1000000], [10000000]], \"outputs\": [[0], [1], [2], [6], [20], [118], [720], [11108], [114952], [1153412]]}", "source": "primeintellect"}
*This kata is based on [Project Euler Problem #349](https://projecteuler.net/problem=349). You may want to start with solving [this kata](https://www.codewars.com/kata/langtons-ant) first.* --- [Langton's ant](https://en.wikipedia.org/wiki/Langton%27s_ant) moves on a regular grid of squares that are coloured either black or white. The ant is always oriented in one of the cardinal directions (left, right, up or down) and moves according to the following rules: - if it is on a black square, it flips the colour of the square to white, rotates 90 degrees counterclockwise and moves forward one square. - if it is on a white square, it flips the colour of the square to black, rotates 90 degrees clockwise and moves forward one square. Starting with a grid that is **entirely white**, how many squares are black after `n` moves of the ant? **Note:** `n` will go as high as 10^(20) --- ## My other katas If you enjoyed this kata then please try [my other katas](https://www.codewars.com/collections/katas-created-by-anter69)! :-) #### *Translations are welcome!* Write your solution by modifying this code: ```python def langtons_ant(n): ``` Your solution should implemented in the function "langtons_ant". The i Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [\"2\\n1 2 2 2\\n1 1 2 2\\n\", \"1\\n69 69 69 69\\n\", \"5\\n1 1 1000000000 1000000000\\n1 1 1000000000 1000000000\\n1 1 1000000000 1000000000\\n1 1 1000000000 1000000000\\n1 1 65537 65537\\n\", \"1\\n1 1 131073 131073\\n\", \"1\\n69 69 69 69\\n\", \"1\\n3 2 4 7\\n\", \"5\\n1 1 1000000000 1000000000\\n1 1 1000000000 1000000000\\n1 1 1000000000 1000000000\\n1 1 1000000000 1000000000\\n1 1 65537 65537\\n\", \"1\\n1 1 131073 131073\\n\", \"1\\n69 69 34 69\\n\", \"1\\n3 2 4 1\\n\", \"5\\n1 1 1000000000 1000000000\\n1 1 1000000000 1000000100\\n1 1 1000000000 1000000000\\n1 1 1000000000 1000000000\\n1 1 65537 65537\\n\", \"1\\n0 1 131073 131073\\n\", \"2\\n2 2 2 2\\n1 1 2 2\\n\", \"1\\n69 69 34 33\\n\", \"1\\n3 2 4 0\\n\", \"5\\n1 1 1000000000 1000000000\\n1 1 1000000000 1000000100\\n1 1 1000000000 1000000000\\n2 1 1000000000 1000000000\\n1 1 65537 65537\\n\", \"1\\n0 1 131073 36597\\n\", \"2\\n2 2 1 2\\n1 1 2 2\\n\", \"1\\n68 69 34 33\\n\", \"5\\n1 1 1000000000 1000000000\\n1 1 1000000000 1000000100\\n1 1 1001000000 1000000000\\n2 1 1000000000 1000000000\\n1 1 65537 65537\\n\", \"1\\n-1 1 131073 36597\\n\", \"2\\n2 2 1 2\\n1 1 2 3\\n\", \"1\\n102 69 34 33\\n\", \"5\\n1 1 1000000000 1000000000\\n1 1 1000000000 1000000100\\n1 1 1001000000 1000000000\\n2 1 1000000000 1000000000\\n1 1 65537 18413\\n\", \"1\\n0 1 131073 57267\\n\", \"2\\n2 2 1 2\\n0 1 2 3\\n\", \"1\\n102 69 34 54\\n\", \"5\\n1 1 1000000000 1000000000\\n1 1 1000000000 1000000100\\n1 1 1001000000 1000000000\\n1 1 1000000000 1000000000\\n1 1 65537 18413\\n\", \"1\\n0 1 111930 57267\\n\", \"1\\n102 69 0 54\\n\", \"5\\n1 1 1000000000 1000000000\\n1 1 1000000000 1000000100\\n1 1 1001000000 1000000000\\n1 1 1000000010 1000000000\\n1 1 65537 18413\\n\", \"1\\n0 1 202327 57267\\n\", \"2\\n2 2 1 3\\n0 2 2 3\\n\", \"1\\n14 69 0 54\\n\", \"1\\n0 1 1 1\\n\", \"5\\n1 0 1000000000 1000000000\\n1 1 1000000000 1000000100\\n1 1 1001000000 1000000000\\n1 1 1000000010 1000000000\\n1 1 65537 18413\\n\", \"1\\n0 1 202327 101281\\n\", \"1\\n14 69 1 54\\n\", \"1\\n1 1 1 1\\n\", \"5\\n1 0 1000000000 1000000000\\n1 1 1000000000 1000000100\\n1 1 1001000000 1000000000\\n1 1 1000000010 1000000000\\n2 1 65537 18413\\n\", \"1\\n0 0 202327 101281\\n\", \"2\\n2 3 1 6\\n0 2 2 3\\n\", \"1\\n14 69 1 62\\n\", \"5\\n1 0 1000000000 1000000000\\n1 1 1000000000 1000000100\\n1 0 1001000000 1000000000\\n1 1 1000000010 1000000000\\n2 1 65537 18413\\n\", \"1\\n0 0 202327 34147\\n\", \"2\\n2 3 1 12\\n0 2 2 3\\n\", \"1\\n14 69 0 62\\n\", \"5\\n1 0 1000000000 1000000000\\n1 1 1000000000 1000000100\\n1 0 1001000000 1000000000\\n1 1 1100000010 1000000000\\n2 1 65537 18413\\n\", \"1\\n0 0 292866 34147\\n\", \"2\\n2 3 1 12\\n0 1 2 3\\n\", \"1\\n14 69 0 4\\n\", \"5\\n1 0 1000000000 1000000000\\n1 1 1000000000 1000000100\\n1 0 1001000000 1000000000\\n1 1 1100000010 1001000000\\n2 1 65537 18413\\n\", \"1\\n-1 0 292866 34147\\n\", \"2\\n2 3 1 6\\n0 1 2 3\\n\", \"1\\n14 138 0 4\\n\", \"1\\n2 1 0 1\\n\", \"5\\n1 0 1000000000 1000000000\\n1 1 1000000000 1000001100\\n1 0 1001000000 1000000000\\n1 1 1100000010 1001000000\\n2 1 65537 18413\\n\", \"1\\n-1 0 421316 34147\\n\", \"2\\n2 2 1 6\\n0 1 2 3\\n\", \"1\\n23 138 0 4\\n\", \"5\\n1 0 1000000000 1000000000\\n1 1 1000000000 1000001100\\n1 0 1001000000 1000000000\\n1 1 1100010010 1001000000\\n2 1 65537 18413\\n\", \"1\\n-1 0 653749 34147\\n\", \"2\\n2 2 2 6\\n0 1 2 3\\n\", \"1\\n23 155 0 4\\n\", \"5\\n1 0 1000000000 1000000000\\n1 1 1000000000 1000001100\\n1 0 1001000000 1000000000\\n1 1 1100010011 1001000000\\n2 1 65537 18413\\n\", \"1\\n-1 0 653749 36617\\n\", \"2\\n2 2 2 6\\n0 1 2 1\\n\", \"1\\n23 155 0 5\\n\", \"5\\n1 0 1000000000 1000000000\\n1 1 1000000000 1000001100\\n1 0 1001000000 1000000000\\n1 1 1100010011 1001000000\\n2 1 108856 18413\\n\", \"1\\n-2 0 653749 36617\\n\", \"2\\n0 2 2 6\\n0 1 2 1\\n\", \"5\\n1 0 1000000000 1000000000\\n1 1 1001000000 1000001100\\n1 0 1001000000 1000000000\\n1 1 1100010011 1001000000\\n2 1 108856 18413\\n\", \"1\\n-2 0 653749 54326\\n\", \"2\\n1 2 2 6\\n0 1 2 1\\n\", \"1\\n41 155 -1 5\\n\", \"5\\n1 0 1000000000 1000000000\\n2 1 1001000000 1000001100\\n1 0 1001000000 1000000000\\n1 1 1100010011 1001000000\\n2 1 108856 18413\\n\", \"1\\n-1 0 653749 54326\\n\", \"2\\n1 2 2 6\\n1 1 2 1\\n\", \"1\\n41 155 -2 5\\n\", \"5\\n1 0 1000000000 1000000000\\n2 1 1001000000 1000001100\\n1 0 1001000000 1000000000\\n1 1 1100010011 1001000000\\n2 1 108856 11286\\n\", \"1\\n-1 0 1277990 54326\\n\", \"2\\n0 2 2 6\\n1 1 2 1\\n\", \"1\\n41 76 -2 5\\n\", \"5\\n1 0 1000000000 1000000000\\n2 1 1001000000 1000000100\\n1 0 1001000000 1000000000\\n1 1 1100010011 1001000000\\n2 1 108856 11286\\n\", \"1\\n-1 0 2345232 54326\\n\", \"2\\n0 2 2 6\\n2 1 2 1\\n\", \"1\\n70 76 -2 5\\n\", \"5\\n1 0 1000000000 1000000000\\n2 1 1001000000 1000000100\\n1 0 1001000000 1000000000\\n1 1 1100010011 1001000000\\n2 2 108856 11286\\n\", \"1\\n-1 0 2345232 62017\\n\", \"1\\n3 1 4 0\\n\", \"1\\n3 1 5 0\\n\", \"1\\n3 1 1 0\\n\", \"2\\n2 2 1 2\\n0 2 2 3\\n\", \"1\\n0 1 1 0\\n\", \"2\\n2 3 1 3\\n0 2 2 3\\n\", \"1\\n1 1 0 1\\n\", \"1\\n1 1 0 2\\n\", \"1\\n1 1 0 0\\n\", \"1\\n1 0 0 1\\n\", \"1\\n0 0 0 1\\n\", \"1\\n0 -1 0 1\\n\", \"1\\n23 155 -1 5\\n\", \"1\\n0 -1 -1 1\\n\", \"1\\n0 -1 -1 0\\n\", \"1\\n-1 -1 -1 0\\n\", \"1\\n-1 -2 -1 0\\n\", \"1\\n-1 -1 0 0\\n\", \"2\\n1 2 2 2\\n1 1 2 2\\n\"], \"outputs\": [\"1\\n4\\n\", \"0\\n\", \"2000000000\\n2000000000\\n2000000000\\n2000000000\\n131074\\n\", \"262146\\n\", \"0\\n\", \"8\\n\", \"2000000000\\n2000000000\\n2000000000\\n2000000000\\n131074\\n\", \"262146\\n\", \"35\\n\", \"4\\n\", \"2000000000\\n2000000100\\n2000000000\\n2000000000\\n131074\\n\", \"262147\\n\", \"0\\n4\\n\", \"73\\n\", \"5\\n\", \"2000000000\\n2000000100\\n2000000000\\n1999999999\\n131074\\n\", \"167671\\n\", \"1\\n4\\n\", \"72\\n\", \"2000000000\\n2000000100\\n2001000000\\n1999999999\\n131074\\n\", \"167672\\n\", \"1\\n5\\n\", \"106\\n\", \"2000000000\\n2000000100\\n2001000000\\n1999999999\\n83950\\n\", \"188341\\n\", \"1\\n6\\n\", \"85\\n\", \"2000000000\\n2000000100\\n2001000000\\n2000000000\\n83950\\n\", \"169198\\n\", \"119\\n\", \"2000000000\\n2000000100\\n2001000000\\n2000000010\\n83950\\n\", \"259595\\n\", \"4\\n5\\n\", \"31\\n\", \"1\\n\", \"2000000001\\n2000000100\\n2001000000\\n2000000010\\n83950\\n\", \"303609\\n\", \"30\\n\", \"0\\n\", \"2000000001\\n2000000100\\n2001000000\\n2000000010\\n83949\\n\", \"303610\\n\", \"6\\n5\\n\", \"22\\n\", \"2000000001\\n2000000100\\n2001000001\\n2000000010\\n83949\\n\", \"236476\\n\", \"12\\n5\\n\", \"23\\n\", \"2000000001\\n2000000100\\n2001000001\\n2100000010\\n83949\\n\", \"327015\\n\", \"12\\n6\\n\", \"81\\n\", \"2000000001\\n2000000100\\n2001000001\\n2101000010\\n83949\\n\", \"327016\\n\", \"6\\n6\\n\", \"150\\n\", \"2\\n\", \"2000000001\\n2000001100\\n2001000001\\n2101000010\\n83949\\n\", \"455466\\n\", \"7\\n6\\n\", \"159\\n\", \"2000000001\\n2000001100\\n2001000001\\n2101010010\\n83949\\n\", \"687899\\n\", \"4\\n6\\n\", \"176\\n\", \"2000000001\\n2000001100\\n2001000001\\n2101010011\\n83949\\n\", \"690369\\n\", \"4\\n2\\n\", \"175\\n\", \"2000000001\\n2000001100\\n2001000001\\n2101010011\\n127268\\n\", \"690370\\n\", \"8\\n2\\n\", \"2000000001\\n2001001100\\n2001000001\\n2101010011\\n127268\\n\", \"708079\\n\", \"7\\n2\\n\", \"194\\n\", \"2000000001\\n2001001099\\n2001000001\\n2101010011\\n127268\\n\", \"708078\\n\", \"7\\n1\\n\", \"195\\n\", \"2000000001\\n2001001099\\n2001000001\\n2101010011\\n120141\\n\", \"1332319\\n\", \"8\\n1\\n\", \"116\\n\", \"2000000001\\n2001000099\\n2001000001\\n2101010011\\n120141\\n\", \"2399561\\n\", \"8\\n0\\n\", \"145\\n\", \"2000000001\\n2001000099\\n2001000001\\n2101010011\\n120140\\n\", \"2407252\\n\", \"4\\n\", \"5\\n\", \"5\\n\", \"1\\n5\\n\", \"4\\n\", \"1\\n5\\n\", \"1\\n\", \"4\\n\", \"4\\n\", \"4\\n\", \"1\\n\", \"2\\n\", \"176\\n\", \"5\\n\", \"4\\n\", \"1\\n\", \"2\\n\", \"4\\n\", \"1\\n4\\n\"]}", "source": "primeintellect"}
Wabbit is trying to move a box containing food for the rest of the zoo in the coordinate plane from the point $(x_1,y_1)$ to the point $(x_2,y_2)$. He has a rope, which he can use to pull the box. He can only pull the box if he stands exactly $1$ unit away from the box in the direction of one of two coordinate axes. He will pull the box to where he is standing before moving out of the way in the same direction by $1$ unit. [Image] For example, if the box is at the point $(1,2)$ and Wabbit is standing at the point $(2,2)$, he can pull the box right by $1$ unit, with the box ending up at the point $(2,2)$ and Wabbit ending at the point $(3,2)$. Also, Wabbit can move $1$ unit to the right, left, up, or down without pulling the box. In this case, it is not necessary for him to be in exactly $1$ unit away from the box. If he wants to pull the box again, he must return to a point next to the box. Also, Wabbit can't move to the point where the box is located. Wabbit can start at any point. It takes $1$ second to travel $1$ unit right, left, up, or down, regardless of whether he pulls the box while moving. Determine the minimum amount of time he needs to move the box from $(x_1,y_1)$ to $(x_2,y_2)$. Note that the point where Wabbit ends up at does not matter. -----Input----- Each test contains multiple test cases. The first line contains a single integer $t$ $(1 \leq t \leq 1000)$: the number of test cases. The description of the test cases follows. Each of the next $t$ lines contains four space-separated integers $x_1, y_1, x_2, y_2$ $(1 \leq x_1, y_1, x_2, y_2 \leq 10^9)$, describing the next test case. -----Output----- For each test case, print a single integer: the minimum time in seconds Wabbit needs to bring the box from $(x_1,y_1)$ to $(x_2,y_2)$. -----Example----- Input 2 1 2 2 2 1 1 2 2 Output 1 4 -----Note----- In the first test case, the starting and the ending points of the box are $(1,2)$ and $(2,2)$ respectively. This is the same as the picture in the statement. Wabbit needs only $1$ second to move as shown in the picture in the statement. In the second test case, Wabbit can start at the point $(2,1)$. He pulls the box to $(2,1)$ while moving to $(3,1)$. He then moves to $(3,2)$ and then to $(2,2)$ without pulling the box. Then, he pulls the box to $(2,2)$ while moving to $(2,3)$. It takes $4$ seconds. Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [\"1\\n100000\\n\", \"3\\n0 0 3\\n\", \"1\\n100010\\n\", \"5\\n0 11 1 13 14\\n\", \"5\\n0 12 1 13 14\\n\", \"3\\n0 3 3\\n\", \"3\\n0 1 2\\n\", \"4\\n2 1 0 1\\n\", \"4\\n0 6 0 6\\n\", \"4\\n4 0 0 0\\n\", \"5\\n1 3 0 13 48\\n\", \"5\\n0 1 3 3 13\\n\", \"3\\n0 2 3\\n\", \"4\\n0 6 0 4\\n\", \"1\\n000010\\n\", \"4\\n0 6 1 4\\n\", \"1\\n010010\\n\", \"5\\n0 12 2 13 14\\n\", \"3\\n1 3 3\\n\", \"4\\n-1 6 1 4\\n\", \"1\\n010011\\n\", \"5\\n0 20 2 13 14\\n\", \"3\\n0 3 1\\n\", \"4\\n-1 6 0 4\\n\", \"1\\n010110\\n\", \"5\\n0 20 2 13 11\\n\", \"3\\n0 3 2\\n\", \"4\\n1 6 0 4\\n\", \"1\\n010000\\n\", \"5\\n0 23 2 13 11\\n\", \"4\\n1 1 0 4\\n\", \"1\\n010001\\n\", \"5\\n0 10 2 13 11\\n\", \"3\\n0 1 1\\n\", \"4\\n1 1 0 1\\n\", \"1\\n110000\\n\", \"5\\n1 10 2 13 11\\n\", \"3\\n0 0 1\\n\", \"1\\n110010\\n\", \"5\\n1 10 2 13 13\\n\", \"3\\n0 0 2\\n\", \"4\\n2 2 0 1\\n\", \"1\\n111010\\n\", \"5\\n1 10 2 13 26\\n\", \"4\\n4 2 0 1\\n\", \"1\\n111011\\n\", \"5\\n1 18 2 13 26\\n\", \"4\\n3 2 0 1\\n\", \"1\\n011011\\n\", \"5\\n1 25 2 13 26\\n\", \"4\\n3 1 0 1\\n\", \"1\\n011001\\n\", \"5\\n1 25 2 23 26\\n\", \"4\\n3 0 0 1\\n\", \"1\\n001001\\n\", \"5\\n1 25 2 17 26\\n\", \"4\\n3 0 -1 1\\n\", \"1\\n011101\\n\", \"5\\n2 25 2 17 26\\n\", \"1\\n010101\\n\", \"5\\n2 25 2 17 48\\n\", \"1\\n000101\\n\", \"5\\n0 25 2 17 48\\n\", \"1\\n000111\\n\", \"5\\n0 25 2 34 48\\n\", \"1\\n100111\\n\", \"5\\n0 6 2 34 48\\n\", \"1\\n100011\\n\", \"5\\n0 6 2 17 48\\n\", \"1\\n110111\\n\", \"5\\n0 6 2 17 37\\n\", \"1\\n110011\\n\", \"5\\n0 6 2 17 16\\n\", \"1\\n011111\\n\", \"5\\n0 6 1 17 16\\n\", \"1\\n010111\\n\", \"5\\n0 6 1 27 16\\n\", \"1\\n110101\\n\", \"5\\n0 0 1 27 16\\n\", \"1\\n100101\\n\", \"5\\n0 1 1 27 16\\n\", \"1\\n101101\\n\", \"5\\n0 1 1 5 16\\n\", \"1\\n001101\\n\", \"5\\n0 1 1 5 9\\n\", \"1\\n001111\\n\", \"5\\n0 1 1 5 17\\n\", \"1\\n101111\\n\", \"5\\n0 1 1 4 17\\n\", \"1\\n001110\\n\", \"5\\n-1 1 1 4 17\\n\", \"1\\n001100\\n\", \"5\\n-1 2 1 4 17\\n\", \"1\\n011110\\n\", \"5\\n-2 2 1 4 17\\n\", \"1\\n011010\\n\", \"5\\n-2 2 1 4 3\\n\", \"1\\n000110\\n\", \"5\\n-2 2 1 2 3\\n\", \"1\\n000001\\n\", \"5\\n-2 2 2 2 3\\n\", \"1\\n000000\\n\", \"1\\n100001\\n\", \"1\\n110001\\n\", \"1\\n101110\\n\", \"1\\n111101\\n\", \"1\\n111001\\n\", \"1\\n111111\\n\", \"1\\n001011\\n\", \"1\\n001000\\n\", \"1\\n001010\\n\", \"1\\n000100\\n\", \"1\\n010100\\n\", \"1\\n011100\\n\", \"1\\n100100\\n\", \"1\\n101010\\n\", \"1\\n101000\\n\", \"1\\n111000\\n\", \"1\\n101100\\n\", \"1\\n111100\\n\", \"1\\n110100\\n\", \"1\\n101001\\n\", \"1\\n111110\\n\", \"1\\n101011\\n\", \"1\\n011000\\n\", \"1\\n000011\\n\", \"1\\n100110\\n\", \"1\\n110110\\n\", \"3\\n1 0 3\\n\", \"5\\n0 11 14 13 14\\n\", \"3\\n1 4 3\\n\", \"4\\n0 4 0 6\\n\", \"5\\n0 11 1 25 14\\n\", \"3\\n0 2 4\\n\", \"4\\n0 2 1 4\\n\", \"5\\n0 0 1 13 14\\n\", \"3\\n1 3 4\\n\", \"4\\n0 9 1 4\\n\", \"5\\n0 12 2 5 14\\n\", \"3\\n2 3 3\\n\", \"4\\n-1 6 1 1\\n\", \"5\\n-1 20 2 13 14\\n\", \"3\\n0 2 1\\n\", \"4\\n-1 7 0 4\\n\", \"5\\n0 33 2 13 11\\n\", \"3\\n0 3 0\\n\", \"4\\n1 12 0 4\\n\", \"5\\n0 4 2 13 11\\n\", \"3\\n0 2 2\\n\", \"4\\n1 0 0 4\\n\", \"5\\n0 10 2 17 11\\n\", \"3\\n0 1 3\\n\", \"4\\n0 1 0 1\\n\", \"5\\n1 10 2 13 15\\n\", \"4\\n1 2 0 1\\n\", \"5\\n1 3 2 13 13\\n\", \"3\\n-1 0 2\\n\", \"4\\n2 2 0 2\\n\", \"5\\n1 3 2 13 26\\n\", \"4\\n4 2 -1 1\\n\", \"5\\n2 18 2 13 26\\n\", \"4\\n3 2 -1 1\\n\", \"5\\n1 33 2 13 26\\n\", \"4\\n1 1 0 0\\n\", \"5\\n1 25 2 23 38\\n\", \"4\\n6 0 0 1\\n\", \"5\\n1 0 2 17 26\\n\", \"4\\n3 0 0 2\\n\", \"5\\n2 25 4 17 26\\n\", \"5\\n2 25 2 17 71\\n\", \"5\\n0 25 2 17 70\\n\", \"5\\n1 25 2 34 48\\n\", \"5\\n0 6 2 17 8\\n\", \"5\\n0 2 2 17 37\\n\", \"5\\n0 11 2 17 16\\n\", \"5\\n0 0 1 17 16\\n\", \"5\\n0 6 1 41 16\\n\", \"5\\n0 0 0 27 16\\n\", \"5\\n0 1 1 12 16\\n\", \"5\\n0 1 1 5 22\\n\", \"5\\n0 1 0 5 9\\n\", \"5\\n0 1 0 5 17\\n\", \"5\\n0 1 1 3 17\\n\", \"5\\n-1 1 1 3 17\\n\", \"5\\n-4 2 1 4 3\\n\", \"5\\n-2 2 1 2 0\\n\", \"5\\n-2 2 2 3 3\\n\", \"3\\n1 1 3\\n\", \"5\\n0 11 14 13 5\\n\", \"3\\n0 4 3\\n\", \"5\\n0 11 1 25 13\\n\", \"3\\n0 1 4\\n\", \"4\\n1 2 1 4\\n\", \"5\\n0 0 1 13 22\\n\", \"3\\n2 3 4\\n\", \"4\\n0 9 0 4\\n\", \"5\\n0 12 2 5 10\\n\", \"3\\n2 3 2\\n\", \"4\\n-1 6 1 0\\n\", \"5\\n-1 9 2 13 14\\n\", \"3\\n0 0 0\\n\", \"4\\n-1 4 0 4\\n\", \"5\\n0 11 12 13 14\\n\", \"3\\n1 2 3\\n\", \"4\\n0 4 0 4\\n\"], \"outputs\": [\"1\", \"3\", \"1\\n\", \"0\\n\", \"24\\n\", \"3\\n\", \"6\\n\", \"12\\n\", \"2\\n\", \"4\\n\", \"120\\n\", \"60\\n\", \"0\\n\", \"0\\n\", \"1\\n\", \"0\\n\", \"1\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"1\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"1\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"1\\n\", \"0\\n\", \"0\\n\", \"1\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"1\\n\", \"0\\n\", \"0\\n\", \"1\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"1\\n\", \"0\\n\", \"0\\n\", \"1\\n\", \"24\\n\", \"0\\n\", \"1\\n\", \"0\\n\", \"0\\n\", \"1\\n\", \"0\\n\", \"12\\n\", \"1\\n\", \"0\\n\", \"0\\n\", \"1\\n\", \"0\\n\", \"1\\n\", \"0\\n\", \"1\\n\", \"0\\n\", \"1\\n\", \"0\\n\", \"1\\n\", \"24\\n\", \"1\\n\", \"0\\n\", \"1\\n\", \"0\\n\", \"1\\n\", \"0\\n\", \"1\\n\", \"24\\n\", \"1\\n\", \"24\\n\", \"1\\n\", \"0\\n\", \"1\\n\", \"12\\n\", \"1\\n\", \"0\\n\", \"1\\n\", \"0\\n\", \"1\\n\", \"0\\n\", \"1\\n\", \"0\\n\", \"1\\n\", \"0\\n\", \"1\\n\", \"0\\n\", \"1\\n\", \"0\\n\", \"1\\n\", \"0\\n\", \"1\\n\", \"0\\n\", \"1\\n\", \"0\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"6\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"6\\n\", \"0\\n\", \"0\\n\", \"3\\n\", \"0\\n\", \"24\\n\", \"0\\n\", \"0\\n\", \"24\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"12\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"24\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"24\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"24\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"12\\n\", \"0\\n\", \"12\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"24\\n\", \"0\\n\", \"12\\n\", \"0\\n\", \"6\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"1\\n\", \"0\\n\", \"\\n120\", \"\\n6\", \"\\n2\"]}", "source": "primeintellect"}
An array is called beautiful if all the elements in the array are equal. You can transform an array using the following steps any number of times: 1. Choose two indices i and j (1 ≤ i,j ≤ n), and an integer x (1 ≤ x ≤ a_i). Let i be the source index and j be the sink index. 2. Decrease the i-th element by x, and increase the j-th element by x. The resulting values at i-th and j-th index are a_i-x and a_j+x respectively. 3. The cost of this operation is x ⋅ |j-i| . 4. Now the i-th index can no longer be the sink and the j-th index can no longer be the source. The total cost of a transformation is the sum of all the costs in step 3. For example, array [0, 2, 3, 3] can be transformed into a beautiful array [2, 2, 2, 2] with total cost 1 ⋅ |1-3| + 1 ⋅ |1-4| = 5. An array is called balanced, if it can be transformed into a beautiful array, and the cost of such transformation is uniquely defined. In other words, the minimum cost of transformation into a beautiful array equals the maximum cost. You are given an array a_1, a_2, …, a_n of length n, consisting of non-negative integers. Your task is to find the number of balanced arrays which are permutations of the given array. Two arrays are considered different, if elements at some position differ. Since the answer can be large, output it modulo 10^9 + 7. Input The first line contains a single integer n (1 ≤ n ≤ 10^5) — the size of the array. The second line contains n integers a_1, a_2, …, a_n (0 ≤ a_i ≤ 10^9). Output Output a single integer — the number of balanced permutations modulo 10^9+7. Examples Input 3 1 2 3 Output 6 Input 4 0 4 0 4 Output 2 Input 5 0 11 12 13 14 Output 120 Note In the first example, [1, 2, 3] is a valid permutation as we can consider the index with value 3 as the source and index with value 1 as the sink. Thus, after conversion we get a beautiful array [2, 2, 2], and the total cost would be 2. We can show that this is the only transformation of this array that leads to a beautiful array. Similarly, we can check for other permutations too. In the second example, [0, 0, 4, 4] and [4, 4, 0, 0] are balanced permutations. In the third example, all permutations are balanced. Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [[[12, 10, 8, 12, 7, 6, 4, 10, 12]], [[12, 10, 8, 12, 7, 6, 4, 10, 10]], [[12, 10, 8, 12, 7, 6, 4, 10, 12, 10]], [[12, 10, 8, 8, 3, 3, 3, 3, 2, 4, 10, 12, 10]], [[1, 2, 3]], [[1, 1, 2, 3]], [[1, 1, 2, 2, 3]]], \"outputs\": [[12], [10], [12], [3], [3], [1], [2]]}", "source": "primeintellect"}
Complete the method which returns the number which is most frequent in the given input array. If there is a tie for most frequent number, return the largest number among them. Note: no empty arrays will be given. ## Examples ``` [12, 10, 8, 12, 7, 6, 4, 10, 12] --> 12 [12, 10, 8, 12, 7, 6, 4, 10, 12, 10] --> 12 [12, 10, 8, 8, 3, 3, 3, 3, 2, 4, 10, 12, 10] --> 3 ``` Write your solution by modifying this code: ```python def highest_rank(arr): ``` Your solution should implemented in the function "highest_rank". The i Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [\"4\\n1 1\\n2 2\\n3 2\\n4 3\\n\", \"4\\n1 1\\n3 2\\n3 2\\n4 3\\n\", \"4\\n1 1\\n3 2\\n3 2\\n5 3\\n\", \"4\\n1 1\\n2 2\\n3 3\\n4 3\\n\", \"4\\n1 1\\n3 2\\n3 2\\n3 3\\n\", \"4\\n1 1\\n3 2\\n3 2\\n5 5\\n\", \"4\\n1 1\\n2 2\\n5 3\\n4 3\\n\", \"4\\n1 1\\n3 2\\n2 2\\n3 3\\n\", \"4\\n1 1\\n2 2\\n5 3\\n5 3\\n\", \"4\\n1 1\\n2 2\\n5 5\\n4 3\\n\", \"4\\n1 1\\n3 2\\n3 3\\n4 3\\n\", \"4\\n1 1\\n2 2\\n5 5\\n3 3\\n\", \"4\\n1 1\\n2 2\\n5 3\\n3 3\\n\", \"4\\n1 1\\n2 2\\n5 5\\n4 4\\n\", \"4\\n1 1\\n3 2\\n5 3\\n4 3\\n\", \"4\\n1 1\\n2 2\\n3 2\\n5 5\\n\", \"4\\n1 1\\n2 2\\n4 3\\n5 3\\n\", \"4\\n1 1\\n2 2\\n5 4\\n5 3\\n\", \"4\\n1 1\\n2 2\\n7 5\\n3 3\\n\", \"4\\n1 1\\n2 2\\n3 2\\n4 4\\n\", \"4\\n1 1\\n3 2\\n2 2\\n3 2\\n\", \"4\\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\"1\\n2 1\\n1 2 3 5 4\\n1 2 3 4\\n\", \"1\\n1 2\\n1 2 3 4\\n1 2 3 4\\n\", \"1\\n2 1\\n1 2 4 3\\n1 2 3 4 5\\n\", \"1\\n1 2\\n1 2 3\\n1 4 3 2\\n\", \"1\\n2 1\\n1 2\\n1 2 4 3\\n\", \"1\\n1 3 2\\n1 2 3 4\\n3 2 1\\n\", \"1\\n2 1\\n3 2 1\\n1 2 3 4 5\\n\", \"1\\n1 4 3 2\\n2 1\\n1 3 2\\n\", \"1\\n1 2 3\\n1 3 2\\n1 4 3 2\\n\", \"1 2\\n2 1\\n1 2 3 4 5\\n2 1\\n\", \"1\\n1 2 3\\n1 2 3 4 5\\n1 3 2\\n\", \"1\\n1 2\\n1 2 3 4\\n1 2 3\\n\", \"1\\n1 3 2\\n4 3 2 1\\n3 2 1\\n\", \"1 2\\n2 1\\n5 4 3 2 1\\n2 1\\n\", \"\\n1 \\n1 2 \\n2 1 \\n1 3 2 \\n\"]}", "source": "primeintellect"}
You have a sequence $a$ with $n$ elements $1, 2, 3, \dots, k - 1, k, k - 1, k - 2, \dots, k - (n - k)$ ($k \le n < 2k$). Let's call as inversion in $a$ a pair of indices $i < j$ such that $a[i] > a[j]$. Suppose, you have some permutation $p$ of size $k$ and you build a sequence $b$ of size $n$ in the following manner: $b[i] = p[a[i]]$. Your goal is to find such permutation $p$ that the total number of inversions in $b$ doesn't exceed the total number of inversions in $a$, and $b$ is lexicographically maximum. Small reminder: the sequence of $k$ integers is called a permutation if it contains all integers from $1$ to $k$ exactly once. Another small reminder: a sequence $s$ is lexicographically smaller than another sequence $t$, if either $s$ is a prefix of $t$, or for the first $i$ such that $s_i \ne t_i$, $s_i < t_i$ holds (in the first position that these sequences are different, $s$ has smaller number than $t$). -----Input----- The first line contains a single integer $t$ ($1 \le t \le 1000$) — the number of test cases. The first and only line of each test case contains two integers $n$ and $k$ ($k \le n < 2k$; $1 \le k \le 10^5$) — the length of the sequence $a$ and its maximum. It's guaranteed that the total sum of $k$ over test cases doesn't exceed $10^5$. -----Output----- For each test case, print $k$ integers — the permutation $p$ which maximizes $b$ lexicographically without increasing the total number of inversions. It can be proven that $p$ exists and is unique. -----Examples----- Input 4 1 1 2 2 3 2 4 3 Output 1 1 2 2 1 1 3 2 -----Note----- In the first test case, the sequence $a = [1]$, there is only one permutation $p = [1]$. In the second test case, the sequence $a = [1, 2]$. There is no inversion in $a$, so there is only one permutation $p = [1, 2]$ which doesn't increase the number of inversions. In the third test case, $a = [1, 2, 1]$ and has $1$ inversion. If we use $p = [2, 1]$, then $b = [p[a[1]], p[a[2]], p[a[3]]] = [2, 1, 2]$ and also has $1$ inversion. In the fourth test case, $a = [1, 2, 3, 2]$, and since $p = [1, 3, 2]$ then $b = [1, 3, 2, 3]$. Both $a$ and $b$ have $1$ inversion and $b$ is the lexicographically maximum. Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0.125
{"tests": "{\"inputs\": [\"2 2\\nTG\\nAC\\n\", \"2 2\\nAG\\nTC\\n\", \"2 2\\nGA\\nTC\\n\", \"3 5\\nGACGA\\nAGCAG\\nAGCAG\\n\", \"2 2\\nTG\\nCA\\n\", \"2 2\\nGA\\nCT\\n\", \"2 2\\nGT\\nAC\\n\", \"2 2\\nGT\\nCA\\n\", \"3 5\\nAGGAC\\nGACGA\\nGACGA\\n\", \"3 5\\nAGCAG\\nAGCAG\\nGACGA\\n\", \"2 2\\nG@\\nCT\\n\", \"2 2\\nG?\\nCT\\n\", \"2 2\\nGB\\nCT\\n\", \"3 5\\nAGCAG\\nGACGA\\nGACGA\\n\", \"3 5\\nGGCAA\\nGACGA\\nGACGA\\n\", \"3 5\\nAGCAG\\nAGCAG\\nAGCGA\\n\", \"3 5\\nAGCAG\\nAGCAF\\nAGCGA\\n\", \"3 5\\nAGCAG\\nAFCAF\\nAGCGA\\n\", \"3 5\\nGACGA\\nAGCAF\\nAGCGA\\n\", \"3 5\\nGACGA\\nGACGA\\nAGCAG\\n\", \"3 5\\nGGCAA\\nGACGA\\nAGCGA\\n\", \"3 5\\nAGCAF\\nAGCAF\\nAGCGA\\n\", \"3 5\\nAGCAG\\nAGC@G\\nGACGA\\n\", \"3 5\\nAGGAC\\nGACGA\\nGACGB\\n\", \"3 5\\nGGCAA\\nGACFA\\nAGCGA\\n\", \"2 2\\nAG\\nCT\\n\", \"3 5\\nAGCAG\\nAGCAG\\nAGCAG\\n\"], \"outputs\": [\"TG\\nAC\\n\", \"AG\\nTC\\n\", \"GA\\nTC\\n\", \"AGCGA\\nCTATC\\nAGCGA\\n\", \"TG\\nCA\\n\", \"GA\\nCT\\n\", \"GT\\nAC\\n\", \"GT\\nCA\\n\", \"AGAGC\\nCTCTA\\nAGAGC\\n\", \"AGCGA\\nCTATC\\nAGCGA\\n\", \"GA\\nCT\\n\", \"GA\\nCT\\n\", \"GA\\nCT\\n\", \"AGCGA\\nCTATC\\nAGCGA\\n\", \"AGCGA\\nCTATC\\nAGCGA\\n\", \"AGCGA\\nCTATC\\nAGCGA\\n\", \"AGCGA\\nCTATC\\nAGCGA\\n\", \"AGCGA\\nCTATC\\nAGCGA\\n\", \"AGCGA\\nCTATC\\nAGCGA\\n\", \"AGCGA\\nCTATC\\nAGCGA\\n\", \"AGCGA\\nCTATC\\nAGCGA\\n\", \"AGCGA\\nCTATC\\nAGCGA\\n\", \"AGCGA\\nCTATC\\nAGCGA\\n\", \"AGAGC\\nCTCTA\\nAGAGC\\n\", \"AGCGA\\nCTATC\\nAGCGA\\n\", \"AG\\nCT\\n\", \"AGCTC\\nCTAGA\\nAGCTC\\n\"]}", "source": "primeintellect"}
You are given an n × m table, consisting of characters «A», «G», «C», «T». Let's call a table nice, if every 2 × 2 square contains all four distinct characters. Your task is to find a nice table (also consisting of «A», «G», «C», «T»), that differs from the given table in the minimum number of characters. Input First line contains two positive integers n and m — number of rows and columns in the table you are given (2 ≤ n, m, n × m ≤ 300 000). Then, n lines describing the table follow. Each line contains exactly m characters «A», «G», «C», «T». Output Output n lines, m characters each. This table must be nice and differ from the input table in the minimum number of characters. Examples Input 2 2 AG CT Output AG CT Input 3 5 AGCAG AGCAG AGCAG Output TGCAT CATGC TGCAT Note In the first sample, the table is already nice. In the second sample, you can change 9 elements to make the table nice. Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [\"3 2\\n1 2 5\", \"3 1\\n3 2 1\", \"0 3\\n2 3 1\", \"0 4\\n2 3 1\", \"0 3\\n3 3 1\", \"3 2\\n2 2 3\", \"3 2\\n2 2 5\", \"0 3\\n4 3 1\", \"0 4\\n3 3 1\", \"0 3\\n3 0 1\", \"0 2\\n2 2 3\", \"0 2\\n4 3 1\", \"0 3\\n3 1 1\", \"0 2\\n2 4 3\", \"0 2\\n6 3 1\", \"0 3\\n3 2 1\", \"0 2\\n3 4 3\", \"0 2\\n6 6 1\", \"0 3\\n4 2 1\", \"1 2\\n3 4 3\", \"0 2\\n6 6 0\", \"0 5\\n4 2 1\", \"1 2\\n6 6 0\", \"0 5\\n4 1 1\", \"0 4\\n4 1 1\", \"0 2\\n4 1 1\", \"0 2\\n4 2 1\", \"1 2\\n4 2 1\", \"1 2\\n8 2 1\", \"1 2\\n8 1 1\", \"1 2\\n8 1 2\", \"1 0\\n8 1 2\", \"1 2\\n1 2 5\", \"1 4\\n2 3 1\", \"0 2\\n3 3 1\", \"3 2\\n2 2 2\", \"3 4\\n2 2 5\", \"0 3\\n3 5 1\", \"0 3\\n3 -1 1\", \"0 2\\n2 0 3\", \"0 2\\n4 4 1\", \"0 1\\n2 2 3\", \"0 2\\n6 3 2\", \"0 3\\n0 2 1\", \"0 2\\n3 4 5\", \"0 2\\n6 11 1\", \"0 3\\n5 2 1\", \"1 2\\n3 4 5\", \"1 2\\n3 6 0\", \"0 5\\n4 2 2\", \"0 5\\n4 0 1\", \"0 2\\n4 1 2\", \"1 2\\n8 2 2\", \"1 2\\n10 2 2\", \"1 4\\n2 0 1\", \"1 2\\n3 3 1\", \"3 8\\n2 2 5\", \"0 1\\n2 0 3\", \"0 2\\n4 4 2\", \"0 2\\n9 3 2\", \"0 3\\n0 2 0\", \"0 2\\n3 5 3\", \"0 2\\n6 7 1\", \"0 3\\n5 2 0\", \"0 2\\n3 6 0\", \"0 5\\n3 0 1\", \"0 2\\n2 1 2\", \"1 2\\n8 2 3\", \"0 2\\n10 2 2\", \"1 2\\n1 3 1\", \"0 2\\n2 -1 3\", \"0 2\\n9 5 2\", \"0 3\\n0 1 0\", \"0 3\\n3 5 3\", \"0 2\\n6 7 0\", \"0 3\\n7 2 0\", \"0 5\\n3 -1 1\", \"0 1\\n2 1 2\", \"1 2\\n6 2 3\", \"1 3\\n1 3 1\", \"0 2\\n16 5 2\", \"0 3\\n-1 1 0\", \"0 3\\n5 5 3\", \"0 2\\n6 7 -1\", \"0 3\\n7 0 0\", \"0 1\\n4 1 2\", \"1 2\\n6 3 3\", \"1 3\\n1 3 2\", \"0 2\\n16 5 1\", \"0 1\\n-1 1 0\", \"0 3\\n5 5 5\", \"0 2\\n6 7 -2\", \"0 3\\n5 0 0\", \"1 2\\n6 3 0\", \"1 3\\n1 3 3\", \"0 2\\n16 9 1\", \"0 1\\n0 1 0\", \"0 3\\n5 5 10\", \"0 3\\n6 7 -2\", \"0 3\\n5 -1 0\", \"3 2\\n1 2 3\", \"3 3\\n3 2 1\", \"3 3\\n2 3 1\"], \"outputs\": [\"Yes\\n\", \"No\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\", \"No\", \"Yes\"]}", "source": "primeintellect"}
Problem Given a permutation of length $ N $ $ P = \\ {P_1, P_2, \ ldots, P_N \\} $ and the integer $ K $. Determine if the permutation $ P $ can be monotonically increased by repeating the following operation any number of times $ 0 $ or more. * Choose the integer $ x \ (0 \ le x \ le N-K) $. Patrol right shift around $ P_ {x + 1}, \ ldots, P_ {x + K} $ However, the cyclic right shift of the subsequence $ U = U_1, \ ldots, U_M $ means that $ U = U_1, \ ldots, U_M $ is changed to $ U = U_M, U_1, \ ldots, U_ {M-1} $. Means to change. Constraints The input satisfies the following conditions. * $ 2 \ leq K \ leq N \ leq 10 ^ 5 $ * $ 1 \ leq P_i \ leq N \ (1 \ leq i \ leq N) $ * $ P_i \ neq P_j \ (i \ neq j) $ * All inputs are integers Input The input is given in the following format. $ N $ $ K $ $ P_1 $ $ \ ldots $ $ P_N $ Permutation length $ N $ and integer $ K $ are given in the first row, separated by blanks. The elements of the permutation $ P $ are given in the second row, separated by blanks. Output Print "Yes" if you can monotonically increase $ P $, otherwise print "No" on the $ 1 $ line. Examples Input 3 3 2 3 1 Output Yes Input 3 2 1 2 3 Output Yes Input 3 3 3 2 1 Output No Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0.125
{"tests": "{\"inputs\": [\"386 20 29 30\\n1 349\\n2 482\\n1 112\\n1 93\\n2 189\\n1 207\\n2 35\\n2 -5\\n1 422\\n1 442\\n1 402\\n2 238\\n3 258\\n3 54\\n2 369\\n2 290\\n2 329\\n3 74\\n3 -62\\n2 170\\n1 462\\n2 15\\n2 222\\n1 309\\n3 150\\n1 -25\\n3 130\\n1 271\\n1 -43\\n351 250 91 102 0 286 123 93 100 205 328 269 188 83 73 35 188 223 73 215 199 64 47 379 61 298 295 65 158 211\\n\", \"67 10 9 10\\n3 -1\\n1 59\\n1 39\\n1 -11\\n2 29\\n1 9\\n1 19\\n1 49\\n3 77\\n27 14 21 36 0 13 57 41 20 28\\n\", \"1000000000 1 1 1\\n3 775565805\\n0\\n\", \"18 9 2 1\\n2 9\\n1 12\\n0\\n\", \"216 15 19 10\\n2 -31\\n2 100\\n3 230\\n1 57\\n3 42\\n1 157\\n2 186\\n1 113\\n2 -16\\n3 245\\n2 142\\n1 86\\n2 -3\\n3 201\\n3 128\\n3 12\\n3 171\\n2 27\\n2 72\\n98 197 114 0 155 35 36 11 146 27\\n\", \"18 9 2 1\\n1 9\\n2 12\\n0\\n\", \"1000000000 2 5 5\\n2 118899563\\n2 -442439384\\n1 -961259426\\n2 -156596184\\n1 -809672605\\n249460520 -545686472 0 -653929719 905155526\\n\", \"9 3 2 1\\n2 3\\n1 6\\n0\\n\", \"67 10 9 10\\n3 -1\\n1 96\\n1 39\\n1 -11\\n2 29\\n1 9\\n1 19\\n1 49\\n3 77\\n27 14 21 36 0 13 57 41 20 28\\n\", \"18 0 2 1\\n2 9\\n1 12\\n0\\n\", \"216 15 19 10\\n2 -31\\n2 100\\n3 230\\n1 57\\n3 34\\n1 157\\n2 186\\n1 113\\n2 -16\\n3 245\\n2 142\\n1 86\\n2 -3\\n3 201\\n3 128\\n3 12\\n3 171\\n2 27\\n2 72\\n98 197 114 0 155 35 36 11 146 27\\n\", \"9 4 2 1\\n2 3\\n1 6\\n0\\n\", \"9 3 2 3\\n2 3\\n1 9\\n-1 0 1\\n\", \"20 9 2 4\\n1 5\\n2 14\\n-1 0 1 2\\n\", \"216 15 19 10\\n2 -31\\n2 100\\n3 230\\n1 57\\n3 34\\n1 157\\n2 186\\n1 113\\n2 -16\\n3 245\\n2 142\\n1 86\\n2 -3\\n3 201\\n3 128\\n3 12\\n3 171\\n2 27\\n2 72\\n98 197 114 0 155 35 66 11 146 27\\n\", \"20 9 2 4\\n1 5\\n2 14\\n-1 0 2 2\\n\", \"37 9 2 4\\n1 5\\n2 14\\n-1 0 2 2\\n\", \"92 10 9 10\\n3 -1\\n1 96\\n2 39\\n1 -11\\n2 2\\n1 9\\n1 19\\n2 49\\n3 50\\n27 14 21 36 1 13 57 3 14 30\\n\", \"67 10 9 10\\n3 -1\\n1 59\\n1 39\\n1 -11\\n2 29\\n1 9\\n1 19\\n1 49\\n3 77\\n27 14 21 40 0 13 57 41 20 28\\n\", \"29 9 2 1\\n1 9\\n2 12\\n0\\n\", \"67 10 9 10\\n3 -1\\n1 96\\n1 39\\n1 -11\\n2 29\\n1 9\\n1 19\\n1 49\\n3 77\\n27 14 21 36 1 13 57 41 20 28\\n\", \"29 9 2 1\\n1 9\\n2 18\\n0\\n\", \"9 4 2 1\\n2 6\\n1 6\\n0\\n\", \"9 3 2 3\\n2 3\\n1 9\\n0 0 1\\n\", \"67 10 9 10\\n3 -1\\n1 96\\n1 39\\n1 -11\\n2 29\\n1 9\\n1 19\\n1 49\\n3 77\\n27 14 21 36 1 13 57 3 20 28\\n\", \"216 15 19 10\\n2 -31\\n2 100\\n3 230\\n1 57\\n3 34\\n1 157\\n2 186\\n1 113\\n2 -16\\n3 245\\n2 142\\n1 86\\n2 -1\\n3 201\\n3 128\\n3 12\\n3 171\\n2 27\\n2 72\\n98 197 114 0 155 35 66 11 146 27\\n\", \"29 2 2 1\\n1 9\\n2 18\\n0\\n\", \"67 10 9 10\\n3 -1\\n1 96\\n1 39\\n1 -11\\n2 29\\n1 9\\n1 19\\n1 49\\n3 77\\n27 14 21 36 1 13 57 3 22 28\\n\", \"216 15 19 10\\n1 -31\\n2 100\\n3 230\\n1 57\\n3 34\\n1 157\\n2 186\\n1 113\\n2 -16\\n3 245\\n2 142\\n1 86\\n2 -1\\n3 201\\n3 128\\n3 12\\n3 171\\n2 27\\n2 72\\n98 197 114 0 155 35 66 11 146 27\\n\", \"29 2 2 1\\n2 9\\n2 18\\n0\\n\", \"37 9 2 4\\n1 5\\n2 14\\n-1 0 4 2\\n\", \"67 10 9 10\\n3 -1\\n1 96\\n1 39\\n1 -11\\n2 29\\n1 9\\n1 19\\n1 49\\n3 77\\n27 14 21 36 1 13 57 3 22 30\\n\", \"29 2 2 1\\n1 9\\n2 18\\n1\\n\", \"37 9 2 4\\n1 5\\n2 14\\n-1 0 0 2\\n\", \"67 10 9 10\\n3 -1\\n1 96\\n1 39\\n1 -11\\n2 41\\n1 9\\n1 19\\n1 49\\n3 77\\n27 14 21 36 1 13 57 3 22 30\\n\", \"29 2 2 1\\n2 9\\n2 18\\n1\\n\", \"37 9 2 4\\n1 5\\n2 14\\n-1 0 0 1\\n\", \"67 10 9 10\\n3 -1\\n1 96\\n1 39\\n1 -11\\n2 41\\n1 9\\n1 19\\n1 49\\n3 50\\n27 14 21 36 1 13 57 3 22 30\\n\", \"29 2 2 1\\n2 9\\n3 18\\n0\\n\", \"37 9 2 4\\n1 5\\n2 14\\n-1 -1 0 1\\n\", \"67 10 9 10\\n3 -1\\n1 96\\n1 39\\n1 -11\\n2 5\\n1 9\\n1 19\\n1 49\\n3 50\\n27 14 21 36 1 13 57 3 22 30\\n\", \"29 2 2 1\\n2 9\\n1 18\\n0\\n\", \"37 9 2 4\\n1 5\\n2 14\\n-2 -1 0 1\\n\", \"67 10 9 10\\n3 -1\\n1 96\\n1 39\\n1 -11\\n2 5\\n1 9\\n1 19\\n1 49\\n3 50\\n27 14 21 36 1 13 57 3 42 30\\n\", \"67 10 9 10\\n3 -1\\n1 96\\n1 39\\n1 -11\\n2 5\\n1 9\\n1 19\\n2 49\\n3 50\\n27 14 21 36 1 13 57 3 42 30\\n\", \"67 10 9 10\\n3 -1\\n1 96\\n2 39\\n1 -11\\n2 5\\n1 9\\n1 19\\n2 49\\n3 50\\n27 14 21 36 1 13 57 3 42 30\\n\", \"67 10 9 10\\n3 -1\\n1 96\\n2 39\\n1 -11\\n2 5\\n1 9\\n1 19\\n2 49\\n3 50\\n27 14 21 36 1 13 57 3 14 30\\n\", \"67 10 9 10\\n3 -1\\n1 96\\n2 39\\n1 -11\\n2 2\\n1 9\\n1 19\\n2 49\\n3 50\\n27 14 21 36 1 13 57 3 14 30\\n\", \"1000000000 2 1 1\\n3 775565805\\n0\\n\", \"9 3 2 3\\n2 3\\n1 6\\n-1 0 1\\n\", \"20 9 2 4\\n1 5\\n2 10\\n-1 0 1 2\\n\", \"8 4 1 1\\n2 4\\n0\\n\"], \"outputs\": [\"0 15\\n51 57\\n83 132\\n72 132\\n100 166\\n39 41\\n64 132\\n81 132\\n74 132\\n51 90\\n20 18\\n40 57\\n64 94\\n91 132\\n100 132\\n100 132\\n64 94\\n51 72\\n100 132\\n51 80\\n54 93\\n100 132\\n100 132\\n0 0\\n100 132\\n31 37\\n34 37\\n100 132\\n64 124\\n51 84\\n\", \"28 2\\n33 10\\n28 8\\n21 0\\n47 10\\n34 10\\n0 0\\n16 0\\n28 9\\n28 1\\n\", \"-1 -1\\n\", \"0 9\\n\", \"27 31\\n0 0\\n14 29\\n55 74\\n1 15\\n55 59\\n55 59\\n55 74\\n10 15\\n55 59\\n\", \"3 6\\n\", \"-1 -1\\n-1 -1\\n-1 -1\\n-1 -1\\n-1 -1\\n\", \"3 3\\n\", \"-1 -1\\n-1 -1\\n-1 -1\\n-1 -1\\n-1 -1\\n-1 -1\\n0 0\\n-1 -1\\n-1 -1\\n-1 -1\\n\", \"-1 -1\\n\", \"27 31\\n0 0\\n14 29\\n-1 -1\\n1 15\\n-1 -1\\n-1 -1\\n-1 -1\\n10 15\\n-1 -1\\n\", \"2 3\\n\", \"-1 -1\\n-1 -1\\n-1 -1\\n\", \"6 6\\n5 6\\n4 6\\n3 6\\n\", \"27 31\\n0 0\\n14 29\\n-1 -1\\n1 15\\n-1 -1\\n40 50\\n-1 -1\\n10 15\\n-1 -1\\n\", \"6 6\\n5 6\\n3 6\\n3 6\\n\", \"-1 -1\\n-1 -1\\n-1 -1\\n-1 -1\\n\", \"-1 -1\\n-1 -1\\n-1 -1\\n-1 -1\\n-1 -1\\n-1 -1\\n-1 -1\\n-1 -1\\n-1 -1\\n-1 -1\\n\", \"28 2\\n33 10\\n28 8\\n17 0\\n47 10\\n34 10\\n0 0\\n16 0\\n28 9\\n28 1\\n\", \"-1 -1\\n\", \"-1 -1\\n-1 -1\\n-1 -1\\n-1 -1\\n-1 -1\\n-1 -1\\n0 0\\n-1 -1\\n-1 -1\\n-1 -1\\n\", \"-1 -1\\n\", \"-1 -1\\n\", \"-1 -1\\n-1 -1\\n-1 -1\\n\", \"-1 -1\\n-1 -1\\n-1 -1\\n-1 -1\\n-1 -1\\n-1 -1\\n0 0\\n-1 -1\\n-1 -1\\n-1 -1\\n\", \"27 31\\n0 0\\n14 29\\n-1 -1\\n1 15\\n-1 -1\\n40 50\\n-1 -1\\n10 15\\n-1 -1\\n\",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 -1\\n0 0\\n-1 -1\\n-1 -1\\n-1 -1\\n\", \"-1 -1\\n-1 -1\\n-1 -1\\n-1 -1\\n-1 -1\\n-1 -1\\n0 0\\n-1 -1\\n-1 -1\\n-1 -1\\n\", \"-1 -1\\n\", \"-1 -1\\n3 3\\n3 2\\n\", \"-1 -1\\n-1 -1\\n-1 -1\\n-1 -1\\n\", \"0 4\\n\"]}", "source": "primeintellect"}
Motorist Kojiro spent 10 years saving up for his favorite car brand, Furrari. Finally Kojiro's dream came true! Kojiro now wants to get to his girlfriend Johanna to show off his car to her. Kojiro wants to get to his girlfriend, so he will go to her along a coordinate line. For simplicity, we can assume that Kojiro is at the point f of a coordinate line, and Johanna is at point e. Some points of the coordinate line have gas stations. Every gas station fills with only one type of fuel: Regular-92, Premium-95 or Super-98. Thus, each gas station is characterized by a pair of integers ti and xi — the number of the gas type and its position. One liter of fuel is enough to drive for exactly 1 km (this value does not depend on the type of fuel). Fuels of three types differ only in quality, according to the research, that affects the lifetime of the vehicle motor. A Furrari tank holds exactly s liters of fuel (regardless of the type of fuel). At the moment of departure from point f Kojiro's tank is completely filled with fuel Super-98. At each gas station Kojiro can fill the tank with any amount of fuel, but of course, at no point in time, the amount of fuel in the tank can be more than s liters. Note that the tank can simultaneously have different types of fuel. The car can moves both left and right. To extend the lifetime of the engine Kojiro seeks primarily to minimize the amount of fuel of type Regular-92. If there are several strategies to go from f to e, using the minimum amount of fuel of type Regular-92, it is necessary to travel so as to minimize the amount of used fuel of type Premium-95. Write a program that can for the m possible positions of the start fi minimize firstly, the amount of used fuel of type Regular-92 and secondly, the amount of used fuel of type Premium-95. Input The first line of the input contains four positive integers e, s, n, m (1 ≤ e, s ≤ 109, 1 ≤ n, m ≤ 2·105) — the coordinate of the point where Johanna is, the capacity of a Furrari tank, the number of gas stations and the number of starting points. Next n lines contain two integers each ti, xi (1 ≤ ti ≤ 3, - 109 ≤ xi ≤ 109), representing the type of the i-th gas station (1 represents Regular-92, 2 — Premium-95 and 3 — Super-98) and the position on a coordinate line of the i-th gas station. Gas stations don't necessarily follow in order from left to right. The last line contains m integers fi ( - 109 ≤ fi < e). Start positions don't necessarily follow in order from left to right. No point of the coordinate line contains more than one gas station. It is possible that some of points fi or point e coincide with a gas station. Output Print exactly m lines. The i-th of them should contain two integers — the minimum amount of gas of type Regular-92 and type Premium-95, if Kojiro starts at point fi. First you need to minimize the first value. If there are multiple ways to do it, you need to also minimize the second value. If there is no way to get to Johanna from point fi, the i-th line should look like that "-1 -1" (two numbers minus one without the quotes). Examples Input 8 4 1 1 2 4 0 Output 0 4 Input 9 3 2 3 2 3 1 6 -1 0 1 Output -1 -1 3 3 3 2 Input 20 9 2 4 1 5 2 10 -1 0 1 2 Output -1 -1 -1 -1 -1 -1 -1 -1 Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [[[\"American Redstart\", \"Northern Cardinal\", \"Pine Grosbeak\", \"Barred Owl\", \"Starling\", \"Cooper's Hawk\", \"Pigeon\"]], [[\"Great Crested Flycatcher\", \"Bobolink\", \"American White Pelican\", \"Red-Tailed Hawk\", \"Eastern Screech Owl\", \"Blue Jay\"]], [[\"Black-Crowned Night Heron\", \"Northern Mockingbird\", \"Eastern Meadowlark\", \"Dark-Eyed Junco\", \"Red-Bellied Woodpecker\"]], [[\"Scarlet Tanager\", \"Great Blue Heron\", \"Eastern Phoebe\", \"American Black Duck\", \"Mallard\", \"Canvasback\", \"Merlin\", \"Ovenbird\"]], [[\"Fox Sparrow\", \"White-Winged Crossbill\", \"Veery\", \"American Coot\", \"Sora\", \"Northern Rough-Winged Swallow\", \"Purple Martin\"]]], \"outputs\": [[[\"AMRE\", \"NOCA\", \"PIGR\", \"BAOW\", \"STAR\", \"COHA\", \"PIGE\"]], [[\"GCFL\", \"BOBO\", \"AWPE\", \"RTHA\", \"ESOW\", \"BLJA\"]], [[\"BCNH\", \"NOMO\", \"EAME\", \"DEJU\", \"RBWO\"]], [[\"SCTA\", \"GBHE\", \"EAPH\", \"ABDU\", \"MALL\", \"CANV\", \"MERL\", \"OVEN\"]], [[\"FOSP\", \"WWCR\", \"VEER\", \"AMCO\", \"SORA\", \"NRWS\", \"PUMA\"]]]}", "source": "primeintellect"}
In the world of birding there are four-letter codes for the common names of birds. These codes are created by some simple rules: * If the bird's name has only one word, the code takes the first four letters of that word. * If the name is made up of two words, the code takes the first two letters of each word. * If the name is made up of three words, the code is created by taking the first letter from the first two words and the first two letters from the third word. * If the name is four words long, the code uses the first letter from all the words. *(There are other ways that codes are created, but this Kata will only use the four rules listed above)* Complete the function that takes an array of strings of common bird names from North America, and create the codes for those names based on the rules above. The function should return an array of the codes in the same order in which the input names were presented. Additional considertations: * The four-letter codes in the returned array should be in UPPER CASE. * If a common name has a hyphen/dash, it should be considered a space. ## Example If the input array is: `["Black-Capped Chickadee", "Common Tern"]` The return array would be: `["BCCH", "COTE"]` Write your solution by modifying this code: ```python def bird_code(arr): ``` Your solution should implemented in the function "bird_code". The i Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [[\"abc\", \"z\"], [\"\", \"z\"], [\"abc\", \"\"], [\"_3ebzgh4\", \"&\"], [\"//case\", \" \"]], \"outputs\": [[\"zzz\"], [\"\"], [\"\"], [\"&&&&&&&&\"], [\" \"]]}", "source": "primeintellect"}
An AI has infected a text with a character!! This text is now **fully mutated** to this character. If the text or the character are empty, return an empty string. There will never be a case when both are empty as nothing is going on!! **Note:** The character is a string of length 1 or an empty string. # Example ```python text before = "abc" character = "z" text after = "zzz" ``` Write your solution by modifying this code: ```python def contamination(text, char): ``` Your solution should implemented in the function "contamination". The i Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [\"2\\naa\\na\\n\", \"5\\naaaaa\\naaaa\\naaa\\naa\\na\\n\", \"2\\nanud\\nanu\\n\", \"4\\nax\\nay\\nby\\nbz\\n\", \"1\\nzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\\n\", \"6\\nax\\nay\\nby\\nbz\\ncz\\ncx\\n\", \"4\\nax\\nay\\nby\\nbx\\n\", \"1\\na\\n\", \"8\\nwa\\nwb\\nxc\\nxd\\nyb\\nyc\\nzd\\nza\\n\", \"2\\na\\naa\\n\", \"2\\nba\\na\\n\", \"5\\naaaaa\\naaaa\\naaa\\naa\\nb\\n\", \"2\\nanud\\namu\\n\", \"4\\nax\\nay\\nyb\\nbz\\n\", \"1\\nzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz{z\\n\", \"4\\nxa\\nay\\nby\\nbx\\n\", \"8\\nwa\\nwb\\nxc\\nxd\\nby\\nyc\\nzd\\nza\\n\", \"10\\npetr\\negor\\nendagorion\\nfeferivan\\nilovetanyaromanova\\nkoatks\\ndmitriyh\\nmaratsnowbear\\nbredorjaguarturnik\\ncgyforever\\n\", \"3\\nrivest\\nshamir\\nadkeman\\n\", \"7\\ncar\\ncare\\ncareful\\ncarefully\\nbecarefuldontforgetsomething\\nltherwiseyouwiolbehacked\\ngoodluck\\n\", \"2\\namud\\namv\\n\", \"10\\npetr\\negor\\nendagorion\\nfeferivan\\nilovetanyaromanova\\nkoatks\\ndmitriyh\\nmaratsnowbear\\nbredorjaguarturnik\\nbfyforever\\n\", \"7\\ncar\\ncare\\ncareful\\nylluferac\\nbecarefuldontforhetsometging\\nltherwiseyouwiolbehacked\\ngoodluck\\n\", \"10\\npetr\\negor\\nnoirogadne\\nfeferivan\\nilovetanyaromanova\\nkoatks\\ndmitriyh\\nmaratsnowbear\\nbredorjaguarturnik\\nbfzfnrrvee\\n\", \"1\\nb\\n\", \"2\\na\\nab\\n\", \"10\\ntourist\\npetr\\nrmbzmjw\\nyeputons\\nvepifanov\\nscottwu\\noooooooooooooooo\\nsubscriber\\nrowdark\\ntankengineer\\n\", \"5\\naaaaa\\nbaaa\\naaa\\naa\\nb\\n\", \"2\\namud\\namu\\n\", \"4\\nax\\nya\\nyb\\nbz\\n\", \"1\\nz{zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\\n\", \"1\\nc\\n\", \"10\\npetr\\negor\\nendagorion\\nfeferivan\\nilovetanyaromanova\\nkoatks\\ndmitriyh\\nmaratsnowbear\\nbredorjaguarturnik\\ncfyforever\\n\", \"3\\nrivest\\nshamir\\nadjeman\\n\", \"10\\ntourist\\npetr\\nrmbzmjw\\nyeputons\\nvepifanov\\nscottwu\\noooooooooooooooo\\nsubscriber\\nkradwor\\ntankengineer\\n\", \"7\\ncar\\ncare\\ncareful\\ncarefully\\nbecarefuldontforhetsometging\\nltherwiseyouwiolbehacked\\ngoodluck\\n\", \"5\\naaaaa\\naaab\\naaa\\naa\\nb\\n\", \"1\\nz{zzzzzzzzzzzzzzzzzzzzzzzzzyzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\\n\", \"1\\n`\\n\", \"3\\nrivest\\nshamir\\nadmejan\\n\", \"10\\ntourist\\npetr\\nrmbzmjw\\nyeputons\\nvepifanov\\nscottwu\\noooooooooooooooo\\nsubscriber\\nkradwor\\ntankemgineer\\n\", \"5\\naaaaa\\naaaa\\naaa\\n`a\\na\\n\", \"1\\nzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzyzzzzzzzzzzzzzzzzzzzzzzzzz{z\\n\", \"1\\nd\\n\", \"10\\npetr\\negor\\nendagorion\\nfeferivan\\nilovetanyaromanova\\nkoatks\\ndmitriyh\\nmaratsnowbear\\nbredorjaguarturnik\\nbfyfnrever\\n\", \"3\\nrivest\\nshamir\\nadmej`n\\n\", \"10\\ntsiruot\\npetr\\nrmbzmjw\\nyeputons\\nvepifanov\\nscottwu\\noooooooooooooooo\\nsubscriber\\nkradwor\\ntankemgineer\\n\", \"7\\ncar\\ncare\\ncareful\\nyllugerac\\nbecarefuldontforhetsometging\\nltherwiseyouwiolbehacked\\ngoodluck\\n\", \"5\\naaaaa\\naaaa\\naaa\\na`\\na\\n\", \"1\\nzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzy{zzzzzzzzzzzzzzzzzzzzzzzz{z\\n\", \"1\\ne\\n\", \"10\\npetr\\negor\\nendagorion\\nfeferivan\\nilovetanyaromanova\\nkoatks\\ndmitriyh\\nmaratsnowbear\\nbredorjaguarturnik\\nbfyfnrrvee\\n\", \"3\\neivrst\\nshamir\\nadmej`n\\n\", \"10\\ntsiruot\\npetr\\nrmbzmjw\\nyeoutons\\nvepifanov\\nscottwu\\noooooooooooooooo\\nsubscriber\\nkradwor\\ntankemgineer\\n\", \"7\\ncar\\ncare\\nbareful\\nyllugerac\\nbecarefuldontforhetsometging\\nltherwiseyouwiolbehacked\\ngoodluck\\n\", \"5\\naaaaa\\naaaa\\naaa\\na`\\n`\\n\", \"1\\nz{zzzzzzzzzzzzzzzzzzzzzzzz{yzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\\n\", \"1\\nf\\n\", \"10\\npetr\\negor\\nendagorion\\nfeferivan\\nilovetanyaromanova\\nkoatks\\ndmitriyh\\nmaratsnowbear\\nbredorjaguarturnik\\nbfzfnrrvee\\n\", \"3\\neivrst\\nshamis\\nadmej`n\\n\", \"10\\ntsiruot\\npetr\\nrmbzmjw\\nyeoutons\\nvepifanov\\nscottwu\\noooooooooooooooo\\nsubscriber\\nkradwor\\nreenigmeknat\\n\", \"7\\ncar\\ncare\\nbareful\\nyllugerac\\nbecarefuldontforhetsometging\\nltherwiseypuwiolbehacked\\ngoodluck\\n\", \"5\\naaaaa\\naaaa\\naaa\\naa\\n`\\n\", \"1\\nz{zzzzzzzzzzzzzzzzzzzzzzzz{yzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz{zzzzzzzzzzzzz\\n\", \"1\\n_\\n\", \"3\\neivrst\\nshamis\\nadmejn`\\n\", \"10\\ntsiruot\\npetr\\nrmbzmjw\\nyeoutons\\nvepifanov\\nuwttocs\\noooooooooooooooo\\nsubscriber\\nkradwor\\nreenigmeknat\\n\", \"7\\nacr\\ncare\\nbareful\\nyllugerac\\nbecarefuldontforhetsometging\\nltherwiseypuwiolbehacked\\ngoodluck\\n\", \"1\\nz{zzzzzzzzzzzzzzzzzzzzzzzz{yzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz{zzzzzzzzzzzzy\\n\", \"1\\ng\\n\", \"10\\npetr\\negor\\nnoirogadne\\nfeferivan\\nilovetanyaromanova\\nkoatks\\ndmitriyh\\nmaratsnowbear\\nbredorjaguarturnik\\nbfzforrvee\\n\", \"3\\neivrst\\nsimahs\\nadmejn`\\n\", \"10\\ntsirtot\\npetr\\nrmbzmjw\\nyeoutons\\nvepifanov\\nuwttocs\\noooooooooooooooo\\nsubscriber\\nkradwor\\nreenigmeknat\\n\", \"7\\nacr\\ncarf\\nbareful\\nyllugerac\\nbecarefuldontforhetsometging\\nltherwiseypuwiolbehacked\\ngoodluck\\n\", \"1\\nyzzzzzzzzzzzz{zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzy{zzzzzzzzzzzzzzzzzzzzzzzz{z\\n\", \"1\\nh\\n\", \"10\\npetr\\negor\\nendagorion\\nfeferivan\\nilovetanyaromanova\\nkoatks\\ndmitriyh\\nmaratsnowbear\\nbredorjaguarturnik\\nbfzforrvee\\n\", \"3\\neivrst\\nshamis\\nadmekn`\\n\", \"10\\ntsirtot\\npetr\\nrmbzmjw\\nyeoutons\\nvepifanov\\nuwttocs\\noooooooooooooooo\\nsubscriber\\nlradwor\\nreenigmeknat\\n\", \"7\\nadr\\ncarf\\nbareful\\nyllugerac\\nbecarefuldontforhetsometging\\nltherwiseypuwiolbehacked\\ngoodluck\\n\", \"1\\nyzzzzzzzzzzzz{zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzy{zzzzzzzzzzzzzzzz{zzzzzzz{z\\n\", \"1\\ni\\n\", \"10\\npetr\\negor\\nendagorion\\nfdferivan\\nilovetanyaromanova\\nkoatks\\ndmitriyh\\nmaratsnowbear\\nbredorjaguarturnik\\nbfzforrvee\\n\", \"10\\ntsirtot\\npetr\\nrmbzmjw\\nyeoutons\\nvepifanov\\nuwttocs\\noooooooooooooooo\\nrubscriber\\nlradwor\\nreenigmeknat\\n\", \"7\\nadr\\ncarf\\naareful\\nyllugerac\\nbecarefuldontforhetsometging\\nltherwiseypuwiolbehacked\\ngoodluck\\n\", \"1\\nz{zzzzzzz{zzzzzzzzzzzzzzzz{yzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz{zzzzzzzzzzzzy\\n\", \"1\\nj\\n\", \"10\\npftr\\negor\\nendagorion\\nfdferivan\\nilovetanyaromanova\\nkoatks\\ndmitriyh\\nmaratsnowbear\\nbredorjaguarturnik\\nbfzforrvee\\n\", \"10\\ntotrist\\npetr\\nrmbzmjw\\nyeoutons\\nvepifanov\\nuwttocs\\noooooooooooooooo\\nrubscriber\\nlradwor\\nreenigmeknat\\n\", \"7\\nadr\\ncarf\\naareful\\nyllugerac\\nbecarefuldontforhetsometging\\nltherwiseypuwiolbehacked\\nloodguck\\n\", \"1\\nz{yzzzzzz{zzzzzzzzzzzzzzzz{yzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz{zzzzzzzzzzzzy\\n\", \"1\\nk\\n\", \"10\\npftr\\nerog\\nendagorion\\nfdferivan\\nilovetanyaromanova\\nkoatks\\ndmitriyh\\nmaratsnowbear\\nbredorjaguarturnik\\nbfzforrvee\\n\", \"10\\ntotrist\\npetr\\nrmbzmjw\\nyeoutons\\nvepifanov\\nuwttocs\\noooooooooooooooo\\nrebircsbur\\nlradwor\\nreenigmeknat\\n\", \"7\\nadr\\ncarf\\nluferaa\\nyllugerac\\nbecarefuldontforhetsometging\\nltherwiseypuwiolbehacked\\nloodguck\\n\", \"10\\npetr\\negor\\nendagorion\\nfeferivan\\nilovetanyaromanova\\nkostka\\ndmitriyh\\nmaratsnowbear\\nbredorjaguarturnik\\ncgyforever\\n\", \"3\\nrivest\\nshamir\\nadleman\\n\", \"10\\ntourist\\npetr\\nwjmzbmr\\nyeputons\\nvepifanov\\nscottwu\\noooooooooooooooo\\nsubscriber\\nrowdark\\ntankengineer\\n\", \"7\\ncar\\ncare\\ncareful\\ncarefully\\nbecarefuldontforgetsomething\\notherwiseyouwillbehacked\\ngoodluck\\n\"], \"outputs\": [\"Impossible\\n\", \"Impossible\\n\", \"Impossible\\n\", \"xyzwvutsrqponmlkjihgfedcab\\n\", \"abcdefghijklmnopqrstuvwxyz\\n\", \"Impossible\\n\", \"Impossible\\n\", \"abcdefghijklmnopqrstuvwxyz\\n\", \"Impossible\\n\", \"abcdefghijklmnopqrstuvwxyz\\n\", \"bcdefghijklmnopqrstuvwxyza\\n\", \"Impossible\\n\", \"abcdefghijklnopqrstuvwxyzm\\n\", \"acdefghijklmnopqrstuvwxzyb\\n\", \"abcdefghijklmnopqrstuvwxyz\\n\", \"cdefghijklmnopqrstuvwyzxab\\n\", \"cefghijklmnopqrstuvwdxabyz\\n\", \"aghjlopqrstuvwxyznefikdmbc\\n\", \"bcdefghijklmnopqrtuvwxyzsa\\n\", \"acdefhijkmnopqrstuvwxyzblg\\n\", \"abcdefghijklmnopqrstuwxyzv\\n\", \"acghjlopqrstuvwxyznefikdmb\\n\", \"acdefhijkmnopqrstuvwxzyblg\\n\", \"acghjlopqrstuvwxyzenfikdmb\\n\", \"abcdefghijklmnopqrstuvwxyz\\n\", \"abcdefghijklmnopqrstuvwxyz\\n\", \"Impossible\\n\", \"Impossible\\n\", \"Impossible\\n\", \"acdefghijklmnopqrstuvwxzyb\\n\", \"abcdefghijklmnopqrstuvwxyz\\n\", \"abcdefghijklmnopqrstuvwxyz\\n\", \"aghjlopqrstuvwxyznefikdmbc\\n\", \"bcdefghijklmnopqrtuvwxyzsa\\n\", \"Impossible\\n\", \"acdefhijkmnopqrstuvwxyzblg\\n\", \"Impossible\\n\", \"abcdefghijklmnopqrstuvwxyz\\n\", \"abcdefghijklmnopqrstuvwxyz\\n\", \"bcdefghijklmnopqrtuvwxyzsa\\n\", \"Impossible\\n\", \"Impossible\\n\", \"abcdefghijklmnopqrstuvwxyz\\n\", \"abcdefghijklmnopqrstuvwxyz\\n\", \"acghjlopqrstuvwxyznefikdmb\\n\", \"bcdefghijklmnopqrtuvwxyzsa\\n\", \"Impossible\\n\", \"acdefhijkmnopqrstuvwxzyblg\\n\", \"Impossible\\n\", \"abcdefghijklmnopqrstuvwxyz\\n\", \"abcdefghijklmnopqrstuvwxyz\\n\", \"acghjlopqrstuvwxyznefikdmb\\n\", \"bcdefghijklmnopqrtuvwxyzsa\\n\", \"Impossible\\n\", \"Impossible\\n\", \"Impossible\\n\", \"abcdefghijklmnopqrstuvwxyz\\n\", \"abcdefghijklmnopqrstuvwxyz\\n\", \"acghjlopqrstuvwxyznefikdmb\\n\", \"bcdefghijklmnopqrtuvwxyzsa\\n\", \"Impossible\\n\", \"Impossible\\n\", \"Impossible\\n\", \"abcdefghijklmnopqrstuvwxyz\\n\", \"abcdefghijklmnopqrstuvwxyz\\n\", \"bcdefghijklmnopqrtuvwxyzsa\\n\", \"Impossible\\n\", \"Impossible\\n\", \"abcdefghijklmnopqrstuvwxyz\\n\", \"abcdefghijklmnopqrstuvwxyz\\n\", \"acghjlopqrstuvwxyzenfikdmb\\n\", \"bcdefghijklmnopqrtuvwxyzsa\\n\", \"Impossible\\n\", \"Impossible\\n\", \"abcdefghijklmnopqrstuvwxyz\\n\", \"abcdefghijklmnopqrstuvwxyz\\n\", \"acghjlopqrstuvwxyznefikdmb\\n\", \"bcdefghijklmnopqrtuvwxyzsa\\n\", \"Impossible\\n\", \"Impossible\\n\", \"abcdefghijklmnopqrstuvwxyz\\n\", \"abcdefghijklmnopqrstuvwxyz\\n\", \"acghjlopqrstuvwxyznefikdmb\\n\", \"Impossible\\n\", \"Impossible\\n\", \"abcdefghijklmnopqrstuvwxyz\\n\", \"abcdefghijklmnopqrstuvwxyz\\n\", \"acghjlopqrstuvwxyznefikdmb\\n\", \"Impossible\\n\", \"Impossible\\n\", \"abcdefghijklmnopqrstuvwxyz\\n\", \"abcdefghijklmnopqrstuvwxyz\\n\", \"acghjlopqrstuvwxyzenfikdmb\\n\", \"Impossible\\n\", \"Impossible\\n\", \"zyxwvutsrqpoljhgnefikdmbca\\n\", \"zyxwvutrsqponmlkjihgfedcba\\n\", \"Impossible\\n\", \"zyxwvutsrqpnmlkjihfedcboga\\n\"]}", "source": "primeintellect"}
Fox Ciel is going to publish a paper on FOCS (Foxes Operated Computer Systems, pronounce: "Fox"). She heard a rumor: the authors list on the paper is always sorted in the lexicographical order. After checking some examples, she found out that sometimes it wasn't true. On some papers authors' names weren't sorted in lexicographical order in normal sense. But it was always true that after some modification of the order of letters in alphabet, the order of authors becomes lexicographical! She wants to know, if there exists an order of letters in Latin alphabet such that the names on the paper she is submitting are following in the lexicographical order. If so, you should find out any such order. Lexicographical order is defined in following way. When we compare s and t, first we find the leftmost position with differing characters: si ≠ ti. If there is no such position (i. e. s is a prefix of t or vice versa) the shortest string is less. Otherwise, we compare characters si and ti according to their order in alphabet. Input The first line contains an integer n (1 ≤ n ≤ 100): number of names. Each of the following n lines contain one string namei (1 ≤ |namei| ≤ 100), the i-th name. Each name contains only lowercase Latin letters. All names are different. Output If there exists such order of letters that the given names are sorted lexicographically, output any such order as a permutation of characters 'a'–'z' (i. e. first output the first letter of the modified alphabet, then the second, and so on). Otherwise output a single word "Impossible" (without quotes). Examples Input 3 rivest shamir adleman Output bcdefghijklmnopqrsatuvwxyz Input 10 tourist petr wjmzbmr yeputons vepifanov scottwu oooooooooooooooo subscriber rowdark tankengineer Output Impossible Input 10 petr egor endagorion feferivan ilovetanyaromanova kostka dmitriyh maratsnowbear bredorjaguarturnik cgyforever Output aghjlnopefikdmbcqrstuvwxyz Input 7 car care careful carefully becarefuldontforgetsomething otherwiseyouwillbehacked goodluck Output acbdefhijklmnogpqrstuvwxyz Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0.125
{"tests": "{\"inputs\": [[3], [15], [-3], [-25], [0]], \"outputs\": [[\"1 1\\n 2 2 \\n 3 \\n 2 2 \\n1 1\"], [\"1 1\\n 2 2 \\n 3 3 \\n 4 4 \\n 5 5 \\n 6 6 \\n 7 7 \\n 8 8 \\n 9 9 \\n 0 0 \\n 1 1 \\n 2 2 \\n 3 3 \\n 4 4 \\n 5 \\n 4 4 \\n 3 3 \\n 2 2 \\n 1 1 \\n 0 0 \\n 9 9 \\n 8 8 \\n 7 7 \\n 6 6 \\n 5 5 \\n 4 4 \\n 3 3 \\n 2 2 \\n1 1\"], [\"\"], [\"\"], [\"\"]]}", "source": "primeintellect"}
### Task: You have to write a function `pattern` which returns the following Pattern(See Examples) upto (2n-1) rows, where n is parameter. * Note:`Returning` the pattern is not the same as `Printing` the pattern. #### Parameters: pattern( n ); ^ | Term upto which Basic Pattern(this) should be created #### Rules/Note: * If `n < 1` then it should return "" i.e. empty string. * `The length of each line is same`, and is equal to the length of longest line in the pattern i.e (2n-1). * Range of Parameters (for the sake of CW Compiler) : + `n ∈ (-∞,100]` ### Examples: * pattern(5): 1 1 2 2 3 3 4 4 5 4 4 3 3 2 2 1 1 * pattern(10): 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 0 9 9 8 8 7 7 6 6 5 5 4 4 3 3 2 2 1 1 * pattern(15): 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 0 0 1 1 2 2 3 3 4 4 5 4 4 3 3 2 2 1 1 0 0 9 9 8 8 7 7 6 6 5 5 4 4 3 3 2 2 1 1 [List of all my katas]("http://www.codewars.com/users/curious_db97/authored") Write your solution by modifying this code: ```python def pattern(n): ``` Your solution should implemented in the function "pattern". The i Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [[\"\"], [\"0\"], [\"0oO0oO\"], [\"1234567890\"], [\"abcdefghijklmnopqrstuvwxyz\"], [\"()\"], [\"E\"], [\"aA\"], [\"BRA\"], [\"%%\"]], \"outputs\": [[0], [1], [6], [5], [8], [1], [0], [1], [3], [4]]}", "source": "primeintellect"}
Gigi is a clever monkey, living in the zoo, his teacher (animal keeper) recently taught him some knowledge of "0". In Gigi's eyes, "0" is a character contains some circle(maybe one, maybe two). So, a is a "0",b is a "0",6 is also a "0",and 8 have two "0" ,etc... Now, write some code to count how many "0"s in the text. Let us see who is smarter? You ? or monkey? Input always be a string(including words numbers and symbols),You don't need to verify it, but pay attention to the difference between uppercase and lowercase letters. Here is a table of characters: one zeroabdegopq069DOPQR         () <-- A pair of braces as a zerotwo zero%&B8 Output will be a number of "0". Write your solution by modifying this code: ```python def countzero(string): ``` Your solution should implemented in the function "countzero". The i Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [[[1, 2, 3, 4, 5, 8, 7, 8, 9]], [[2, 8, 6, 7, 4, 3, 1, 5, 9]], [[1, 2, 3, 4, 5, 6, 7, 8, 9]], [[0, 1, 2, 3, 4, 5, 6, 7, 8]], [[1, 3, 5, 7, 9, 11, 13, 15]], [[1, 3, 5, 7, 8, 12, 14, 16]], [[0, 1, 1, 2, 3, 5, 8, 13, 21, 34]], [[0, 2, 4, 6, 8]], [[2, 4, 6, 8, 10]], [[2, 4, 6, 8, 10, 12, 14, 16, 18, 20]], [[2, 4, 6, 8, 10, 12, 14, 16, 18, 22]], [[2, 4, 6, 8, 10, 12, 13, 16, 18, 20]], [[3, 7, 9]], [[3, 6, 9]], [[3, 6, 8]], [[50, 100, 200, 400, 800]], [[50, 100, 150, 200, 250]], [[100, 200, 300, 400, 500, 600]]], \"outputs\": [[false], [false], [true], [true], [true], [false], [false], [true], [true], [true], [false], [false], [false], [true], [false], [false], [true], [true]]}", "source": "primeintellect"}
Create a function that will return true if all numbers in the sequence follow the same counting pattern. If the sequence of numbers does not follow the same pattern, the function should return false. Sequences will be presented in an array of varied length. Each array will have a minimum of 3 numbers in it. The sequences are all simple and will not step up in varying increments such as a Fibonacci sequence. JavaScript examples: Write your solution by modifying this code: ```python def validate_sequence(sequence): ``` Your solution should implemented in the function "validate_sequence". The i Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [\"15 15 15\\n1 10 1\\n2 11 0\\n2 6 4\\n1 1 0\\n1 7 5\\n1 14 3\\n1 3 1\\n1 4 2\\n1 9 0\\n2 10 1\\n1 12 1\\n2 2 0\\n1 5 3\\n2 3 0\\n2 4 2\\n\", \"5 20 20\\n1 15 3\\n2 15 3\\n2 3 1\\n2 1 0\\n1 16 4\\n\", \"3 4 5\\n1 3 9\\n2 1 9\\n1 2 8\\n\", \"20 50000 50000\\n2 45955 55488\\n1 19804 29337\\n2 3767 90811\\n2 24025 33558\\n1 46985 56518\\n2 21094 30627\\n2 5787 15320\\n1 4262 91306\\n2 37231 46764\\n1 18125 27658\\n1 36532 12317\\n1 31330 40863\\n1 18992 28525\\n1 29387 38920\\n1 44654 54187\\n2 45485 55018\\n2 36850 46383\\n1 44649 54182\\n1 40922 50455\\n2 12781 99825\\n\", \"5 5 5\\n1 1 0\\n2 1 0\\n2 2 1\\n1 2 1\\n2 4 3\\n\", \"1 10 10\\n1 8 1\\n\", \"15 80 80\\n2 36 4\\n2 65 5\\n1 31 2\\n2 3 1\\n2 62 0\\n2 37 5\\n1 16 4\\n2 47 2\\n1 17 5\\n1 9 5\\n2 2 0\\n2 62 5\\n2 34 2\\n1 33 1\\n2 69 3\\n\", \"10 500 500\\n2 88 59\\n2 470 441\\n1 340 500\\n2 326 297\\n1 74 45\\n1 302 273\\n1 132 103\\n2 388 359\\n1 97 68\\n2 494 465\\n\", \"20 15 15\\n2 7 100000\\n1 2 100000\\n2 1 100000\\n1 9 100000\\n2 4 100000\\n2 3 100000\\n2 14 100000\\n1 6 100000\\n1 10 100000\\n2 5 100000\\n2 13 100000\\n1 8 100000\\n1 13 100000\\n1 14 100000\\n2 10 100000\\n1 5 100000\\n1 11 100000\\n1 12 100000\\n1 1 100000\\n2 2 100000\\n\", \"3 4 5\\n1 3 9\\n2 1 17\\n1 2 8\\n\", \"20 50000 50000\\n2 45955 55488\\n1 19804 29337\\n2 3767 90811\\n2 24025 33558\\n1 46985 56518\\n2 21094 30627\\n2 5787 15320\\n1 4262 20961\\n2 37231 46764\\n1 18125 27658\\n1 36532 12317\\n1 31330 40863\\n1 18992 28525\\n1 29387 38920\\n1 44654 54187\\n2 45485 55018\\n2 36850 46383\\n1 44649 54182\\n1 40922 50455\\n2 12781 99825\\n\", \"5 5 5\\n1 1 0\\n2 1 0\\n2 2 1\\n1 3 1\\n2 4 3\\n\", \"1 10 10\\n2 8 1\\n\", \"10 500 500\\n2 88 59\\n2 470 441\\n1 340 500\\n2 326 297\\n1 74 45\\n1 302 376\\n1 132 103\\n2 388 359\\n1 97 68\\n2 494 465\\n\", \"8 10 8\\n1 1 10\\n1 4 13\\n1 11 1\\n1 8 2\\n2 2 0\\n2 5 14\\n2 6 0\\n2 6 1\\n\", \"20 50000 50000\\n2 45955 55488\\n1 19804 29337\\n2 3767 90811\\n2 24025 33558\\n1 46985 56518\\n2 21094 30627\\n1 5787 15320\\n1 4262 20961\\n2 37231 46764\\n1 18125 27658\\n1 36532 12317\\n1 31330 40863\\n1 18992 28525\\n1 29387 38920\\n1 44654 54187\\n2 45485 55018\\n2 36850 46383\\n1 44649 54182\\n1 40922 50455\\n2 12781 99825\\n\", \"10 500 500\\n2 88 59\\n2 470 441\\n1 340 500\\n2 326 297\\n1 74 60\\n1 302 376\\n1 132 103\\n2 388 359\\n1 97 68\\n2 494 465\\n\", \"8 10 8\\n1 1 10\\n1 4 13\\n2 11 1\\n1 8 2\\n2 2 0\\n2 5 14\\n2 6 0\\n2 6 1\\n\", \"20 50000 50000\\n2 45955 55488\\n1 19804 29337\\n2 3767 90811\\n2 24025 33558\\n1 46985 9540\\n2 21094 30627\\n1 5787 15320\\n1 4262 20961\\n2 37231 46764\\n1 18125 27658\\n1 36532 12317\\n1 31330 40863\\n1 18992 28525\\n1 29387 38920\\n1 44654 54187\\n2 45485 55018\\n2 36850 46383\\n1 44649 54182\\n1 40922 50455\\n2 12781 99825\\n\", \"8 10 8\\n1 1 10\\n1 2 13\\n2 11 1\\n1 8 2\\n2 2 0\\n2 5 14\\n2 6 0\\n2 6 1\\n\", \"20 55711 50000\\n2 45955 55488\\n1 19804 29337\\n2 3767 90811\\n2 24025 33558\\n1 46985 9540\\n2 21094 30627\\n1 5787 15320\\n1 4262 20961\\n2 37231 46764\\n1 18125 27658\\n1 36532 12317\\n1 31330 40863\\n1 18992 28525\\n1 29387 38920\\n1 44654 54187\\n2 45485 55018\\n2 36850 46383\\n1 44649 54182\\n1 40922 50455\\n2 12781 99825\\n\", \"3 4 5\\n1 6 9\\n2 1 17\\n1 2 10\\n\", \"20 55711 50000\\n2 45955 55488\\n1 19804 29337\\n2 3767 90811\\n2 24025 33558\\n1 46985 9540\\n2 21094 30627\\n1 5787 15320\\n1 4262 20961\\n2 61515 46764\\n1 18125 27658\\n1 36532 12317\\n1 31330 40863\\n1 18992 28525\\n1 29387 38920\\n1 44654 54187\\n2 45485 55018\\n2 36850 46383\\n1 44649 54182\\n1 40922 50455\\n2 12781 99825\\n\", \"8 10 8\\n1 2 10\\n1 2 1\\n2 11 1\\n1 8 2\\n2 2 0\\n2 5 14\\n2 6 0\\n2 6 1\\n\", \"3 4 9\\n1 6 9\\n2 1 17\\n1 2 10\\n\", \"20 55711 50000\\n2 45955 55488\\n1 19804 29337\\n2 3767 90811\\n2 24025 33558\\n1 46985 9540\\n2 21094 30627\\n1 5787 15320\\n1 4262 20961\\n2 61515 46764\\n1 18125 27658\\n1 36532 12317\\n1 31330 40863\\n1 35496 28525\\n1 29387 38920\\n1 44654 54187\\n2 45485 55018\\n2 36850 46383\\n1 44649 54182\\n1 40922 50455\\n2 12781 99825\\n\", \"3 4 5\\n1 6 9\\n2 1 17\\n1 1 10\\n\", \"3 4 5\\n1 12 9\\n2 1 17\\n1 1 10\\n\", \"3 5 5\\n1 12 9\\n2 1 17\\n1 1 10\\n\", \"3 5 5\\n1 13 9\\n2 1 17\\n1 1 10\\n\", \"5 20 20\\n1 5 3\\n2 15 3\\n2 3 1\\n2 1 0\\n1 16 4\\n\", \"20 50000 50000\\n2 45955 55488\\n1 19804 29337\\n2 3767 27285\\n2 24025 33558\\n1 46985 56518\\n2 21094 30627\\n2 5787 15320\\n1 4262 91306\\n2 37231 46764\\n1 18125 27658\\n1 36532 12317\\n1 31330 40863\\n1 18992 28525\\n1 29387 38920\\n1 44654 54187\\n2 45485 55018\\n2 36850 46383\\n1 44649 54182\\n1 40922 50455\\n2 12781 99825\\n\", \"1 10 10\\n1 8 0\\n\", \"15 80 80\\n2 36 4\\n2 65 5\\n1 31 2\\n2 3 1\\n2 62 0\\n2 37 5\\n1 16 4\\n2 47 2\\n2 17 5\\n1 9 5\\n2 2 0\\n2 62 5\\n2 34 2\\n1 33 1\\n2 69 3\\n\", \"10 500 500\\n2 88 59\\n2 470 441\\n1 340 500\\n2 326 297\\n1 74 45\\n1 302 273\\n1 224 103\\n2 388 359\\n1 97 68\\n2 494 465\\n\", \"20 50000 50000\\n2 45955 55488\\n1 19804 29337\\n2 3767 90811\\n2 24025 33558\\n1 46985 56518\\n2 21094 30627\\n2 5787 15320\\n1 4262 20961\\n2 37231 46764\\n1 18125 27658\\n1 36532 12317\\n1 31330 40863\\n1 18992 28525\\n1 29387 38920\\n1 44654 54187\\n2 43681 55018\\n2 36850 46383\\n1 44649 54182\\n1 40922 50455\\n2 12781 99825\\n\", \"20 50000 50000\\n2 45955 55488\\n1 19804 29337\\n2 3767 90811\\n2 24025 33558\\n1 46985 56518\\n2 21094 30627\\n1 5787 15320\\n1 4262 20961\\n2 37231 46764\\n1 18125 27658\\n1 36532 12317\\n1 31330 40863\\n1 18992 28525\\n1 29387 2343\\n1 44654 54187\\n2 45485 55018\\n2 36850 46383\\n1 44649 54182\\n1 40922 50455\\n2 12781 99825\\n\", \"10 500 500\\n2 88 59\\n2 470 845\\n1 340 500\\n2 326 297\\n1 74 60\\n1 302 376\\n1 132 103\\n2 388 359\\n1 97 68\\n2 494 465\\n\", \"8 10 8\\n1 1 10\\n1 4 13\\n2 11 1\\n1 8 2\\n2 2 0\\n2 5 14\\n2 6 0\\n1 6 1\\n\", \"20 50000 50000\\n2 45955 55488\\n1 19804 29337\\n2 3767 90811\\n2 24025 33558\\n1 46985 9540\\n2 21094 30627\\n1 5787 15320\\n1 4262 20961\\n2 37231 46764\\n1 18125 27658\\n1 36532 12317\\n1 31330 40863\\n1 9571 28525\\n1 29387 38920\\n1 44654 54187\\n2 45485 55018\\n2 36850 46383\\n1 44649 54182\\n1 40922 50455\\n2 12781 99825\\n\", \"10 500 500\\n2 88 112\\n2 470 441\\n1 340 952\\n2 326 297\\n1 74 60\\n1 302 376\\n1 132 103\\n2 388 359\\n1 97 68\\n2 494 465\\n\", \"3 4 5\\n1 3 9\\n2 1 21\\n1 2 8\\n\", \"3 4 5\\n1 3 9\\n2 1 21\\n1 2 10\\n\", \"10 500 500\\n2 88 59\\n2 470 441\\n1 340 952\\n2 326 297\\n1 74 60\\n1 302 376\\n1 132 103\\n2 388 359\\n1 97 68\\n2 494 465\\n\", \"3 4 5\\n1 3 9\\n2 1 17\\n1 2 10\\n\", \"8 10 8\\n1 1 10\\n1 2 1\\n2 11 1\\n1 8 2\\n2 2 0\\n2 5 14\\n2 6 0\\n2 6 1\\n\", \"3 5 5\\n1 13 9\\n2 1 24\\n1 1 10\\n\", \"3 5 5\\n1 13 14\\n2 1 24\\n1 1 10\\n\", \"3 4 5\\n1 3 6\\n2 1 9\\n1 2 8\\n\", \"3 4 5\\n1 3 0\\n2 1 17\\n1 2 8\\n\", \"1 10 10\\n2 8 2\\n\", \"20 55711 50000\\n2 45955 55488\\n1 19804 29337\\n2 3767 90811\\n2 24025 33558\\n1 46985 9540\\n2 21094 30627\\n1 5787 15320\\n1 4262 20961\\n2 37231 46764\\n1 18125 27658\\n1 36532 12317\\n1 31330 40863\\n1 18992 28525\\n1 29387 38920\\n1 44654 54187\\n2 45485 55018\\n2 36850 46383\\n1 44649 54182\\n1 40922 50455\\n2 12781 84967\\n\", \"3 2 3\\n1 1 2\\n2 1 1\\n1 1 5\\n\", \"8 10 8\\n1 1 10\\n1 4 13\\n1 7 1\\n1 8 2\\n2 2 0\\n2 5 14\\n2 6 0\\n2 6 1\\n\"], \"outputs\": [\"15 10\\n12 15\\n3 15\\n1 15\\n15 2\\n15 11\\n7 15\\n15 6\\n10 15\\n9 15\\n14 15\\n5 15\\n15 4\\n15 3\\n4 15\\n\", \"16 20\\n15 20\\n20 3\\n20 1\\n20 15\\n\", \"3 5\\n4 1\\n2 5\\n\", \"18125 50000\\n50000 45955\\n50000 12781\\n31330 50000\\n50000 5787\\n40922 50000\\n44649 50000\\n50000 3767\\n19804 50000\\n44654 50000\\n36532 50000\\n50000 37231\\n46985 50000\\n50000 45485\\n50000 21094\\n18992 50000\\n29387 50000\\n50000 24025\\n50000 36850\\n4262 50000\\n\", \"5 2\\n5 4\\n2 5\\n5 1\\n1 5\\n\", \"8 10\\n\", \"80 37\\n80 65\\n31 80\\n80 3\\n80 62\\n33 80\\n16 80\\n80 47\\n17 80\\n9 80\\n80 2\\n80 62\\n80 36\\n80 34\\n80 69\\n\", \"500 494\\n97 500\\n340 500\\n302 500\\n500 470\\n500 88\\n500 326\\n132 500\\n500 388\\n74 500\\n\", \"15 7\\n15 2\\n1 15\\n9 15\\n15 4\\n15 3\\n14 15\\n6 15\\n15 10\\n5 15\\n13 15\\n8 15\\n15 13\\n15 14\\n10 15\\n15 5\\n11 15\\n12 15\\n15 1\\n2 15\\n\", \"3 5\\n4 1\\n2 5\\n\", \"18125 50000\\n50000 45955\\n50000 3767\\n31330 50000\\n50000 5787\\n40922 50000\\n44649 50000\\n4262 50000\\n19804 50000\\n44654 50000\\n36532 50000\\n50000 37231\\n46985 50000\\n50000 45485\\n50000 21094\\n18992 50000\\n29387 50000\\n50000 24025\\n50000 36850\\n50000 12781\\n\", \"5 1\\n5 2\\n5 4\\n3 5\\n1 5\\n\", \"10 8\\n\", \"500 470\\n97 500\\n340 500\\n500 494\\n500 388\\n302 500\\n500 88\\n132 500\\n500 326\\n74 500\\n\", \"4 8\\n10 5\\n11 8\\n10 6\\n10 2\\n1 8\\n8 8\\n10 6\\n\", \"5787 50000\\n46985 50000\\n50000 3767\\n29387 50000\\n50000 21094\\n31330 50000\\n40922 50000\\n4262 50000\\n18992 50000\\n44649 50000\\n36532 50000\\n50000 45485\\n44654 50000\\n50000 45955\\n50000 24025\\n18125 50000\\n19804 50000\\n50000 36850\\n50000 37231\\n50000 12781\\n\", \"500 388\\n132 500\\n340 500\\n500 470\\n74 500\\n302 500\\n500 88\\n500 494\\n500 326\\n97 500\\n\", \"4 8\\n10 5\\n10 11\\n10 6\\n10 2\\n1 8\\n8 8\\n10 6\\n\", \"5787 50000\\n50000 45955\\n50000 3767\\n29387 50000\\n46985 50000\\n31330 50000\\n40922 50000\\n4262 50000\\n18992 50000\\n44649 50000\\n36532 50000\\n50000 37231\\n44654 50000\\n50000 45485\\n50000 21094\\n18125 50000\\n19804 50000\\n50000 24025\\n50000 36850\\n50000 12781\\n\", \"10 5\\n2 8\\n10 11\\n10 6\\n10 2\\n1 8\\n8 8\\n10 6\\n\", \"5787 50000\\n55711 45955\\n55711 3767\\n29387 50000\\n46985 50000\\n31330 50000\\n40922 50000\\n4262 50000\\n18992 50000\\n44649 50000\\n36532 50000\\n55711 37231\\n44654 50000\\n55711 45485\\n55711 21094\\n18125 50000\\n19804 50000\\n55711 24025\\n55711 36850\\n55711 12781\\n\", \"6 5\\n4 1\\n2 5\\n\", \"5787 50000\\n44654 50000\\n55711 3767\\n19804 50000\\n46985 50000\\n29387 50000\\n31330 50000\\n4262 50000\\n55711 61515\\n40922 50000\\n36532 50000\\n55711 45485\\n44649 50000\\n55711 45955\\n55711 21094\\n18125 50000\\n18992 50000\\n55711 24025\\n55711 36850\\n55711 12781\\n\", \"2 8\\n2 8\\n10 11\\n10 6\\n10 2\\n10 5\\n8 8\\n10 6\\n\", \"6 9\\n4 1\\n2 9\\n\", \"5787 50000\\n44654 50000\\n55711 3767\\n29387 50000\\n46985 50000\\n31330 50000\\n40922 50000\\n4262 50000\\n55711 61515\\n44649 50000\\n36532 50000\\n55711 45485\\n35496 50000\\n55711 45955\\n55711 21094\\n18125 50000\\n19804 50000\\n55711 24025\\n55711 36850\\n55711 12781\\n\", \"6 5\\n4 1\\n1 5\\n\", \"12 5\\n4 1\\n1 5\\n\", \"12 5\\n5 1\\n1 5\\n\", \"13 5\\n5 1\\n1 5\\n\", \"20 3\\n16 20\\n5 20\\n20 1\\n20 15\\n\", \"18125 50000\\n50000 45955\\n50000 3767\\n31330 50000\\n50000 5787\\n40922 50000\\n44649 50000\\n50000 12781\\n19804 50000\\n44654 50000\\n36532 50000\\n50000 37231\\n46985 50000\\n50000 45485\\n50000 21094\\n18992 50000\\n29387 50000\\n50000 24025\\n50000 36850\\n4262 50000\\n\", \"8 10\\n\", \"80 37\\n80 65\\n31 80\\n80 3\\n80 62\\n33 80\\n80 17\\n80 47\\n16 80\\n9 80\\n80 2\\n80 62\\n80 36\\n80 34\\n80 69\\n\", \"500 470\\n97 500\\n340 500\\n500 494\\n500 388\\n500 88\\n224 500\\n302 500\\n500 326\\n74 500\\n\", \"18125 50000\\n46985 50000\\n50000 3767\\n29387 50000\\n50000 5787\\n31330 50000\\n40922 50000\\n4262 50000\\n18992 50000\\n44649 50000\\n36532 50000\\n50000 37231\\n44654 50000\\n50000 45955\\n50000 21094\\n50000 43681\\n19804 50000\\n50000 24025\\n50000 36850\\n50000 12781\\n\", \"5787 50000\\n50000 45955\\n50000 3767\\n31330 50000\\n50000 21094\\n40922 50000\\n44649 50000\\n4262 50000\\n18992 50000\\n44654 50000\\n36532 50000\\n50000 45485\\n46985 50000\\n29387 50000\\n50000 24025\\n18125 50000\\n19804 50000\\n50000 36850\\n50000 37231\\n50000 12781\\n\", \"500 388\\n500 470\\n340 500\\n500 494\\n74 500\\n302 500\\n500 88\\n132 500\\n500 326\\n97 500\\n\", \"4 8\\n10 5\\n10 11\\n10 6\\n10 2\\n1 8\\n8 8\\n6 8\\n\", \"5787 50000\\n50000 45955\\n50000 3767\\n31330 50000\\n46985 50000\\n40922 50000\\n44649 50000\\n4262 50000\\n19804 50000\\n44654 50000\\n36532 50000\\n50000 37231\\n9571 50000\\n50000 45485\\n50000 21094\\n18125 50000\\n29387 50000\\n50000 24025\\n50000 36850\\n50000 12781\\n\", \"500 88\\n132 500\\n340 500\\n500 470\\n74 500\\n302 500\\n500 326\\n500 494\\n500 388\\n97 500\\n\", \"3 5\\n4 1\\n2 5\\n\", \"3 5\\n4 1\\n2 5\\n\", \"500 388\\n132 500\\n340 500\\n500 470\\n74 500\\n302 500\\n500 88\\n500 494\\n500 326\\n97 500\\n\", \"3 5\\n4 1\\n2 5\\n\", \"10 5\\n2 8\\n10 11\\n10 6\\n10 2\\n1 8\\n8 8\\n10 6\\n\", \"13 5\\n5 1\\n1 5\\n\", \"13 5\\n5 1\\n1 5\\n\", \"3 5\\n4 1\\n2 5\\n\", \"3 5\\n4 1\\n2 5\\n\", \"10 8\\n\", \"5787 50000\\n55711 45955\\n55711 3767\\n29387 50000\\n46985 50000\\n31330 50000\\n40922 50000\\n4262 50000\\n18992 50000\\n44649 50000\\n36532 50000\\n55711 37231\\n44654 50000\\n55711 45485\\n55711 21094\\n18125 50000\\n19804 50000\\n55711 24025\\n55711 36850\\n55711 12781\\n\", \"1 3\\n2 1\\n1 3\\n\", \"4 8\\n10 5\\n8 8\\n10 6\\n10 2\\n1 8\\n7 8\\n10 6\\n\"]}", "source": "primeintellect"}
Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the stage. On the sides of the stage stand n dancers. The i-th of them falls into one of the following groups: * Vertical: stands at (xi, 0), moves in positive y direction (upwards); * Horizontal: stands at (0, yi), moves in positive x direction (rightwards). <image> According to choreography, the i-th dancer should stand still for the first ti milliseconds, and then start moving in the specified direction at 1 unit per millisecond, until another border is reached. It is guaranteed that no two dancers have the same group, position and waiting time at the same time. When two dancers collide (i.e. are on the same point at some time when both of them are moving), they immediately exchange their moving directions and go on. <image> Dancers stop when a border of the stage is reached. Find out every dancer's stopping position. Input The first line of input contains three space-separated positive integers n, w and h (1 ≤ n ≤ 100 000, 2 ≤ w, h ≤ 100 000) — the number of dancers and the width and height of the stage, respectively. The following n lines each describes a dancer: the i-th among them contains three space-separated integers gi, pi, and ti (1 ≤ gi ≤ 2, 1 ≤ pi ≤ 99 999, 0 ≤ ti ≤ 100 000), describing a dancer's group gi (gi = 1 — vertical, gi = 2 — horizontal), position, and waiting time. If gi = 1 then pi = xi; otherwise pi = yi. It's guaranteed that 1 ≤ xi ≤ w - 1 and 1 ≤ yi ≤ h - 1. It is guaranteed that no two dancers have the same group, position and waiting time at the same time. Output Output n lines, the i-th of which contains two space-separated integers (xi, yi) — the stopping position of the i-th dancer in the input. Examples Input 8 10 8 1 1 10 1 4 13 1 7 1 1 8 2 2 2 0 2 5 14 2 6 0 2 6 1 Output 4 8 10 5 8 8 10 6 10 2 1 8 7 8 10 6 Input 3 2 3 1 1 2 2 1 1 1 1 5 Output 1 3 2 1 1 3 Note The first example corresponds to the initial setup in the legend, and the tracks of dancers are marked with different colours in the following figure. <image> In the second example, no dancers collide. Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [\"3\\n0 2 2\\n1 1 0\\n\", \"2\\n1 1\\n1 0\\n\", \"10\\n0 1 2 3 5 5 6 7 8 5\\n9 8 7 1 5 4 3 2 0 0\\n\", \"5\\n0 0 1 4 2\\n0 2 0 1 0\\n\", \"1\\n1\\n0\\n\", \"10\\n1 1 1 0 3 0 6 2 4 5\\n7 6 2 3 5 1 2 0 1 0\\n\", \"10\\n1 0 2 2 5 0 0 0 2 7\\n4 3 1 0 4 3 3 2 1 0\\n\", \"19\\n1 1 3 4 5 3 5 7 0 6 5 3 10 3 13 9 1 4 17\\n3 0 6 3 8 6 8 7 8 6 0 0 5 0 0 1 1 1 0\\n\", \"12\\n1 0 0 1 2 5 5 1 9 6 2 9\\n8 8 8 1 1 4 4 0 3 1 1 0\\n\", \"19\\n1 1 3 4 5 3 5 7 0 6 5 3 10 3 13 9 1 4 17\\n3 0 6 3 8 6 8 7 8 6 0 0 5 0 0 1 1 1 0\\n\", \"10\\n1 0 2 2 5 0 0 0 2 7\\n4 3 1 0 4 3 3 2 1 0\\n\", \"5\\n0 0 1 4 2\\n0 2 0 1 0\\n\", \"10\\n1 1 1 0 3 0 6 2 4 5\\n7 6 2 3 5 1 2 0 1 0\\n\", \"1\\n1\\n0\\n\", \"12\\n1 0 0 1 2 5 5 1 9 6 2 9\\n8 8 8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\"19\\n1 1 1 4 5 3 5 0 0 6 5 3 10 3 13 9 1 4 17\\n3 0 6 3 8 6 8 3 8 6 0 -1 5 -1 0 1 1 1 0\\n\", \"5\\n-1 0 1 6 2\\n-1 1 -1 1 0\\n\", \"2\\n1 1\\n1 0\\n\", \"3\\n0 2 2\\n1 1 0\\n\", \"10\\n0 1 2 3 5 5 6 7 8 5\\n9 8 7 1 5 4 3 2 0 0\\n\"], \"outputs\": [\"2\\n1 0 \\n\", \"-1\\n\", \"3\\n9 4 0 \\n\", \"3\\n3 2 0 \\n\", \"1\\n0 \\n\", \"-1\\n\", \"3\\n3 2 0 \\n\", \"3\\n2 1 0 \\n\", \"3\\n5 1 0 \\n\", \"3\\n2 1 0 \", \"3\\n3 2 0 \", \"3\\n3 2 0 \", \"-1\\n\", \"1\\n0 \", \"3\\n5 1 0 \", \"3\\n2 1 0\\n\", \"-1\\n\", \"2\\n9 0\\n\", \"3\\n9 4 0\\n\", \"3\\n3 2 0\\n\", \"3\\n5 1 0\\n\", \"2\\n1 0\\n\", \"2\\n2 0\\n\", \"3\\n8 6 0\\n\", \"3\\n4 2 0\\n\", \"1\\n0\\n\", \"5\\n17 15 2 1 0\\n\", \"2\\n4 0\\n\", \"4\\n8 6 1 0\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"2\\n9 0\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"3\\n2 1 0\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"3\\n9 4 0\\n\", \"3\\n2 1 0\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"2\\n9 0\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"3\\n2 1 0\\n\", \"3\\n3 2 0\\n\", \"-1\\n\", \"-1\\n\", \"3\\n5 1 0\\n\", \"-1\\n\", \"2\\n2 0\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"3\\n2 1 0\\n\", \"-1\\n\", \"3\\n5 1 0\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"3\\n2 1 0\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"3\\n2 1 0\\n\", \"-1\\n\", \"-1\\n\", \"3\\n2 1 0\\n\", \"-1\\n\", \"-1\\n\", \"3\\n2 1 0\\n\", \"-1\\n\", \"3\\n2 1 0\\n\", \"-1\\n\", \"3\\n2 1 0\\n\", \"3\\n2 1 0\\n\", \"-1\\n\", \"-1\\n\", \"3\\n5 1 0\\n\", \"3\\n9 4 0\\n\", \"3\\n2 1 0\\n\", \"-1\\n\", \"-1\\n\", \"2\\n9 0\\n\", \"2\\n9 0\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"3\\n2 1 0\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"3\\n3 2 0\\n\", \"-1\\n\", \"2\\n2 0\\n\", \"-1\\n\", \"3\\n8 6 0\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"2\\n9 0\\n\", \"1\\n0\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"3\\n2 1 0\\n\", \"-1\\n\", \"3\\n2 1 0\\n\", \"-1\\n\", \"2\\n2 0\\n\", \"3\\n2 1 0\\n\", \"-1\\n\", \"-1\\n\", \"3\\n5 1 0\\n\", \"3\\n2 1 0\\n\", \"-1\\n\", \"-1\\n\", \"2\\n9 0\\n\", \"-1\\n\", \"3\\n2 1 0\\n\", \"-1\\n\", \"-1\\n\", \"1\\n0\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"2\\n2 0\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"2\\n4 0\\n\", \"2\\n9 0\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"3\\n2 1 0\\n\", \"-1\\n\", \"2\\n2 0\\n\", \"3\\n2 1 0\\n\", \"-1\\n\", \"-1\\n\", \"3\\n5 1 0\\n\", \"3\\n2 1 0\\n\", \"-1\\n\", \"2\\n9 0\\n\", \"-1\\n\", \"3\\n2 1 0\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"4\\n8 6 1 0\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"2\\n4 0\\n\", \"2\\n9 0\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"3\\n2 1 0\\n\", \"-1\\n\", \"3\\n5 1 0\\n\", \"3\\n2 1 0\\n\", \"-1\\n\", \"-1\\n\", \"3\\n2 1 0\\n\", \"-1\\n\", \"-1\\n\", \"2\\n1 0 \", \"3\\n9 4 0 \"]}", "source": "primeintellect"}
Frog Gorf is traveling through Swamp kingdom. Unfortunately, after a poor jump, he fell into a well of $n$ meters depth. Now Gorf is on the bottom of the well and has a long way up. The surface of the well's walls vary in quality: somewhere they are slippery, but somewhere have convenient ledges. In other words, if Gorf is on $x$ meters below ground level, then in one jump he can go up on any integer distance from $0$ to $a_x$ meters inclusive. (Note that Gorf can't jump down, only up). Unfortunately, Gorf has to take a break after each jump (including jump on $0$ meters). And after jumping up to position $x$ meters below ground level, he'll slip exactly $b_x$ meters down while resting. Calculate the minimum number of jumps Gorf needs to reach ground level. -----Input----- The first line contains a single integer $n$ ($1 \le n \le 300000$) — the depth of the well. The second line contains $n$ integers $a_1, a_2, \ldots, a_n$ ($0 \le a_i \le i$), where $a_i$ is the maximum height Gorf can jump from $i$ meters below ground level. The third line contains $n$ integers $b_1, b_2, \ldots, b_n$ ($0 \le b_i \le n - i$), where $b_i$ is the distance Gorf will slip down if he takes a break on $i$ meters below ground level. -----Output----- If Gorf can't reach ground level, print $-1$. Otherwise, firstly print integer $k$ — the minimum possible number of jumps. Then print the sequence $d_1,\,d_2,\,\ldots,\,d_k$ where $d_j$ is the depth Gorf'll reach after the $j$-th jump, but before he'll slip down during the break. Ground level is equal to $0$. If there are multiple answers, print any of them. -----Examples----- Input 3 0 2 2 1 1 0 Output 2 1 0 Input 2 1 1 1 0 Output -1 Input 10 0 1 2 3 5 5 6 7 8 5 9 8 7 1 5 4 3 2 0 0 Output 3 9 4 0 -----Note----- In the first example, Gorf is on the bottom of the well and jump to the height $1$ meter below ground level. After that he slip down by meter and stays on height $2$ meters below ground level. Now, from here, he can reach ground level in one jump. In the second example, Gorf can jump to one meter below ground level, but will slip down back to the bottom of the well. That's why he can't reach ground level. In the third example, Gorf can reach ground level only from the height $5$ meters below the ground level. And Gorf can reach this height using a series of jumps $10 \Rightarrow 9 \dashrightarrow 9 \Rightarrow 4 \dashrightarrow 5$ where $\Rightarrow$ is the jump and $\dashrightarrow$ is slipping during breaks. Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [\"49\\nssizfrtawiuefcgtrrapgoivdxmmipwvdtqggsczdipnkzppi\\npqzrmpifgttneasigivkrouigpdivczigcxdsmtwpzpwfsadr\\n\", \"50\\nzyzxzyzwzyzxzyzvzyzxzyzwzyzxzyzuzyzxzyzwzyzxzyzvzy\\nwxzyzzzyzyvzzvyzxxzyxwzuzzzzzyzyzzxyyzzzywzxzzyzyy\\n\", \"50\\nabbabaabbaababbabaababbaabbabaabbaababbaabbabaabab\\nbaababbaabbabaababbabaabbaababbaabbabaabbaababbaba\\n\", \"100\\nmntyyerijtaaditeyqvxstrwxoxglpaubigaggtrepaegniybvfmssawvhrgjjhwwkwuqhtyrimxvolcstyllbhlcursvgfafpts\\nbsgmhsgavsbgtwiiqaigmtyjxihphxdlseeajfywugawigrjruttuykthfrvwagpcsxlxsopnarqcvetnbtvfrvlyymwoyelrlta\\n\", \"2\\nvb\\nvb\\n\", \"5\\nutvrb\\nvbtru\\n\", \"7\\nvhypflg\\nvprhfly\\n\", \"4\\nwnsc\\nnwcs\\n\", \"50\\nyfjtdvbotbvocjdqxdztqirfjbpqmswjhkqdiapwvrqqjisqch\\nyfjtdvbotbvocjdqxdztqirfjbpqmswjhkqdiapwvrqqjisqch\\n\", \"8\\nzyzxzyzw\\nzzyzxywz\\n\", \"8\\nabbabaab\\nbaababba\\n\", \"99\\nbjogjoclqvnkbnyalezezxjskatbmkmptvmbrbnhuskorfcdscyhubftuqomagrlopmlyjtoaayuvlxgtbkgatxmpcolhqqznfw\\nlwottrblgqgjsnatjfltolyoztqnmlyejuocyojcxsgebcauompmprsqtbmdfkbmhuhkzrakqgvzuaklvbmnanvxahbbfpckoxy\\n\", \"50\\nyfjtdvbotbvocjdqxdztqirfjbpqmswjhkqdiapwvrqqjisqch\\njzxptqvjqqqiiitqrikjmdhsscqjwwfabqdyboocjvdhbdfprt\\n\", \"6\\nabacbb\\nbabcba\\n\", \"50\\nabaababaabaababaababaabaababaabaababaababaabaababa\\nabaaaaaabbaabaaabbaabaaaababbbaaaaababbbaaaaabbbab\\n\", \"8\\nabaababa\\nabaaabab\\n\", \"50\\nyfjtdvbotbvocjdqxdztqirfjbpqmswjhkqdiapwvrqqjisqch\\ncioksjixqqwayfjbqtsqdjphdjzvdtijvprtohcqbvmwfqrdqb\\n\", \"8\\nvnidcatu\\nvnidcatu\\n\", \"8\\nvnidcatu\\nuiacnvdt\\n\", \"1\\nw\\nw\\n\", \"3\\nxhh\\nxhh\\n\", \"49\\nssizfrtawiuefcgtrrapgoivdxmmipwvdtqggsczdipnkzpoi\\npqzrmpifgttneasigivkrouigpdivczigcxdsmtwpzpwfsadr\\n\", \"50\\nzyzxzyzwzyzxzyzvzyzxzyzwzyzxzyzuzyzxzyzwzyzxzyzvzy\\nyyzyzzxzwyzzzyyxzzyzyzzzzzuzwxyzxxzyvzzvyzyzzzyzxw\\n\", \"8\\nwzyzxzyz\\nzzyzxywz\\n\", \"99\\nbjogjoclqvnkbnyalezezxjskatbmkmptvmbrbnhuskorfcdscyhubftuqomagrlopmlyjtoaayuvlxgtbkgatxmpcolhqqznfw\\nlwottrblgqgjsnanjfltolyoztqnmlyejuocyojcxsgebcauompmprsqtbmdfkbmhuhkzrakqgvzuaklvbmtanvxahbbfpckoxy\\n\", \"6\\nabacbb\\nabcbab\\n\", \"50\\nabaababaabaababaababaabaababaabaababaababaabaababa\\nbabbbaaaaabbbabaaaaabbbabaaaabaabbaaabaabbaaaaaaba\\n\", \"8\\nabaaaabb\\nabaaabab\\n\", \"8\\nvnidcatu\\nvdincatu\\n\", \"3\\nxhh\\nhhx\\n\", \"6\\nbbcaba\\nbabcba\\n\", \"8\\nwzyzxzyz\\nzzyzyxwz\\n\", \"99\\nwfnzqqhlocpmxtagkbtgxlvuyaaotjylmpolrgamoqutfbuhycsdcfroksuhnbrbmvtpmkmbtaksjxzezelaynbknvqlcojgojb\\nlwottrblgqgjsnanjfltolyoztqnmlyejuocyojcxsgebcauompmprsqtbmdfkbmhuhkzrakqgvzuaklvbmtanvxahbbfpckoxy\\n\", \"1\\nx\\nx\\n\", \"6\\nbbcaba\\nabcbab\\n\", \"50\\nabbabaabbaababbabaababbaabbabaabbaababbaabbabaabab\\nbaababbaabbabaababbabaabbaacabbaabbabaabbaababbaba\\n\", \"100\\nmntyyerijtaaditeyqvxstrwxoxglpaubigaggtrepaegniybvfmssawvhrgjjhwwkwuqhtyrimxvokcstyllbhlcursvgfafpts\\nbsgmhsgavsbgtwiiqaigmtyjxihphxdlseeajfywugawigrjruttuykthfrvwagpcsxlxsopnarqcvetnbtvfrvlyymwoyelrlta\\n\", \"2\\nvb\\nwb\\n\", \"5\\nutvra\\nvbtru\\n\", \"7\\nvhypflg\\nvprhflx\\n\", \"4\\nwnsd\\nnwcs\\n\", \"50\\nyfjtdvbotbvocjdqxeztqirfjbpqmswjhkqdiapwvrqqjisqch\\nyfjtdvbotbvocjdqxdztqirfjbpqmswjhkqdiapwvrqqjisqch\\n\", \"8\\nabbabaab\\nbaacabba\\n\", \"50\\nyfjtdvbotbvocjdqxdztqirfjboqmswjhkqdiapwvrqqjisqch\\njzxptqvjqqqiiitqrikjmdhsscqjwwfabqdyboocjvdhbdfprt\\n\", \"50\\nyfjtdvbotbvocjdqxdztqirfjbpqmswjhkqdiapwvrqqjisqch\\ncioksjixqqwayfjbqtsqdjphdjzudtijvprtohcqbvmwfqrdqb\\n\", \"8\\nvnjdcatu\\nuiacnvdt\\n\", \"1\\nw\\nx\\n\", \"3\\naba\\nbbb\\n\", \"49\\nssizfrtawiuefcgtrrapgoivdxmmipwvdtqggsczdipnkzpoi\\nrdasfwpzpwtmsdxcgizcvidpgiuorkvigisaenttgfipmrzqp\\n\", \"50\\nzyzxzyzwzyzxzyzvzyzxzyzwzyzxzyzuzyzxzyzwzyzxzyzvzy\\nwxzyzzzyzyvzzvyzxxzxxwzuzzzzzyzyzzxyyzzzywzxzzyzyy\\n\", \"50\\nbabaababbaabbabaabbaababbaabbabaababbabaabbaababba\\nbaababbaabbabaababbabaabbaacabbaabbabaabbaababbaba\\n\", \"100\\nmntyyerijtaaditfyqvxstrwxoxglpaubigaggtrepaegniybvfmssawvhrgjjhwwkwuqhtyrimxvokcstyllbhlcursvgfafpts\\nbsgmhsgavsbgtwiiqaigmtyjxihphxdlseeajfywugawigrjruttuykthfrvwagpcsxlxsopnarqcvetnbtvfrvlyymwoyelrlta\\n\", \"2\\nvb\\nbw\\n\", \"5\\nutwra\\nvbtru\\n\", \"7\\nvhypglg\\nvprhflx\\n\", \"4\\nxnsd\\nnwcs\\n\", \"50\\nyfjtdvbotbvocjdqxeztqirfjbpqmswjhkqdiapwvrqqjisqch\\nhcqsijqqrvwpaidqkhjwsmqpbjfriqtzdxqdjcovbtobvdtjfy\\n\", \"8\\nabbabaab\\nbaacaaba\\n\", \"50\\nhcqsijqqrvwpaidqkhjwsmqobjfriqtzdxqdjcovbtobvdtjfy\\njzxptqvjqqqiiitqrikjmdhsscqjwwfabqdyboocjvdhbdfprt\\n\", \"6\\nabacbb\\nbbcbab\\n\", \"50\\nabaabacaabaababaababaabaababaabaababaababaabaababa\\nbabbbaaaaabbbabaaaaabbbabaaaabaabbaaabaabbaaaaaaba\\n\", \"8\\nabbaaabb\\nabaaabab\\n\", \"50\\nyfjtdvbotbvocjdqxdztqirfjbpqmswjhkqeiapwvrqqjisqch\\ncioksjixqqwayfjbqtsqdjphdjzudtijvprtohcqbvmwfqrdqb\\n\", \"8\\nvnjdcatu\\nuiacnvet\\n\", \"3\\nxhh\\nhgx\\n\", \"3\\naaa\\nbbb\\n\", \"49\\nssizfrtawiuefcgtrrapgoivdxmmipwvdtqggsczdipnkzpoh\\nrdasfwpzpwtmsdxcgizcvidpgiuorkvigisaenttgfipmrzqp\\n\", \"50\\nzyzxzyzwzyzxzyzvzyzxzyzwzyzxzyzuzyzxzyzwzyzxzyzvzy\\nwxzyzzzyzyvzzvyzxxzxwwzuzzzzzyzyzzxyyzzzywzxzzyzyy\\n\", \"50\\nbabaababbaabbabaabbabbabbaabbabaababbabaabbaababba\\nbaababbaabbabaababbabaabbaacabbaabbabaabbaababbaba\\n\", \"100\\nmntyyerijtaaditfyqvxstrwxoxglpaubigaggtrepaegniybvfmssawvhrgjjhwwkwuqhtyrimxvokcstyllbhlcursvgfafpts\\nbsgmhsgavsbgtwiiqaigmtyrxihphxdlseeajfywugawigjjruttuykthfrvwagpcsxlxsopnarqcvetnbtvfrvlyymwoyelrlta\\n\", \"2\\nbv\\nbw\\n\", \"5\\nvtwra\\nvbtru\\n\", \"7\\nvhypglg\\nvplhfrx\\n\", \"4\\nxnsd\\nnvcs\\n\", \"50\\nyfjtdvbotbvocjdqxeztqirfjbpqmswjhkqdiapwvrqqjisqcg\\nhcqsijqqrvwpaidqkhjwsmqpbjfriqtzdxqdjcovbtobvdtjfy\\n\", \"8\\nbaababba\\nbaacaaba\\n\", \"99\\nwfnzqqhlocpmxtagkbtgxlvuyaaotjylmpolrgamoqutfbuhycsdcfroksuhnbrbmvtpmkmbtaksjxzezelaynbknvqlcojgojb\\nlwostrblgqgjsnanjfltolyoztqnmlyejuocyojcxsgebcauompmprsqtbmdfkbmhuhkzrakqgvzuaklvbmtanvxahbbfpckoxy\\n\", \"50\\nhcqsijqqrvwpaidqkhjwsmqobjfriqtzdxqdjcovbtobvdtjfy\\njzjptqvjqqqiiitqrikjmdhsscqxwwfabqdyboocjvdhbdfprt\\n\", \"6\\nbbcaba\\nbbcbab\\n\", \"50\\nababaabaababaababaabaababaabaababaababaabaacabaaba\\nbabbbaaaaabbbabaaaaabbbabaaaabaabbaaabaabbaaaaaaba\\n\", \"50\\nyfjtdvbotbvocjdqxdztqirfjbpqwswjhkqeiapmvrqqjisqch\\ncioksjixqqwayfjbqtsqdjphdjzudtijvprtohcqbvmwfqrdqb\\n\", \"8\\nvnjecatu\\nuiacnvet\\n\", \"1\\ny\\nx\\n\", \"3\\nhhx\\nhgx\\n\", \"49\\nssizfrtawiuefcgtrrapgoivdxmmipwvdtqggsczdipnkzpoh\\nrdasfwpzpwtmrdxcgizcvidpgiuorkvigisaenttgfipmrzqp\\n\", \"50\\nzyzxzyzwzyzxzyzvzyzxzyzwzyzxzyzuzyzxzyzwzyzxzyzvzy\\nyyzyzzxzwyzzzyyxzzyzyzzzzzuzwwxzxxzyvzzvyzyzzzyzxw\\n\", \"50\\nbabaababbaabbabaabbabbabbaabbabaababbabaabbaababba\\nbaababbaabbabaababbabaabbaacabbbabbabaabbaababbaba\\n\", \"100\\nmntyyerijtaaditfyqvxstrwuoxglpaubigaggtrepaegniybvfmssawvhrgjjhwwkwxqhtyrimxvokcstyllbhlcursvgfafpts\\nbsgmhsgavsbgtwiiqaigmtyrxihphxdlseeajfywugawigjjruttuykthfrvwagpcsxlxsopnarqcvetnbtvfrvlyymwoyelrlta\\n\", \"6\\nabacbb\\nbabcba\\n\", \"3\\naba\\nbba\\n\"], \"outputs\": [\"147\\n29 1 49 15 1 49 31 1 49 30 1 49 41 1 49 47 1 49 48 1 49 44 1 49 38 1 49 39 1 49 36 1 49 16 1 49 33 1 49 42 1 49 40 1 49 37 1 49 42 1 49 36 1 49 33 1 49 23 1 49 29 1 49 33 1 49 42 1 49 43 1 49 42 1 49 48 1 49 45 1 49 36 1 49 40 1 49 46 1 49 45 1 49 31 1 49 33 1 49 47 1 49 43 1 49 39 1 49 43 1 49 41 1 49 44 1 49 48 1 49 42 1 49 48 1 49 43 1 49 46 1 49 45 1 49 46 1 49 48 1 49 47 1 49 48 1 49 \", \"150\\n42 1 50 46 1 50 49 1 50 49 1 50 49 1 50 49 1 50 48 1 50 49 1 50 49 1 50 49 1 50 44 1 50 49 1 50 48 1 50 15 1 50 48 1 50 49 1 50 48 1 50 41 1 50 49 1 50 49 1 50 36 1 50 38 1 50 49 1 50 43 1 50 49 1 50 48 1 50 48 1 50 48 1 50 47 1 50 49 1 50 47 1 50 49 1 50 48 1 50 48 1 50 42 1 50 48 1 50 45 1 50 49 1 50 48 1 50 48 1 50 48 1 50 49 1 50 49 1 50 46 1 50 49 1 50 49 1 50 49 1 50 48 1 50 49 1 50 49 1 50 \", \"150\\n48 1 50 49 1 50 48 1 50 49 1 50 48 1 50 49 1 50 48 1 50 49 1 50 48 1 50 49 1 50 48 1 50 49 1 50 48 1 50 49 1 50 48 1 50 49 1 50 48 1 50 49 1 50 48 1 50 49 1 50 48 1 50 49 1 50 48 1 50 49 1 50 48 1 50 49 1 50 48 1 50 49 1 50 48 1 50 49 1 50 48 1 50 49 1 50 48 1 50 49 1 50 48 1 50 49 1 50 48 1 50 49 1 50 48 1 50 49 1 50 48 1 50 49 1 50 48 1 50 49 1 50 48 1 50 49 1 50 48 1 50 49 1 50 48 1 50 49 1 50 \", \"300\\n67 1 100 88 1 100 93 1 100 70 1 100 46 1 100 96 1 100 88 1 100 89 1 100 98 1 100 98 1 100 95 1 100 86 1 100 99 1 100 91 1 100 98 1 100 86 1 100 74 1 100 96 1 100 72 1 100 96 1 100 92 1 100 95 1 100 94 1 100 72 1 100 94 1 100 73 1 100 63 1 100 83 1 100 58 1 100 81 1 100 64 1 100 88 1 100 51 1 100 83 1 100 81 1 100 98 1 100 56 1 100 78 1 100 84 1 100 94 1 100 97 1 100 82 1 100 80 1 100 89 1 100 71 1 100 81 1 100 92 1 100 66 1 100 87 1 100 95 1 100 87 1 100 84 1 100 62 1 100 93 1 100 86 1 100 95 1 100 91 1 100 62 1 100 96 1 100 98 1 100 70 1 100 91 1 100 73 1 100 86 1 100 99 1 100 75 1 100 82 1 100 87 1 100 81 1 100 69 1 100 89 1 100 91 1 100 94 1 100 96 1 100 85 1 100 82 1 100 95 1 100 96 1 100 88 1 100 96 1 100 83 1 100 85 1 100 95 1 100 90 1 100 91 1 100 94 1 100 89 1 100 98 1 100 93 1 100 92 1 100 90 1 100 96 1 100 94 1 100 96 1 100 99 1 100 97 1 100 97 1 100 97 1 100 99 1 100 99 1 100 \", \"6\\n1 1 2 1 1 2 \", \"15\\n2 1 5 1 1 5 2 1 5 3 1 5 4 1 5 \", \"-1\", \"12\\n2 1 4 3 1 4 2 1 4 3 1 4 \", \"150\\n49 1 50 49 1 50 49 1 50 49 1 50 49 1 50 49 1 50 49 1 50 49 1 50 49 1 50 49 1 50 49 1 50 49 1 50 49 1 50 49 1 50 49 1 50 49 1 50 49 1 50 49 1 50 49 1 50 49 1 50 49 1 50 49 1 50 49 1 50 49 1 50 49 1 50 49 1 50 49 1 50 49 1 50 49 1 50 49 1 50 49 1 50 49 1 50 49 1 50 49 1 50 49 1 50 49 1 50 49 1 50 49 1 50 49 1 50 49 1 50 49 1 50 49 1 50 49 1 50 49 1 50 49 1 50 49 1 50 49 1 50 49 1 50 49 1 50 49 1 50 \", \"24\\n7 1 8 6 1 8 7 1 8 6 1 8 7 1 8 7 1 8 6 1 8 7 1 8 \", \"24\\n6 1 8 7 1 8 6 1 8 7 1 8 6 1 8 7 1 8 6 1 8 7 1 8 \", \"297\\n91 1 99 1 1 99 91 1 99 87 1 99 83 1 99 66 1 99 67 1 99 95 1 99 97 1 99 95 1 99 87 1 99 78 1 99 59 1 99 74 1 99 86 1 99 82 1 99 37 1 99 76 1 99 67 1 99 92 1 99 98 1 99 56 1 99 93 1 99 85 1 99 92 1 99 76 1 99 77 1 99 83 1 99 80 1 99 60 1 99 93 1 99 49 1 99 37 1 99 81 1 99 96 1 99 80 1 99 89 1 99 46 1 99 40 1 99 56 1 99 60 1 99 79 1 99 62 1 99 68 1 99 94 1 99 49 1 99 91 1 99 77 1 99 90 1 99 96 1 99 98 1 99 86 1 99 98 1 99 95 1 99 81 1 99 69 1 99 95 1 99 95 1 99 95 1 99 64 1 99 79 1 99 88 1 99 97 1 99 72 1 99 96 1 99 96 1 99 95 1 99 95 1 99 85 1 99 79 1 99 94 1 99 83 1 99 96 1 99 93 1 99 94 1 99 87 1 99 83 1 99 92 1 99 93 1 99 94 1 99 92 1 99 97 1 99 84 1 99 89 1 99 97 1 99 89 1 99 96 1 99 94 1 99 97 1 99 92 1 99 97 1 99 95 1 99 98 1 99 97 1 99 94 1 99 96 1 99 97 1 99 98 1 99 98 1 99 \", \"-1\", \"18\\n4 1 6 5 1 6 3 1 6 5 1 6 4 1 6 5 1 6 \", \"150\\n49 1 50 49 1 50 49 1 50 49 1 50 48 1 50 47 1 50 47 1 50 46 1 50 49 1 50 49 1 50 48 1 50 47 1 50 49 1 50 47 1 50 47 1 50 46 1 50 49 1 50 49 1 50 47 1 50 47 1 50 49 1 50 47 1 50 47 1 50 46 1 50 45 1 50 49 1 50 46 1 50 49 1 50 49 1 50 49 1 50 48 1 50 48 1 50 47 1 50 46 1 50 46 1 50 49 1 50 46 1 50 49 1 50 49 1 50 49 1 50 48 1 50 48 1 50 47 1 50 47 1 50 46 1 50 49 1 50 49 1 50 49 1 50 48 1 50 49 1 50 \", \"24\\n7 1 8 7 1 8 7 1 8 7 1 8 6 1 8 7 1 8 6 1 8 7 1 8 \", \"150\\n37 1 50 29 1 50 34 1 50 19 1 50 46 1 50 48 1 50 19 1 50 37 1 50 49 1 50 40 1 50 23 1 50 23 1 50 43 1 50 49 1 50 49 1 50 46 1 50 40 1 50 49 1 50 21 1 50 47 1 50 29 1 50 42 1 50 41 1 50 39 1 50 30 1 50 49 1 50 29 1 50 42 1 50 44 1 50 42 1 50 35 1 50 35 1 50 42 1 50 41 1 50 45 1 50 38 1 50 39 1 50 37 1 50 49 1 50 49 1 50 42 1 50 45 1 50 48 1 50 49 1 50 48 1 50 49 1 50 49 1 50 47 1 50 48 1 50 49 1 50 \", \"24\\n7 1 8 7 1 8 7 1 8 7 1 8 7 1 8 7 1 8 7 1 8 7 1 8 \", \"24\\n8 6 1 8 4 1 8 2 1 8 7 1 8 4 1 8 7 1 8 6 1 8 7 1 \", \"0\\n\", \"9\\n2 1 3 2 1 3 2 1 3 \", \"-1\\n\", \"150\\n48 1 50 45 1 50 49 1 50 43 1 50 49 1 50 48 1 50 46 1 50 49 1 50 48 1 50 45 1 50 49 1 50 48 1 50 48 1 50 45 1 50 42 1 50 48 1 50 49 1 50 49 1 50 42 1 50 49 1 50 40 1 50 49 1 50 48 1 50 47 1 50 46 1 50 46 1 50 44 1 50 49 1 50 49 1 50 48 1 50 46 1 50 49 1 50 49 1 50 47 1 50 49 1 50 47 1 50 48 1 50 49 1 50 49 1 50 41 1 50 48 1 50 49 1 50 46 1 50 49 1 50 48 1 50 48 1 50 46 1 50 49 1 50 48 1 50 49 1 50\\n\", \"24\\n6 1 8 5 1 8 7 1 8 5 1 8 7 1 8 6 1 8 7 1 8 7 1 8\\n\", \"297\\n91 1 99 1 1 99 91 1 99 87 1 99 83 1 99 66 1 99 67 1 99 95 1 99 97 1 99 95 1 99 87 1 99 78 1 99 59 1 99 74 1 99 86 1 99 52 1 99 37 1 99 72 1 99 93 1 99 83 1 99 91 1 99 98 1 99 86 1 99 76 1 99 67 1 99 92 1 99 91 1 99 39 1 99 68 1 99 93 1 99 91 1 99 76 1 99 37 1 99 92 1 99 51 1 99 67 1 99 81 1 99 48 1 99 40 1 99 52 1 99 93 1 99 62 1 99 90 1 99 81 1 99 92 1 99 49 1 99 75 1 99 94 1 99 86 1 99 89 1 99 98 1 99 69 1 99 98 1 99 63 1 99 88 1 99 80 1 99 87 1 99 96 1 99 87 1 99 78 1 99 92 1 99 98 1 99 95 1 99 70 1 99 90 1 99 94 1 99 86 1 99 90 1 99 98 1 99 71 1 99 87 1 99 98 1 99 82 1 99 81 1 99 94 1 99 85 1 99 96 1 99 90 1 99 97 1 99 81 1 99 93 1 99 98 1 99 87 1 99 93 1 99 92 1 99 87 1 99 97 1 99 95 1 99 98 1 99 94 1 99 97 1 99 96 1 99 95 1 99 96 1 99 94 1 99 95 1 99 96 1 99 97 1 99 98 1 99\\n\", \"18\\n5 1 6 5 1 6 4 1 6 4 1 6 5 1 6 5 1 6\\n\", \"150\\n48 1 50 49 1 50 47 1 50 46 1 50 44 1 50 49 1 50 49 1 50 49 1 50 49 1 50 49 1 50 47 1 50 46 1 50 44 1 50 49 1 50 44 1 50 49 1 50 49 1 50 49 1 50 49 1 50 49 1 50 47 1 50 45 1 50 44 1 50 49 1 50 43 1 50 49 1 50 49 1 50 49 1 50 49 1 50 45 1 50 49 1 50 49 1 50 46 1 50 44 1 50 49 1 50 49 1 50 49 1 50 46 1 50 49 1 50 49 1 50 46 1 50 44 1 50 49 1 50 49 1 50 49 1 50 49 1 50 49 1 50 49 1 50 49 1 50 49 1 50\\n\", \"24\\n7 1 8 7 1 8 7 1 8 7 1 8 7 1 8 6 1 8 7 1 8 7 1 8\\n\", \"24\\n7 1 8 5 1 8 7 1 8 7 1 8 7 1 8 7 1 8 7 1 8 7 1 8\\n\", \"9\\n1 1 3 1 1 3 2 1 3\\n\", \"18\\n5 1 6 3 1 6 4 1 6 5 1 6 5 1 6 5 1 6\\n\", \"24\\n6 1 8 5 1 8 7 1 8 5 1 8 5 1 8 6 1 8 7 1 8 7 1 8\\n\", \"297\\n91 1 99 92 1 99 92 1 99 88 1 99 84 1 99 67 1 99 68 1 99 83 1 99 97 1 99 90 1 99 87 1 99 79 1 99 60 1 99 70 1 99 90 1 99 53 1 99 38 1 99 76 1 99 75 1 99 94 1 99 74 1 99 74 1 99 95 1 99 72 1 99 63 1 99 92 1 99 91 1 99 40 1 99 73 1 99 76 1 99 80 1 99 83 1 99 36 1 99 90 1 99 91 1 99 98 1 99 91 1 99 53 1 99 39 1 99 87 1 99 91 1 99 96 1 99 91 1 99 47 1 99 82 1 99 92 1 99 89 1 99 85 1 99 59 1 99 81 1 99 79 1 99 98 1 99 74 1 99 97 1 99 90 1 99 85 1 99 89 1 99 96 1 99 98 1 99 82 1 99 85 1 99 92 1 99 97 1 99 84 1 99 87 1 99 98 1 99 86 1 99 96 1 99 72 1 99 97 1 99 91 1 99 98 1 99 87 1 99 80 1 99 93 1 99 78 1 99 86 1 99 88 1 99 90 1 99 89 1 99 97 1 99 89 1 99 93 1 99 90 1 99 86 1 99 98 1 99 91 1 99 91 1 99 89 1 99 98 1 99 92 1 99 91 1 99 95 1 99 94 1 99 94 1 99 96 1 99 97 1 99 98 1 99 98 1 99\\n\", \"3\\n0 1 1\\n\", \"18\\n2 1 6 4 1 6 5 1 6 5 1 6 4 1 6 5 1 6\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"18\\n4 1 6 5 1 6 3 1 6 5 1 6 4 1 6 5 1 6 \", \"-1\"]}", "source": "primeintellect"}
Welcome to another task about breaking the code lock! Explorers Whitfield and Martin came across an unusual safe, inside of which, according to rumors, there are untold riches, among which one can find the solution of the problem of discrete logarithm! Of course, there is a code lock is installed on the safe. The lock has a screen that displays a string of n lowercase Latin letters. Initially, the screen displays string s. Whitfield and Martin found out that the safe will open when string t will be displayed on the screen. The string on the screen can be changed using the operation «shift x». In order to apply this operation, explorers choose an integer x from 0 to n inclusive. After that, the current string p = αβ changes to βRα, where the length of β is x, and the length of α is n - x. In other words, the suffix of the length x of string p is reversed and moved to the beginning of the string. For example, after the operation «shift 4» the string «abcacb» will be changed with string «bcacab », since α = ab, β = cacb, βR = bcac. Explorers are afraid that if they apply too many operations «shift», the lock will be locked forever. They ask you to find a way to get the string t on the screen, using no more than 6100 operations. Input The first line contains an integer n, the length of the strings s and t (1 ≤ n ≤ 2 000). After that, there are two strings s and t, consisting of n lowercase Latin letters each. Output If it is impossible to get string t from string s using no more than 6100 operations «shift», print a single number - 1. Otherwise, in the first line output the number of operations k (0 ≤ k ≤ 6100). In the next line output k numbers xi corresponding to the operations «shift xi» (0 ≤ xi ≤ n) in the order in which they should be applied. Examples Input 6 abacbb babcba Output 4 6 3 2 3 Input 3 aba bba Output -1 Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [\"20\\n4 13\\n17 7\\n19 10\\n18 1\\n5 15\\n2 6\\n11 7\\n3 6\\n5 1\\n20 16\\n12 5\\n10 17\\n14 18\\n8 13\\n13 15\\n19 1\\n9 19\\n6 13\\n17 20\\n14 12 4 2 3 9 8 11 16\\n\", \"37\\n27 3\\n27 35\\n6 8\\n12 21\\n4 7\\n32 27\\n27 17\\n24 14\\n1 10\\n3 23\\n20 8\\n12 4\\n16 33\\n2 34\\n15 36\\n5 31\\n31 14\\n5 9\\n8 28\\n29 12\\n33 35\\n24 10\\n18 25\\n33 18\\n2 37\\n17 5\\n36 29\\n12 26\\n20 26\\n22 11\\n23 8\\n15 30\\n34 6\\n13 7\\n22 4\\n23 19\\n37 11 9 32 28 16 21 30 25 19 13\\n\", \"3\\n1 2\\n1 3\\n2 3\\n\", \"8\\n4 3\\n6 7\\n8 6\\n6 1\\n4 6\\n6 5\\n6 2\\n3 2 7 8 5\\n\", \"10\\n8 10\\n2 1\\n7 5\\n5 4\\n6 10\\n2 3\\n3 10\\n2 9\\n7 2\\n6 9 4 8\\n\", \"8\\n4 3\\n1 4\\n8 5\\n7 6\\n3 5\\n7 3\\n4 2\\n2 6 8\\n\", \"4\\n1 2\\n1 3\\n1 4\\n4 3 2\\n\", \"51\\n28 3\\n42 40\\n40 51\\n48 20\\n13 28\\n18 40\\n44 40\\n22 5\\n22 27\\n45 34\\n40 9\\n34 46\\n40 34\\n22 1\\n22 11\\n40 7\\n28 40\\n40 22\\n14 40\\n34 30\\n40 20\\n47 40\\n12 34\\n28 23\\n40 24\\n40 43\\n41 40\\n28 15\\n49 32\\n40 8\\n32 10\\n40 50\\n40 36\\n40 21\\n16 33\\n40 38\\n34 2\\n28 16\\n34 4\\n17 34\\n19 40\\n32 35\\n40 29\\n6 40\\n40 39\\n22 26\\n37 40\\n32 40\\n31 20\\n34 25\\n35 15 7 9 12 31 36 50 19 17 29 46 5 42 8 13 10 24 44 25 41 2 38 23 43 30 18 3 26 47 37 11 39 33 49 14 4 45 6 51 48 21 27\\n\", \"5\\n1 2\\n4 3\\n1 4\\n4 5\\n5 2 3\\n\", \"3\\n1 2\\n1 3\\n3 2\\n\", \"51\\n28 3\\n42 40\\n40 51\\n48 20\\n13 28\\n18 40\\n44 40\\n22 5\\n22 27\\n45 34\\n40 9\\n34 46\\n40 34\\n22 1\\n22 11\\n40 7\\n28 40\\n40 22\\n14 40\\n34 30\\n40 20\\n47 40\\n12 34\\n28 23\\n40 24\\n40 43\\n41 40\\n28 15\\n49 32\\n40 8\\n32 10\\n40 50\\n40 36\\n40 21\\n16 33\\n40 38\\n34 2\\n28 16\\n34 4\\n17 34\\n19 40\\n32 35\\n40 29\\n6 40\\n40 39\\n22 26\\n37 40\\n32 40\\n31 20\\n34 25\\n35 15 7 9 12 31 36 50 19 17 29 46 5 42 8 13 10 24 44 25 41 2 38 23 43 30 18 3 26 47 37 11 39 33 49 14 4 45 6 51 48 30 27\\n\", \"8\\n4 3\\n6 7\\n8 6\\n4 1\\n4 6\\n6 5\\n6 2\\n3 2 7 8 5\\n\", \"51\\n28 3\\n42 40\\n40 51\\n48 20\\n13 28\\n18 40\\n44 40\\n22 5\\n22 27\\n45 34\\n40 9\\n34 46\\n40 34\\n22 1\\n22 11\\n40 7\\n28 40\\n40 22\\n14 40\\n34 30\\n40 20\\n47 40\\n12 34\\n28 23\\n40 24\\n40 43\\n41 40\\n28 15\\n49 32\\n40 8\\n32 10\\n40 50\\n40 36\\n40 21\\n16 33\\n40 38\\n34 2\\n28 16\\n34 4\\n17 34\\n19 40\\n32 35\\n40 29\\n6 40\\n40 39\\n22 26\\n37 40\\n32 40\\n31 20\\n34 25\\n35 15 7 9 12 31 36 50 19 17 29 46 5 42 9 13 10 24 44 25 41 2 38 23 43 30 18 3 26 47 37 11 39 33 49 14 4 45 6 51 48 21 27\\n\", \"51\\n28 3\\n42 40\\n40 51\\n48 20\\n13 28\\n18 40\\n44 40\\n22 5\\n22 27\\n45 34\\n40 9\\n34 46\\n40 34\\n22 1\\n22 11\\n40 7\\n28 40\\n40 22\\n14 40\\n34 30\\n40 20\\n47 40\\n12 34\\n28 23\\n40 24\\n40 43\\n41 40\\n28 15\\n49 32\\n40 8\\n32 10\\n40 50\\n40 36\\n40 21\\n16 33\\n40 38\\n34 2\\n28 16\\n34 4\\n17 34\\n19 40\\n32 35\\n40 29\\n6 40\\n40 39\\n22 26\\n37 40\\n32 40\\n31 20\\n34 25\\n35 15 7 9 12 31 36 50 19 17 29 46 5 42 14 13 10 24 44 25 41 2 38 23 43 30 18 3 26 47 37 11 39 33 49 14 4 45 6 51 48 21 27\\n\", \"51\\n28 3\\n42 40\\n40 51\\n48 20\\n13 28\\n18 40\\n44 40\\n22 5\\n22 27\\n45 34\\n40 9\\n34 46\\n40 34\\n22 1\\n22 11\\n40 7\\n28 40\\n40 22\\n14 40\\n34 30\\n40 20\\n47 40\\n12 34\\n28 23\\n40 24\\n40 43\\n41 40\\n28 15\\n49 32\\n40 8\\n32 10\\n40 50\\n40 36\\n40 21\\n16 33\\n40 38\\n34 2\\n28 16\\n34 4\\n17 34\\n19 40\\n32 35\\n40 29\\n6 40\\n40 39\\n22 26\\n37 40\\n32 40\\n31 20\\n34 25\\n35 15 7 9 12 31 36 50 19 17 29 46 5 42 14 13 10 24 44 25 41 2 38 14 43 30 18 3 26 47 37 11 39 33 49 14 4 45 6 51 48 21 27\\n\", \"51\\n28 3\\n42 40\\n40 51\\n48 20\\n13 28\\n18 40\\n44 40\\n22 5\\n22 27\\n45 34\\n40 9\\n34 46\\n40 34\\n22 1\\n22 11\\n40 7\\n28 40\\n40 22\\n14 40\\n34 30\\n40 20\\n47 40\\n12 34\\n28 23\\n40 24\\n40 43\\n41 40\\n28 15\\n49 32\\n40 8\\n32 10\\n40 50\\n40 36\\n40 21\\n16 33\\n40 38\\n34 2\\n28 16\\n34 4\\n17 34\\n19 40\\n32 35\\n40 29\\n6 40\\n40 39\\n22 26\\n37 40\\n32 40\\n31 20\\n34 25\\n35 15 7 9 12 31 36 50 19 17 29 46 5 42 14 4 10 24 44 25 41 2 38 14 43 30 18 3 26 47 37 11 39 33 49 14 4 45 6 51 48 21 27\\n\", \"51\\n28 3\\n42 40\\n40 51\\n48 20\\n13 28\\n18 40\\n44 40\\n22 5\\n22 27\\n45 34\\n40 9\\n34 46\\n40 34\\n22 1\\n22 11\\n40 7\\n28 40\\n40 22\\n14 40\\n34 30\\n40 20\\n47 40\\n12 34\\n28 23\\n40 24\\n40 43\\n41 40\\n28 15\\n49 32\\n40 8\\n32 10\\n40 50\\n40 36\\n40 21\\n16 33\\n40 38\\n34 2\\n28 16\\n34 4\\n17 34\\n19 40\\n32 35\\n40 29\\n6 40\\n40 39\\n22 26\\n37 40\\n32 40\\n31 20\\n34 25\\n35 15 7 9 12 31 36 50 19 17 29 46 5 42 14 4 10 21 44 25 41 2 38 14 43 30 18 3 26 47 37 11 39 33 49 14 4 45 6 51 48 21 27\\n\", \"51\\n28 3\\n42 40\\n40 51\\n48 20\\n13 28\\n18 40\\n44 40\\n22 5\\n22 27\\n45 34\\n40 9\\n34 46\\n40 34\\n22 1\\n22 11\\n40 7\\n28 40\\n40 22\\n14 40\\n34 30\\n40 20\\n47 40\\n12 34\\n28 23\\n40 24\\n40 43\\n41 40\\n28 15\\n49 32\\n40 8\\n32 10\\n40 50\\n40 36\\n40 21\\n16 33\\n40 38\\n34 2\\n28 16\\n34 4\\n17 34\\n19 40\\n32 35\\n40 29\\n6 40\\n40 39\\n22 26\\n37 40\\n32 40\\n31 20\\n34 25\\n35 15 7 9 12 31 36 50 19 17 29 46 5 42 8 13 10 24 44 25 41 2 38 23 43 30 18 6 26 47 37 11 39 33 49 14 4 45 6 51 48 30 27\\n\", \"51\\n28 3\\n42 40\\n40 51\\n48 20\\n13 28\\n18 40\\n44 40\\n22 5\\n22 27\\n45 34\\n40 9\\n34 46\\n40 34\\n22 1\\n22 11\\n40 7\\n28 40\\n40 22\\n14 40\\n34 30\\n40 20\\n47 40\\n12 34\\n28 23\\n40 24\\n40 43\\n41 40\\n28 15\\n49 32\\n40 8\\n32 10\\n40 50\\n40 36\\n40 21\\n16 33\\n40 38\\n34 2\\n28 16\\n34 4\\n17 34\\n19 40\\n32 35\\n40 29\\n6 40\\n40 39\\n22 26\\n37 40\\n32 40\\n31 20\\n34 25\\n35 15 7 9 12 31 36 50 19 17 29 46 5 42 14 4 10 21 44 25 41 2 38 14 43 30 18 3 26 47 12 11 39 33 49 14 4 45 6 51 48 21 27\\n\", \"51\\n28 3\\n42 40\\n40 51\\n48 20\\n13 28\\n18 40\\n44 40\\n22 5\\n22 27\\n45 34\\n40 9\\n34 46\\n40 34\\n22 1\\n22 11\\n40 7\\n28 40\\n40 22\\n14 40\\n34 30\\n40 20\\n47 40\\n12 34\\n28 23\\n40 24\\n40 43\\n41 40\\n28 15\\n49 32\\n40 8\\n32 10\\n40 50\\n40 36\\n40 21\\n16 33\\n40 38\\n34 2\\n28 16\\n34 4\\n17 34\\n19 40\\n32 35\\n40 29\\n6 40\\n40 39\\n22 26\\n37 40\\n32 40\\n31 20\\n34 25\\n35 15 7 9 12 31 36 50 19 17 29 46 5 42 14 4 10 21 44 25 41 2 38 14 43 30 18 3 26 47 37 11 39 33 49 14 7 45 6 51 48 21 27\\n\", \"51\\n28 3\\n42 40\\n1 51\\n48 20\\n13 28\\n18 40\\n44 40\\n22 5\\n22 27\\n45 34\\n40 9\\n34 46\\n40 34\\n22 1\\n22 11\\n40 7\\n28 40\\n40 22\\n14 40\\n34 30\\n40 20\\n47 40\\n12 34\\n28 23\\n40 24\\n40 43\\n41 40\\n28 15\\n49 32\\n40 8\\n32 10\\n40 50\\n40 36\\n40 21\\n16 33\\n40 38\\n34 2\\n28 16\\n34 4\\n17 34\\n19 40\\n32 35\\n40 29\\n6 40\\n40 39\\n22 26\\n37 40\\n32 40\\n31 20\\n34 25\\n35 15 7 9 12 31 36 50 19 17 29 46 5 42 14 4 10 24 44 25 41 2 38 14 43 30 18 3 26 47 37 11 39 33 49 14 4 45 6 51 48 21 27\\n\", \"51\\n28 3\\n42 40\\n40 51\\n48 20\\n13 32\\n18 40\\n44 40\\n22 5\\n22 27\\n45 34\\n40 9\\n34 46\\n40 34\\n22 1\\n22 11\\n40 7\\n28 40\\n40 22\\n14 40\\n34 30\\n40 20\\n47 40\\n12 34\\n28 23\\n40 24\\n40 43\\n41 40\\n28 15\\n49 32\\n40 8\\n32 10\\n40 50\\n40 36\\n40 21\\n16 33\\n40 38\\n34 2\\n28 16\\n34 4\\n17 34\\n19 40\\n32 35\\n40 29\\n6 40\\n40 39\\n22 26\\n37 40\\n32 40\\n31 20\\n34 25\\n35 15 7 9 12 31 36 50 19 17 29 46 5 42 8 13 10 24 44 25 41 2 38 23 43 30 18 3 26 47 37 11 39 33 49 14 4 45 6 51 48 30 27\\n\", \"51\\n28 3\\n42 40\\n40 51\\n48 20\\n13 28\\n18 40\\n44 40\\n22 5\\n22 27\\n45 34\\n40 9\\n34 46\\n16 34\\n22 1\\n22 11\\n40 7\\n28 40\\n40 22\\n14 40\\n34 30\\n40 20\\n47 40\\n12 34\\n28 23\\n40 24\\n40 43\\n41 40\\n28 15\\n49 32\\n40 8\\n32 10\\n40 50\\n40 36\\n40 21\\n16 33\\n40 38\\n34 2\\n28 16\\n34 4\\n17 34\\n19 40\\n32 35\\n40 29\\n6 40\\n40 39\\n22 26\\n37 40\\n32 40\\n31 20\\n34 25\\n35 15 7 9 12 31 36 50 19 17 29 46 5 42 14 13 10 24 44 25 41 2 38 23 43 30 18 3 26 47 37 11 39 33 49 14 4 45 6 51 48 21 27\\n\", \"51\\n28 3\\n42 40\\n40 51\\n48 20\\n13 28\\n18 40\\n44 40\\n22 5\\n22 27\\n45 34\\n40 9\\n34 46\\n40 34\\n22 1\\n22 11\\n40 7\\n28 40\\n40 22\\n14 40\\n34 30\\n40 20\\n47 40\\n12 34\\n28 23\\n40 24\\n40 43\\n41 40\\n28 15\\n49 32\\n40 8\\n32 10\\n40 50\\n40 36\\n40 21\\n16 33\\n40 38\\n34 2\\n28 16\\n1 4\\n17 34\\n19 40\\n32 35\\n40 29\\n6 40\\n40 39\\n22 26\\n37 40\\n32 40\\n31 20\\n34 25\\n35 15 7 9 12 31 36 50 19 17 29 46 5 42 8 13 10 24 44 25 41 2 38 23 43 30 18 3 26 47 37 11 39 33 49 14 4 45 6 51 48 30 27\\n\", \"51\\n28 3\\n42 40\\n40 51\\n48 20\\n13 28\\n18 40\\n44 40\\n22 5\\n22 27\\n45 34\\n40 9\\n34 46\\n40 34\\n20 1\\n22 11\\n40 7\\n28 40\\n40 22\\n14 40\\n34 30\\n40 20\\n47 40\\n12 34\\n28 23\\n40 24\\n40 43\\n41 40\\n28 15\\n49 32\\n40 8\\n32 10\\n40 50\\n40 36\\n40 21\\n16 33\\n40 38\\n34 2\\n28 16\\n34 4\\n17 34\\n19 40\\n32 35\\n40 29\\n6 40\\n40 39\\n22 26\\n37 40\\n32 40\\n31 20\\n34 25\\n35 15 7 9 12 31 36 50 19 17 29 46 5 42 14 13 10 24 44 25 41 2 38 14 43 30 18 3 26 47 37 11 39 33 49 14 4 45 6 51 48 21 27\\n\", \"51\\n28 3\\n42 40\\n40 51\\n48 20\\n13 28\\n18 40\\n44 40\\n22 5\\n22 27\\n45 34\\n40 9\\n34 46\\n40 34\\n22 1\\n22 11\\n40 7\\n28 40\\n40 22\\n14 40\\n34 30\\n40 20\\n47 40\\n12 34\\n28 23\\n40 24\\n40 43\\n41 40\\n28 15\\n49 32\\n40 8\\n32 10\\n40 50\\n40 36\\n40 21\\n16 33\\n40 38\\n34 2\\n28 16\\n34 4\\n17 34\\n19 40\\n32 35\\n40 29\\n6 40\\n40 39\\n22 26\\n37 40\\n32 40\\n31 20\\n34 25\\n35 15 7 9 12 31 36 50 19 17 29 46 5 42 9 13 10 24 44 25 41 2 33 23 43 30 18 3 26 47 37 11 39 33 49 14 4 45 6 51 48 21 27\\n\", \"51\\n28 3\\n42 40\\n40 51\\n48 20\\n13 28\\n18 40\\n44 40\\n22 5\\n22 27\\n45 34\\n40 9\\n34 46\\n40 34\\n22 1\\n22 11\\n40 7\\n28 40\\n40 22\\n14 40\\n34 30\\n40 20\\n47 40\\n12 34\\n28 23\\n40 24\\n40 43\\n41 40\\n28 15\\n49 32\\n40 8\\n32 10\\n40 50\\n40 36\\n40 21\\n16 33\\n40 38\\n34 2\\n28 16\\n34 4\\n17 34\\n19 40\\n32 35\\n40 29\\n6 40\\n40 39\\n22 26\\n37 40\\n32 40\\n31 20\\n34 25\\n35 15 7 9 12 31 36 50 7 17 29 46 5 42 14 4 10 24 44 25 41 2 38 14 43 30 18 3 26 47 37 11 39 33 49 14 4 45 6 51 48 21 27\\n\", \"51\\n28 3\\n42 40\\n40 51\\n48 20\\n13 28\\n18 22\\n44 40\\n22 5\\n22 27\\n45 34\\n40 9\\n34 46\\n40 34\\n22 1\\n22 11\\n40 7\\n28 40\\n40 22\\n14 40\\n34 30\\n40 20\\n47 40\\n12 34\\n28 23\\n40 24\\n40 43\\n41 40\\n28 15\\n49 32\\n40 8\\n32 10\\n40 50\\n40 36\\n40 21\\n16 33\\n40 38\\n34 2\\n28 16\\n34 4\\n17 34\\n19 40\\n32 35\\n40 29\\n6 40\\n40 39\\n22 26\\n37 40\\n32 40\\n31 20\\n34 25\\n35 15 7 9 12 31 36 50 19 17 29 46 5 42 14 4 10 21 44 25 41 2 38 14 43 30 18 3 26 47 37 11 39 33 49 14 4 45 6 51 48 21 27\\n\", \"51\\n28 3\\n42 40\\n40 51\\n48 20\\n13 28\\n18 40\\n44 40\\n22 5\\n22 27\\n45 34\\n40 9\\n34 46\\n40 34\\n22 1\\n22 11\\n40 7\\n28 40\\n40 22\\n14 40\\n34 30\\n40 20\\n47 40\\n12 34\\n28 23\\n40 24\\n40 43\\n41 40\\n28 15\\n49 32\\n40 8\\n32 10\\n40 50\\n40 36\\n40 21\\n16 33\\n40 38\\n34 2\\n28 16\\n34 4\\n17 34\\n19 40\\n32 35\\n40 29\\n6 40\\n40 39\\n22 26\\n37 40\\n32 40\\n31 20\\n34 25\\n35 15 7 9 12 46 36 50 19 17 29 46 5 42 9 13 10 24 44 25 41 2 33 23 43 30 18 3 26 47 37 11 39 33 49 14 4 45 6 51 48 21 27\\n\", \"51\\n28 3\\n42 40\\n40 51\\n48 20\\n13 28\\n18 40\\n44 40\\n22 5\\n32 27\\n45 34\\n40 9\\n34 46\\n40 34\\n22 1\\n22 11\\n40 7\\n28 40\\n40 22\\n14 40\\n34 30\\n40 20\\n47 40\\n12 34\\n28 23\\n40 24\\n40 43\\n41 40\\n28 15\\n49 32\\n40 8\\n32 10\\n40 50\\n40 36\\n40 21\\n16 33\\n40 38\\n34 2\\n28 16\\n34 4\\n17 34\\n19 40\\n32 35\\n40 29\\n6 40\\n40 39\\n22 26\\n37 40\\n32 40\\n31 20\\n34 25\\n35 15 7 9 12 31 36 50 19 17 29 46 5 42 14 4 10 21 44 25 41 2 38 14 43 30 18 3 26 47 12 11 39 33 49 14 4 45 6 51 48 21 27\\n\", \"51\\n28 3\\n42 40\\n40 51\\n48 20\\n13 28\\n18 40\\n44 40\\n22 5\\n22 27\\n45 34\\n40 9\\n34 46\\n40 34\\n20 1\\n22 11\\n40 7\\n28 40\\n40 22\\n14 40\\n34 30\\n40 20\\n47 40\\n12 34\\n28 23\\n40 24\\n40 43\\n41 40\\n28 15\\n49 32\\n40 8\\n32 10\\n40 50\\n40 36\\n40 21\\n16 33\\n40 38\\n34 2\\n28 16\\n34 4\\n17 34\\n19 40\\n32 35\\n40 29\\n6 40\\n40 39\\n22 26\\n37 40\\n32 40\\n31 20\\n34 25\\n35 15 7 9 12 31 36 50 19 17 29 46 5 42 14 13 14 24 44 25 41 2 38 14 43 30 18 3 26 47 37 11 39 33 49 14 4 45 6 51 48 21 27\\n\", \"51\\n28 3\\n42 40\\n40 51\\n48 20\\n13 28\\n18 40\\n44 40\\n22 5\\n22 27\\n45 34\\n40 9\\n34 46\\n40 34\\n22 1\\n22 11\\n40 7\\n28 40\\n40 22\\n14 40\\n34 30\\n40 20\\n47 40\\n12 34\\n28 23\\n40 24\\n40 43\\n41 40\\n28 15\\n49 32\\n40 8\\n32 10\\n40 50\\n40 36\\n40 21\\n16 33\\n40 38\\n34 2\\n28 16\\n34 4\\n17 34\\n19 40\\n32 35\\n40 29\\n6 40\\n40 39\\n22 26\\n37 40\\n32 40\\n31 20\\n34 25\\n35 15 7 9 12 31 36 50 19 17 29 46 5 42 9 13 10 24 44 25 41 2 33 23 43 30 18 3 26 47 37 11 39 43 49 14 4 45 6 51 48 21 27\\n\", \"51\\n28 3\\n42 40\\n40 51\\n48 20\\n13 28\\n18 40\\n44 40\\n22 5\\n22 27\\n45 34\\n40 9\\n34 46\\n40 34\\n22 1\\n22 11\\n40 7\\n28 40\\n40 22\\n14 40\\n34 30\\n40 20\\n47 40\\n12 34\\n28 23\\n40 24\\n40 43\\n41 40\\n28 15\\n49 32\\n40 8\\n32 10\\n40 50\\n40 36\\n40 21\\n16 33\\n40 38\\n34 2\\n28 16\\n34 4\\n17 34\\n19 40\\n32 35\\n40 29\\n6 40\\n40 39\\n22 26\\n37 40\\n32 40\\n31 20\\n34 25\\n3 15 7 9 12 31 36 50 19 17 29 46 5 42 8 13 10 24 44 25 41 2 38 23 43 30 18 3 26 47 37 11 39 33 49 14 4 45 6 51 48 21 27\\n\", \"51\\n28 3\\n42 40\\n40 51\\n48 20\\n13 28\\n18 40\\n44 40\\n22 5\\n22 27\\n45 34\\n40 9\\n34 46\\n40 34\\n22 1\\n22 11\\n40 7\\n28 40\\n40 22\\n14 40\\n34 30\\n40 20\\n47 40\\n12 34\\n28 23\\n40 24\\n40 43\\n41 40\\n28 15\\n49 32\\n40 8\\n32 10\\n40 50\\n40 36\\n40 21\\n16 33\\n40 38\\n34 2\\n28 16\\n34 4\\n17 34\\n19 40\\n32 35\\n40 29\\n6 40\\n40 39\\n22 26\\n37 40\\n32 40\\n31 20\\n34 25\\n35 15 7 9 12 31 36 50 19 17 29 46 5 42 12 13 10 24 44 25 41 2 38 23 43 30 18 3 26 47 37 11 39 33 49 14 4 45 6 51 48 30 27\\n\", \"51\\n28 3\\n42 40\\n40 51\\n48 20\\n13 28\\n18 40\\n44 40\\n22 5\\n22 27\\n45 34\\n40 9\\n34 46\\n40 34\\n20 1\\n22 11\\n40 7\\n28 40\\n40 22\\n14 40\\n34 30\\n40 20\\n47 40\\n12 34\\n28 23\\n40 24\\n40 43\\n41 40\\n28 15\\n49 32\\n40 8\\n32 10\\n40 50\\n40 36\\n40 21\\n16 33\\n40 38\\n34 2\\n28 16\\n34 4\\n17 34\\n19 40\\n32 35\\n40 29\\n6 40\\n40 39\\n22 26\\n37 40\\n32 40\\n31 20\\n34 25\\n35 15 7 9 12 31 36 50 19 17 29 46 5 42 14 13 10 24 44 25 41 2 38 14 43 30 18 3 26 47 37 11 39 33 49 2 4 45 6 51 48 21 27\\n\", \"51\\n28 3\\n42 40\\n40 51\\n48 20\\n13 28\\n18 40\\n44 40\\n22 5\\n22 27\\n45 34\\n40 9\\n34 46\\n40 34\\n22 1\\n22 11\\n40 7\\n28 40\\n40 22\\n14 40\\n34 30\\n40 20\\n47 40\\n12 34\\n28 23\\n40 24\\n40 43\\n41 40\\n28 15\\n49 32\\n40 8\\n32 10\\n40 50\\n40 36\\n40 21\\n16 33\\n40 38\\n34 2\\n28 16\\n34 4\\n17 34\\n19 40\\n32 35\\n40 29\\n6 40\\n40 39\\n22 26\\n37 40\\n32 40\\n31 20\\n34 25\\n3 15 7 9 12 31 36 50 19 17 29 46 5 42 8 13 10 24 44 25 41 2 38 23 43 30 18 3 26 47 37 11 39 33 49 14 4 45 10 51 48 21 27\\n\", \"51\\n28 3\\n42 40\\n40 51\\n48 20\\n13 32\\n18 40\\n44 40\\n22 5\\n22 27\\n45 34\\n40 9\\n34 46\\n40 34\\n22 1\\n22 11\\n40 7\\n28 40\\n40 22\\n14 40\\n34 30\\n40 20\\n47 40\\n12 34\\n28 23\\n40 24\\n40 43\\n41 40\\n28 15\\n49 32\\n40 8\\n32 10\\n40 50\\n40 36\\n40 21\\n16 33\\n40 38\\n34 2\\n28 16\\n34 4\\n17 34\\n19 40\\n32 35\\n40 29\\n6 40\\n40 39\\n22 26\\n37 40\\n32 40\\n31 20\\n34 25\\n35 15 7 9 12 31 36 50 19 17 29 46 5 42 5 13 10 24 44 25 41 2 38 23 43 30 18 3 26 47 37 11 39 33 49 14 4 45 6 51 48 30 27\\n\", \"51\\n28 3\\n42 40\\n40 51\\n48 20\\n13 28\\n18 40\\n44 40\\n22 5\\n22 27\\n45 34\\n40 9\\n34 46\\n40 34\\n22 1\\n22 11\\n40 7\\n28 40\\n40 22\\n14 40\\n34 30\\n40 20\\n47 40\\n12 34\\n28 23\\n40 24\\n40 43\\n41 40\\n28 15\\n49 32\\n40 8\\n32 10\\n40 50\\n40 36\\n40 21\\n16 33\\n40 38\\n34 2\\n28 16\\n34 4\\n17 34\\n19 40\\n32 35\\n40 29\\n6 40\\n40 39\\n22 26\\n37 40\\n32 40\\n31 20\\n34 25\\n35 15 7 9 12 31 36 50 19 17 29 46 5 42 9 13 10 24 44 25 41 2 33 23 43 30 18 3 26 47 10 11 39 33 49 14 4 45 6 51 48 21 27\\n\", \"6\\n1 2\\n1 3\\n2 4\\n4 5\\n4 6\\n5 6 3\\n\", \"3\\n1 2\\n2 3\\n3\\n\", \"6\\n1 2\\n1 3\\n2 4\\n4 5\\n4 6\\n5 3 6\\n\"], \"outputs\": [\"-1\", \"-1\", \"1 2 1 3 1 \", \"1 6 4 3 4 6 2 6 7 6 8 6 5 6 1 \", \"-1\", \"1 4 2 4 3 7 6 7 3 5 8 5 3 4 1 \", \"1 4 1 3 1 2 1 \", \"-1\", \"-1\", \"1 3 1 2 1 \", \"-1\\n\", \"1 4 3 4 6 2 6 7 6 8 6 5 6 4 1 \\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"1 2 4 5 4 6 4 2 1 3 1 \", \"1 2 3 2 1 \", \"-1\"]}", "source": "primeintellect"}
Connected undirected graph without cycles is called a tree. Trees is a class of graphs which is interesting not only for people, but for ants too. An ant stands at the root of some tree. He sees that there are n vertexes in the tree, and they are connected by n - 1 edges so that there is a path between any pair of vertexes. A leaf is a distinct from root vertex, which is connected with exactly one other vertex. The ant wants to visit every vertex in the tree and return to the root, passing every edge twice. In addition, he wants to visit the leaves in a specific order. You are to find some possible route of the ant. Input The first line contains integer n (3 ≤ n ≤ 300) — amount of vertexes in the tree. Next n - 1 lines describe edges. Each edge is described with two integers — indexes of vertexes which it connects. Each edge can be passed in any direction. Vertexes are numbered starting from 1. The root of the tree has number 1. The last line contains k integers, where k is amount of leaves in the tree. These numbers describe the order in which the leaves should be visited. It is guaranteed that each leaf appears in this order exactly once. Output If the required route doesn't exist, output -1. Otherwise, output 2n - 1 numbers, describing the route. Every time the ant comes to a vertex, output it's index. Examples Input 3 1 2 2 3 3 Output 1 2 3 2 1 Input 6 1 2 1 3 2 4 4 5 4 6 5 6 3 Output 1 2 4 5 4 6 4 2 1 3 1 Input 6 1 2 1 3 2 4 4 5 4 6 5 3 6 Output -1 Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0.25
{"tests": "{\"inputs\": [[1965], [1938], [1998], [2016], [1924], [1968], [2162], [6479], [3050], [6673], [6594], [9911], [2323], [3448], [1972]], \"outputs\": [[\"Wood Snake\"], [\"Earth Tiger\"], [\"Earth Tiger\"], [\"Fire Monkey\"], [\"Wood Rat\"], [\"Earth Monkey\"], [\"Water Dog\"], [\"Earth Goat\"], [\"Metal Dog\"], [\"Water Rooster\"], [\"Wood Tiger\"], [\"Metal Goat\"], [\"Water Rabbit\"], [\"Earth Rat\"], [\"Water Rat\"]]}", "source": "primeintellect"}
The [Chinese zodiac](https://en.wikipedia.org/wiki/Chinese_zodiac) is a repeating cycle of 12 years, with each year being represented by an animal and its reputed attributes. The lunar calendar is divided into cycles of 60 years each, and each year has a combination of an animal and an element. There are 12 animals and 5 elements; the animals change each year, and the elements change every 2 years. The current cycle was initiated in the year of 1984 which was the year of the Wood Rat. Since the current calendar is Gregorian, I will only be using years from the epoch 1924. *For simplicity I am counting the year as a whole year and not from January/February to the end of the year.* ##Task Given a year, return the element and animal that year represents ("Element Animal"). For example I'm born in 1998 so I'm an "Earth Tiger". ```animals``` (or ```$animals``` in Ruby) is a preloaded array containing the animals in order: ```['Rat', 'Ox', 'Tiger', 'Rabbit', 'Dragon', 'Snake', 'Horse', 'Goat', 'Monkey', 'Rooster', 'Dog', 'Pig']``` ```elements``` (or ```$elements``` in Ruby) is a preloaded array containing the elements in order: ```['Wood', 'Fire', 'Earth', 'Metal', 'Water']``` Tell me your zodiac sign and element in the comments. Happy coding :) Write your solution by modifying this code: ```python def chinese_zodiac(year): ``` Your solution should implemented in the function "chinese_zodiac". The i Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [\"3 9\\n500\\n300\\n800\\n200\\n100\\n600\\n900\\n700\\n400\\n4 3\\n1000\\n1000\\n1010\\n0 0\", \"3 9\\n500\\n311\\n800\\n335\\n100\\n600\\n900\\n700\\n400\\n4 3\\n1000\\n1000\\n1010\\n0 0\", \"3 9\\n559\\n311\\n800\\n335\\n100\\n563\\n900\\n700\\n400\\n4 3\\n1000\\n1000\\n1010\\n0 0\", \"3 9\\n500\\n300\\n800\\n200\\n100\\n600\\n900\\n1032\\n400\\n4 3\\n1000\\n1000\\n1000\\n0 0\", \"3 9\\n500\\n300\\n800\\n200\\n000\\n600\\n900\\n700\\n400\\n4 3\\n1000\\n1000\\n1010\\n0 0\", \"3 9\\n500\\n253\\n800\\n335\\n100\\n600\\n900\\n700\\n400\\n4 3\\n1000\\n1000\\n1010\\n0 0\", \"3 9\\n559\\n311\\n800\\n335\\n110\\n600\\n900\\n700\\n400\\n4 3\\n1000\\n1000\\n1010\\n0 0\", \"3 9\\n559\\n311\\n656\\n335\\n100\\n563\\n900\\n700\\n400\\n4 3\\n1000\\n1000\\n1010\\n0 0\", \"3 9\\n500\\n300\\n800\\n200\\n100\\n871\\n900\\n1032\\n400\\n4 3\\n1000\\n1000\\n1000\\n0 0\", \"3 9\\n500\\n300\\n800\\n200\\n001\\n600\\n900\\n700\\n400\\n4 3\\n1000\\n1000\\n1010\\n0 0\", \"3 9\\n500\\n253\\n800\\n335\\n100\\n600\\n900\\n700\\n400\\n4 3\\n1000\\n1000\\n1110\\n0 0\", \"3 9\\n559\\n311\\n800\\n335\\n110\\n600\\n900\\n587\\n400\\n4 3\\n1000\\n1000\\n1010\\n0 0\", \"3 9\\n500\\n300\\n800\\n200\\n100\\n871\\n485\\n1032\\n400\\n4 3\\n1000\\n1000\\n1000\\n0 0\", \"3 9\\n500\\n300\\n800\\n200\\n001\\n600\\n900\\n700\\n400\\n4 3\\n1000\\n1000\\n1110\\n0 0\", \"3 9\\n500\\n230\\n800\\n335\\n100\\n600\\n900\\n700\\n400\\n4 3\\n1000\\n1000\\n1110\\n0 0\", \"3 9\\n500\\n300\\n800\\n200\\n101\\n871\\n485\\n1032\\n400\\n4 3\\n1000\\n1000\\n1000\\n0 0\", \"3 9\\n500\\n300\\n357\\n200\\n001\\n600\\n900\\n700\\n400\\n4 3\\n1000\\n1000\\n1110\\n0 0\", \"6 9\\n500\\n230\\n800\\n335\\n100\\n600\\n900\\n700\\n400\\n4 3\\n1000\\n1000\\n1110\\n0 0\", \"3 9\\n559\\n128\\n800\\n335\\n110\\n600\\n900\\n587\\n400\\n4 3\\n1010\\n1000\\n1010\\n0 0\", \"3 9\\n500\\n300\\n800\\n200\\n111\\n871\\n485\\n1032\\n400\\n4 3\\n1000\\n1000\\n1000\\n0 0\", \"3 9\\n500\\n148\\n800\\n200\\n100\\n600\\n900\\n700\\n675\\n7 3\\n1010\\n1000\\n1010\\n0 0\", \"6 9\\n500\\n230\\n800\\n335\\n101\\n600\\n900\\n700\\n400\\n4 3\\n1000\\n1000\\n1110\\n0 0\", \"3 9\\n559\\n128\\n800\\n335\\n110\\n600\\n900\\n587\\n400\\n4 3\\n1010\\n1000\\n1110\\n0 0\", \"3 9\\n870\\n300\\n800\\n200\\n111\\n871\\n485\\n1032\\n400\\n4 3\\n1000\\n1000\\n1000\\n0 0\", \"3 9\\n559\\n128\\n800\\n100\\n111\\n600\\n900\\n587\\n586\\n4 3\\n1010\\n1000\\n1110\\n0 0\", \"3 9\\n359\\n300\\n800\\n200\\n100\\n600\\n900\\n700\\n400\\n4 3\\n1000\\n1000\\n1000\\n0 0\", \"3 9\\n500\\n57\\n800\\n200\\n100\\n600\\n900\\n700\\n400\\n4 3\\n1000\\n1000\\n1010\\n0 0\", \"3 9\\n500\\n311\\n800\\n88\\n100\\n600\\n900\\n700\\n400\\n4 3\\n1000\\n1000\\n1010\\n0 0\", \"3 9\\n559\\n69\\n800\\n335\\n100\\n600\\n900\\n700\\n400\\n4 3\\n1000\\n1000\\n1010\\n0 0\", \"3 9\\n559\\n311\\n800\\n335\\n100\\n563\\n900\\n555\\n400\\n4 3\\n1000\\n1000\\n1010\\n0 0\", \"3 9\\n559\\n311\\n656\\n335\\n100\\n563\\n900\\n700\\n400\\n4 3\\n1000\\n1000\\n0010\\n0 0\", \"3 9\\n500\\n300\\n800\\n200\\n100\\n871\\n900\\n1032\\n400\\n4 3\\n1010\\n1000\\n1000\\n0 0\", \"3 9\\n500\\n471\\n800\\n200\\n101\\n600\\n900\\n700\\n400\\n4 3\\n1010\\n1000\\n1010\\n0 0\", \"3 9\\n500\\n253\\n800\\n335\\n100\\n600\\n900\\n237\\n400\\n4 3\\n1000\\n1000\\n1110\\n0 0\", \"2 9\\n559\\n311\\n800\\n335\\n110\\n600\\n900\\n587\\n400\\n4 3\\n1000\\n1000\\n1010\\n0 0\", \"3 9\\n968\\n300\\n800\\n200\\n001\\n600\\n900\\n700\\n400\\n4 3\\n1000\\n1000\\n1110\\n0 0\", \"3 9\\n500\\n230\\n800\\n335\\n100\\n1094\\n900\\n700\\n400\\n4 3\\n1000\\n1000\\n1110\\n0 0\", \"3 9\\n500\\n471\\n800\\n190\\n100\\n600\\n900\\n700\\n675\\n7 3\\n1010\\n1000\\n1010\\n0 0\", \"6 9\\n500\\n230\\n800\\n335\\n100\\n1198\\n900\\n700\\n400\\n4 3\\n1000\\n1000\\n1110\\n0 0\", \"3 9\\n439\\n128\\n800\\n335\\n110\\n600\\n900\\n587\\n400\\n4 3\\n1010\\n1000\\n1010\\n0 0\", \"3 9\\n500\\n148\\n800\\n200\\n100\\n600\\n1461\\n700\\n675\\n7 3\\n1010\\n1000\\n1010\\n0 0\", \"6 9\\n500\\n230\\n800\\n335\\n101\\n600\\n900\\n700\\n400\\n4 3\\n1000\\n1000\\n1100\\n0 0\", \"3 9\\n766\\n128\\n800\\n335\\n110\\n600\\n900\\n587\\n586\\n4 3\\n1010\\n1000\\n1110\\n0 0\", \"3 9\\n434\\n128\\n800\\n100\\n111\\n600\\n900\\n587\\n586\\n4 3\\n1010\\n1000\\n1110\\n0 0\", \"3 9\\n359\\n300\\n800\\n200\\n100\\n600\\n1340\\n700\\n400\\n4 3\\n1000\\n1000\\n1000\\n0 0\", \"3 9\\n500\\n57\\n800\\n200\\n101\\n600\\n900\\n700\\n400\\n4 3\\n1000\\n1000\\n1010\\n0 0\", \"3 9\\n500\\n465\\n800\\n335\\n100\\n950\\n900\\n700\\n400\\n4 3\\n1000\\n1000\\n1010\\n0 0\", \"3 9\\n559\\n311\\n800\\n335\\n100\\n563\\n900\\n555\\n400\\n4 3\\n1000\\n1000\\n1000\\n0 0\", \"3 9\\n1051\\n300\\n800\\n200\\n100\\n600\\n900\\n1032\\n400\\n4 3\\n1000\\n1000\\n1000\\n0 0\", \"3 9\\n848\\n300\\n800\\n200\\n000\\n600\\n900\\n700\\n466\\n4 3\\n1000\\n1000\\n1010\\n0 0\", \"3 9\\n559\\n311\\n800\\n335\\n110\\n17\\n900\\n700\\n400\\n4 3\\n1000\\n0000\\n1010\\n0 0\", \"3 9\\n559\\n311\\n656\\n335\\n100\\n563\\n159\\n700\\n400\\n4 3\\n1000\\n1000\\n0010\\n0 0\", \"3 9\\n500\\n300\\n800\\n274\\n100\\n871\\n900\\n1032\\n400\\n4 3\\n1010\\n1000\\n1000\\n0 0\", \"3 9\\n500\\n471\\n800\\n243\\n101\\n600\\n900\\n700\\n400\\n4 3\\n1010\\n1000\\n1010\\n0 0\", \"2 9\\n559\\n311\\n800\\n335\\n110\\n600\\n900\\n587\\n400\\n4 3\\n1000\\n1100\\n1010\\n0 0\", \"3 9\\n500\\n471\\n800\\n14\\n100\\n600\\n900\\n700\\n675\\n4 3\\n1010\\n1000\\n1000\\n0 0\", \"3 9\\n500\\n300\\n800\\n200\\n101\\n410\\n485\\n1032\\n400\\n8 3\\n1000\\n1000\\n1000\\n0 0\", \"3 9\\n500\\n21\\n357\\n200\\n001\\n600\\n1219\\n700\\n400\\n4 3\\n1000\\n1000\\n1110\\n0 0\", \"3 9\\n559\\n128\\n800\\n335\\n111\\n600\\n900\\n587\\n864\\n1 3\\n1010\\n1000\\n1110\\n0 0\", \"3 9\\n559\\n44\\n800\\n335\\n100\\n600\\n900\\n700\\n712\\n4 3\\n1000\\n1000\\n1010\\n0 0\", \"3 9\\n559\\n311\\n800\\n335\\n100\\n563\\n900\\n555\\n400\\n4 3\\n1000\\n1000\\n1100\\n0 0\", \"3 9\\n1051\\n300\\n800\\n200\\n100\\n600\\n900\\n1032\\n400\\n4 3\\n1000\\n1000\\n1001\\n0 0\", \"3 9\\n500\\n471\\n800\\n243\\n101\\n600\\n1523\\n700\\n400\\n4 3\\n1010\\n1000\\n1010\\n0 0\", \"3 9\\n500\\n253\\n800\\n335\\n100\\n600\\n900\\n237\\n403\\n4 3\\n1000\\n1000\\n1111\\n0 0\", \"3 9\\n881\\n300\\n800\\n200\\n101\\n410\\n485\\n1032\\n400\\n8 3\\n1000\\n1000\\n1000\\n0 0\", \"3 9\\n27\\n471\\n800\\n24\\n100\\n600\\n900\\n700\\n675\\n7 3\\n1010\\n1000\\n1010\\n0 0\", \"11 9\\n500\\n281\\n800\\n335\\n101\\n600\\n900\\n700\\n400\\n4 3\\n1000\\n1000\\n1100\\n0 0\", \"3 9\\n810\\n128\\n800\\n100\\n111\\n600\\n900\\n587\\n586\\n4 3\\n1000\\n1000\\n1110\\n0 0\", \"3 9\\n500\\n159\\n800\\n335\\n100\\n841\\n900\\n700\\n400\\n4 3\\n1000\\n1000\\n1010\\n0 0\", \"4 9\\n559\\n44\\n800\\n335\\n100\\n600\\n900\\n700\\n712\\n4 3\\n1000\\n1000\\n1010\\n0 0\", \"3 9\\n1660\\n300\\n800\\n200\\n000\\n786\\n900\\n700\\n466\\n4 3\\n1000\\n1000\\n1010\\n0 0\", \"3 9\\n559\\n311\\n800\\n335\\n110\\n26\\n336\\n700\\n400\\n4 3\\n1000\\n0000\\n1010\\n0 0\", \"3 9\\n571\\n311\\n656\\n335\\n100\\n563\\n14\\n700\\n400\\n4 3\\n1000\\n1000\\n0010\\n0 0\", \"6 9\\n500\\n230\\n800\\n500\\n110\\n1094\\n900\\n700\\n400\\n4 3\\n1000\\n1000\\n1110\\n0 0\", \"3 9\\n881\\n300\\n800\\n200\\n101\\n168\\n485\\n1032\\n400\\n8 3\\n1000\\n1000\\n1000\\n0 0\", \"3 9\\n766\\n128\\n800\\n510\\n110\\n600\\n900\\n880\\n586\\n3 3\\n1010\\n1000\\n1110\\n0 0\", \"3 9\\n810\\n128\\n800\\n100\\n111\\n848\\n900\\n587\\n586\\n4 3\\n1000\\n1000\\n1110\\n0 0\", \"3 9\\n500\\n159\\n800\\n516\\n100\\n841\\n900\\n700\\n400\\n4 3\\n1000\\n1000\\n1010\\n0 0\", \"6 9\\n559\\n311\\n800\\n335\\n101\\n563\\n900\\n555\\n400\\n4 3\\n1000\\n1000\\n1100\\n0 0\", \"3 9\\n559\\n311\\n800\\n335\\n110\\n26\\n336\\n403\\n400\\n4 3\\n1000\\n0000\\n1010\\n0 0\", \"3 9\\n571\\n311\\n656\\n335\\n100\\n563\\n14\\n122\\n400\\n4 3\\n1000\\n1000\\n0010\\n0 0\", \"3 9\\n500\\n300\\n800\\n274\\n100\\n80\\n355\\n1032\\n400\\n4 3\\n1010\\n1000\\n1100\\n0 0\", \"3 9\\n500\\n471\\n800\\n243\\n101\\n600\\n1523\\n700\\n430\\n4 3\\n1010\\n1000\\n1110\\n0 0\", \"6 9\\n500\\n230\\n800\\n500\\n110\\n131\\n900\\n700\\n400\\n4 3\\n1000\\n1000\\n1110\\n0 0\", \"4 9\\n359\\n300\\n800\\n200\\n000\\n600\\n1340\\n700\\n400\\n8 3\\n1000\\n1000\\n0000\\n0 0\", \"3 9\\n500\\n159\\n800\\n516\\n100\\n841\\n900\\n700\\n400\\n2 3\\n1000\\n1000\\n1010\\n0 0\", \"3 9\\n559\\n311\\n800\\n335\\n110\\n26\\n336\\n403\\n400\\n4 3\\n1000\\n0000\\n0010\\n0 0\", \"3 9\\n766\\n128\\n800\\n510\\n110\\n600\\n900\\n880\\n586\\n3 3\\n1010\\n1001\\n1111\\n0 0\", \"3 9\\n500\\n159\\n1090\\n516\\n100\\n841\\n900\\n700\\n400\\n2 3\\n1000\\n1000\\n1010\\n0 0\", \"3 9\\n447\\n300\\n800\\n274\\n110\\n80\\n355\\n1032\\n400\\n4 3\\n1010\\n1000\\n1100\\n0 0\", \"3 9\\n766\\n128\\n800\\n510\\n100\\n600\\n900\\n880\\n586\\n3 3\\n1010\\n1001\\n1111\\n0 0\", \"3 9\\n500\\n159\\n1090\\n516\\n100\\n841\\n900\\n700\\n400\\n2 3\\n1010\\n1000\\n1010\\n0 0\", \"3 9\\n571\\n311\\n656\\n335\\n100\\n563\\n14\\n122\\n512\\n4 3\\n1000\\n1000\\n1000\\n0 0\", \"6 9\\n500\\n522\\n800\\n81\\n110\\n131\\n900\\n700\\n400\\n4 3\\n1000\\n1000\\n1110\\n0 0\", \"3 9\\n500\\n159\\n1090\\n516\\n100\\n403\\n900\\n700\\n400\\n2 3\\n1010\\n1000\\n1010\\n0 0\", \"3 9\\n559\\n311\\n800\\n335\\n110\\n2\\n512\\n403\\n400\\n5 3\\n1000\\n0000\\n0010\\n0 0\", \"3 9\\n766\\n95\\n800\\n510\\n100\\n600\\n900\\n880\\n586\\n3 3\\n1010\\n1001\\n1011\\n0 0\", \"6 9\\n559\\n6\\n323\\n335\\n101\\n747\\n900\\n555\\n732\\n7 3\\n1000\\n1000\\n1101\\n0 0\", \"3 9\\n500\\n300\\n800\\n41\\n100\\n600\\n900\\n700\\n400\\n4 3\\n1000\\n1000\\n1010\\n0 0\", \"3 9\\n500\\n311\\n800\\n335\\n100\\n600\\n1173\\n700\\n400\\n4 3\\n1000\\n1000\\n1010\\n0 0\", \"3 9\\n500\\n300\\n800\\n200\\n100\\n600\\n900\\n700\\n400\\n4 3\\n1000\\n1000\\n1000\\n0 0\"], \"outputs\": [\"1800\\n1010\\n\", \"1935\\n1010\\n\", \"1898\\n1010\\n\", \"1800\\n1000\\n\", \"1700\\n1010\\n\", \"1888\\n1010\\n\", \"1945\\n1010\\n\", \"1861\\n1010\\n\", \"1871\\n1000\\n\", \"1701\\n1010\\n\", \"1888\\n1110\\n\", \"1887\\n1010\\n\", \"1656\\n1000\\n\", \"1701\\n1110\\n\", \"1865\\n1110\\n\", \"1657\\n1000\\n\", \"1500\\n1110\\n\", \"1035\\n1110\\n\", \"1822\\n1010\\n\", \"1667\\n1000\\n\", \"1648\\n1010\\n\", \"1036\\n1110\\n\", \"1822\\n1110\\n\", \"1970\\n1000\\n\", \"1611\\n1110\\n\", \"1659\\n1000\\n\", \"1600\\n1010\\n\", \"1688\\n1010\\n\", \"1763\\n1010\\n\", \"1855\\n1010\\n\", \"1861\\n1000\\n\", \"1871\\n1010\\n\", \"1801\\n1010\\n\", \"1553\\n1110\\n\", \"2487\\n1010\\n\", \"2000\\n1110\\n\", \"1994\\n1110\\n\", \"1790\\n1010\\n\", \"1198\\n1110\\n\", \"1702\\n1010\\n\", \"2061\\n1010\\n\", \"1036\\n1100\\n\", \"1945\\n1110\\n\", \"1573\\n1110\\n\", \"1940\\n1000\\n\", \"1601\\n1010\\n\", \"2000\\n1010\\n\", \"1855\\n1000\\n\", \"2151\\n1000\\n\", \"1948\\n1010\\n\", \"1670\\n1010\\n\", \"1526\\n1000\\n\", \"1874\\n1010\\n\", \"1844\\n1010\\n\", \"2487\\n1100\\n\", \"1771\\n1010\\n\", \"1600\\n1000\\n\", \"1679\\n1110\\n\", \"1822\\n3120\\n\", \"1738\\n1010\\n\", \"1855\\n1100\\n\", \"2151\\n1001\\n\", \"2123\\n1010\\n\", \"1553\\n1111\\n\", \"1917\\n1000\\n\", \"1500\\n1010\\n\", \"900\\n1100\\n\", \"1738\\n1110\\n\", \"1841\\n1010\\n\", \"1412\\n1010\\n\", \"2066\\n1010\\n\", \"1436\\n1010\\n\", \"1538\\n1000\\n\", \"1100\\n1110\\n\", \"1754\\n1000\\n\", \"2120\\n1110\\n\", \"1859\\n1110\\n\", \"1975\\n1010\\n\", \"955\\n1100\\n\", \"1245\\n1010\\n\", \"1099\\n1000\\n\", \"1600\\n1100\\n\", \"2123\\n1110\\n\", \"900\\n1110\\n\", \"1459\\n1000\\n\", \"1975\\n2000\\n\", \"1245\\n1000\\n\", \"2120\\n1111\\n\", \"2000\\n2000\\n\", \"1547\\n1100\\n\", \"2110\\n1111\\n\", \"2000\\n2010\\n\", \"1211\\n1000\\n\", \"1022\\n1110\\n\", \"1919\\n2010\\n\", \"1315\\n1000\\n\", \"2110\\n1011\\n\", \"900\\n1101\\n\", \"1641\\n1010\\n\", \"1946\\n1010\\n\", \"1800\\n1000\"]}", "source": "primeintellect"}
Taro is addicted to a novel. The novel has n volumes in total, and each volume has a different thickness. Taro likes this novel so much that he wants to buy a bookshelf dedicated to it. However, if you put a large bookshelf in the room, it will be quite small, so you have to devise to make the width of the bookshelf as small as possible. When I measured the height from the floor to the ceiling, I found that an m-level bookshelf could be placed. So, how can we divide the n volumes of novels to minimize the width of the bookshelf in m columns? Taro is particular about it, and the novels to be stored in each column must be arranged in the order of the volume numbers. .. Enter the number of bookshelves, the number of volumes of the novel, and the thickness of each book as input, and create a program to find the width of the bookshelf that has the smallest width that can accommodate all volumes in order from one volume. However, the size of the bookshelf frame is not included in the width. <image> Input A sequence of multiple datasets is given as input. The end of the input is indicated by two lines of zeros. Each dataset is given in the following format: m n w1 w2 :: wn The first line gives m (1 ≤ m ≤ 20) the number of bookshelves that can be placed in the room and n (1 ≤ n ≤ 100) the number of volumes in the novel. The next n lines are given the integer wi (1 ≤ wi ≤ 1000000), which represents the thickness of the book in Volume i. However, the width of the bookshelf shall not exceed 1500000. The number of datasets does not exceed 50. Output Outputs the minimum bookshelf width for each dataset on one line. Example Input 3 9 500 300 800 200 100 600 900 700 400 4 3 1000 1000 1000 0 0 Output 1800 1000 Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0.375
{"tests": "{\"inputs\": [\"8587340257\\n\", \"7420738134810\\n\", \"2975\\n\", \"1000000000000\\n\", \"236\\n\", \"27\\n\", \"9\\n\", \"3047527844089\\n\", \"16\\n\", \"5\\n\", \"614125\\n\", \"9999925100701\\n\", \"30971726\\n\", \"266418\\n\", \"401120980262\\n\", \"319757451841\\n\", \"1307514188557\\n\", \"128\\n\", \"99\\n\", \"1716443237161\\n\", \"2\\n\", \"445538663413\\n\", \"48855707\\n\", \"8\\n\", \"57461344602\\n\", \"5839252225\\n\", \"472670214391\\n\", \"388\\n\", \"44\\n\", \"9999926826034\\n\", \"3\\n\", \"2000000014\\n\", \"324\\n\", \"49380563\\n\", \"1408514752349\\n\", \"34280152201\\n\", \"12\\n\", \"1468526771489\\n\", \"1245373417369\\n\", \"25\\n\", \"50\\n\", \"4\\n\", \"7938986881993\\n\", \"802241960524\\n\", \"8110708459517\\n\", \"81\\n\", \"64\\n\", \"274875809788\\n\", \"5138168457911\\n\", \"6599669076000\\n\", \"13011346918\\n\", \"13238388573815\\n\", \"4705\\n\", \"1000001000000\\n\", \"170\\n\", \"4253451177073\\n\", \"7\\n\", \"35027531\\n\", \"101426139155\\n\", \"1355753871026\\n\", \"1922940728174\\n\", \"737865884431\\n\", \"4979776759\\n\", \"278700607\\n\", \"178355611463\\n\", \"49208291221\\n\", \"18\\n\", \"13354979718805\\n\", \"87515250434\\n\", \"392817100675\\n\", \"3313122184718\\n\", \"11532055646\\n\", \"2548670450115\\n\", \"1291252823775\\n\", \"69723427\\n\", \"1108066176259\\n\", \"4582681725818\\n\", \"4282420545821\\n\", \"780830935757\\n\", \"38\\n\", \"10\\n\", \"1004648\\n\", \"71267\\n\", \"533545799028\\n\", \"93\\n\", \"166\\n\", \"15\\n\", \"39563096\\n\", \"111675135032\\n\", \"620208712900\\n\", \"529\\n\", \"77\\n\", \"9179436705487\\n\", \"92\\n\", \"86797930\\n\", \"2478571625012\\n\", \"663460893820\\n\", \"20\\n\", \"35\\n\", \"14\\n\", \"10343352888547\\n\", \"74\\n\", \"13\\n\", \"11630071506575\\n\", \"23\\n\", \"11\\n\", \"1566\\n\", \"1000101000000\\n\", \"79\\n\", \"60\\n\", \"335869379484\\n\", \"825072\\n\", \"54249176\\n\", \"113691\\n\", \"173581860059\\n\", \"804890765868\\n\", \"1918977771565\\n\", \"68\\n\", \"186\\n\", \"1697519835832\\n\", \"77287943685\\n\", \"6575477646\\n\", \"545\\n\", \"46\\n\", \"3453116469991\\n\", \"69312720\\n\", \"57076685\\n\", \"160164802448\\n\", \"80287679180\\n\", \"896467519919\\n\", \"31\\n\", \"21\\n\", \"12428386645476\\n\", \"68644937579\\n\", \"240888750965\\n\", \"26\\n\", \"584546895652\\n\", \"24\\n\", \"2994750389\\n\", \"2408\\n\", \"1000101000010\\n\", \"126\\n\", \"65\\n\", \"654602147906\\n\", \"526692\\n\", \"10972111\\n\", \"195548\\n\", \"302918678725\\n\", \"727157507661\\n\", \"30\\n\", \"1\\n\", \"6\\n\"], \"outputs\": [\"1\\n9409\\n\", \"1\\n6\\n\", \"1\\n25\\n\", \"1\\n4\\n\", \"1\\n4\\n\", \"1\\n9\\n\", \"2\\n\", \"2\\n\", \"1\\n4\\n\", \"1\\n0\\n\", \"1\\n25\\n\", \"1\\n0\\n\", \"2\\n\", \"1\\n6\\n\", \"2\\n\", \"1\\n289\\n\", \"1\\n39283\\n\", \"1\\n4\\n\", \"1\\n9\\n\", \"1\\n5329\\n\", \"1\\n0\\n\", \"1\\n0\\n\", \"1\\n2603\\n\", \"1\\n4\\n\", \"1\\n6\\n\", \"1\\n25\\n\", \"1\\n23020027\\n\", \"1\\n4\\n\", \"1\\n4\\n\", \"2\\n\", \"1\\n0\\n\", \"2\\n\", \"1\\n4\\n\", \"1\\n289\\n\", \"1\\n72361\\n\", \"2\\n\", \"1\\n4\\n\", \"1\\n613783\\n\", \"1\\n908209\\n\", \"2\\n\", \"1\\n10\\n\", \"2\\n\", \"1\\n378028993\\n\", \"1\\n4\\n\", \"2\\n\", \"1\\n9\\n\", \"1\\n4\\n\", \"1\\n4\\n\", \"2\\n\", \"1\\n4\\n\", \"1\\n2566\\n\", \"1\\n115\\n\", \"2\\n\", \"1\\n4\\n\", \"1\\n10\\n\", \"1\\n3899\\n\", \"1\\n0\\n\", \"1\\n77\\n\", \"1\\n55\\n\", \"1\\n82\\n\", \"1\\n38\\n\", \"1\\n247\\n\", \"1\\n1081\\n\", \"1\\n2603\\n\", \"1\\n398269\\n\", \"1\\n374273\\n\", \"1\\n6\\n\", \"1\\n1205\\n\", \"1\\n38602\\n\", \"1\\n25\\n\", \"1\\n122\\n\", \"1\\n4138\\n\", \"1\\n15\\n\", \"1\\n9\\n\", \"1\\n3599\\n\", \"1\\n287\\n\", \"1\\n14\\n\", \"1\\n407\\n\", \"1\\n10921\\n\", \"2\\n\", \"2\\n\", \"1\\n4\\n\", \"2\\n\", \"1\\n4\\n\", \"2\\n\", \"2\\n\", \"2\\n\", \"1\\n4\\n\", \"1\\n4\\n\", \"1\\n4\\n\", \"2\\n\", \"2\\n\", \"2\\n\", \"1\\n4\\n\", \"1\\n10\\n\", \"1\\n4\\n\", \"1\\n4\\n\", \"1\\n4\\n\", \"2\\n\", \"2\\n\", \"2\\n\", \"2\\n\", \"1\\n0\\n\", \"1\\n25\\n\", \"1\\n0\\n\", \"1\\n0\\n\", \"1\\n6\\n\", \"1\\n4\\n\", \"1\\n0\\n\", \"1\\n4\\n\", \"1\\n4\\n\", \"1\\n4\\n\", \"1\\n4\\n\", \"2\\n\", \"2\\n\", \"1\\n4\\n\", \"1\\n115\\n\", \"1\\n4\\n\", \"1\\n6\\n\", \"1\\n4\\n\", \"1\\n15\\n\", \"1\\n6\\n\", \"2\\n\", \"2\\n\", \"2\\n\", \"1\\n4\\n\", \"1\\n115\\n\", \"1\\n4\\n\", \"1\\n4\\n\", \"2\\n\", \"1\\n0\\n\", \"2\\n\", \"1\\n4\\n\", \"2\\n\", \"1\\n115\\n\", \"2\\n\", \"1\\n4\\n\", \"1\\n4\\n\", \"2\\n\", \"1\\n4\\n\", \"1\\n10\\n\", \"1\\n6\\n\", \"2\\n\", \"1\\n14\\n\", \"1\\n4\\n\", \"2\\n\", \"1\\n4\\n\", \"1\\n25\\n\", \"1\\n9\\n\", \"1\\n6\\n\", \"1\\n0\\n\", \"2\\n\"]}", "source": "primeintellect"}
You can't possibly imagine how cold our friends are this winter in Nvodsk! Two of them play the following game to warm up: initially a piece of paper has an integer q. During a move a player should write any integer number that is a non-trivial divisor of the last written number. Then he should run this number of circles around the hotel. Let us remind you that a number's divisor is called non-trivial if it is different from one and from the divided number itself. The first person who can't make a move wins as he continues to lie in his warm bed under three blankets while the other one keeps running. Determine which player wins considering that both players play optimally. If the first player wins, print any winning first move. Input The first line contains the only integer q (1 ≤ q ≤ 1013). Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator. Output In the first line print the number of the winning player (1 or 2). If the first player wins then the second line should contain another integer — his first move (if the first player can't even make the first move, print 0). If there are multiple solutions, print any of them. Examples Input 6 Output 2 Input 30 Output 1 6 Input 1 Output 1 0 Note Number 6 has only two non-trivial divisors: 2 and 3. It is impossible to make a move after the numbers 2 and 3 are written, so both of them are winning, thus, number 6 is the losing number. A player can make a move and write number 6 after number 30; 6, as we know, is a losing number. Thus, this move will bring us the victory. Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [\"3\\n0 0 1 0 0 1 1 1\\n0 0 1 0 2 1 1 2\\n-1 1 1 0 0 1 0 -1\", \"3\\n0 1 1 0 0 1 1 1\\n-1 0 1 0 2 1 1 2\\n-1 1 0 0 0 1 0 -1\", \"3\\n0 1 1 0 0 1 1 1\\n-1 0 1 1 2 1 1 2\\n-1 1 0 0 0 1 0 -1\", \"3\\n0 1 1 0 0 1 1 1\\n-1 0 1 1 1 1 1 2\\n-1 1 0 0 0 0 0 -1\", \"3\\n0 2 1 0 0 1 1 1\\n-1 0 1 0 1 1 1 2\\n-1 1 0 -1 0 2 0 -1\", \"3\\n0 0 1 0 1 0 1 1\\n0 0 1 0 2 0 1 2\\n-1 1 1 -1 0 1 0 0\", \"3\\n-1 1 1 0 0 1 1 0\\n-1 0 1 0 3 1 1 2\\n-1 2 0 0 0 1 -1 -1\", \"3\\n0 1 4 0 0 1 1 2\\n-1 0 1 2 1 1 0 2\\n-1 1 -1 0 0 0 0 -1\", \"3\\n-1 1 1 0 0 1 1 0\\n-1 0 1 0 3 1 1 4\\n-1 2 0 -1 0 1 -1 -1\", \"3\\n-1 1 1 0 0 1 1 0\\n-1 0 0 0 3 1 1 4\\n-1 2 0 -1 0 1 -1 -1\", \"3\\n0 1 4 0 0 1 1 2\\n-1 0 1 8 1 1 0 2\\n-1 1 -1 0 0 0 0 -1\", \"3\\n0 1 4 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n\", \"0\\n0.8944271910\\n0\\n\", \"0\\n1.7888543820\\n0\\n\", \"0\\n0\\n1.0000000000\\n\", \"0\\n2.2188007849\\n0\\n\", \"0\\n3.0508510792\\n0\\n\", \"0\\n0.4850712501\\n1.0000000000\\n\", \"0.2425356250\\n0.4850712501\\n1.0000000000\\n\", \"0.2425356250\\n0.4850712501\\n0.7071067812\\n\", \"0.4472135955\\n3.0508510792\\n0\\n\", \"0.2425356250\\n0.7442084075\\n0.7071067812\\n\", \"0.4472135955\\n3.8829013736\\n0\\n\", \"0\\n1.4142135624\\n0.7071067812\\n\", \"1.0000000000\\n0\\n0\\n\", \"0\\n3.8829013736\\n0\\n\", \"0.2425356250\\n0.7442084075\\n0\\n\", \"0\\n1.4142135624\\n0.8944271910\\n\", \"0\\n0.7442084075\\n0\\n\", \"0\\n3.1568207490\\n0\\n\", \"0\\n0.7442084075\\n0.7071067812\\n\", \"0\\n0.7442084075\\n1.0000000000\\n\", \"0\\n2.8460498942\\n0\\n\", \"1.0000000000\\n0.7442084075\\n1.0000000000\\n\", \"0\\n3.5777087640\\n0\\n\", \"0.4472135955\\n3.5777087640\\n0\\n\", \"1.0000000000\\n0\\n0.3162277660\\n\", \"1.0000000000\\n0.5883484054\\n0.3162277660\\n\", \"0\\n3.5777087640\\n0.3287979746\\n\", \"0\\n0.5883484054\\n0.3162277660\\n\", \"0\\n0\\n0.3162277660\\n\", \"0\\n0\\n0.5883484054\\n\", \"1.0000000000\\n0\\n0.5883484054\\n\", \"0.4472135955\\n1.9727878477\\n0\\n\", \"1.3416407865\\n0\\n0.5883484054\\n\", \"0.8320502943\\n1.9727878477\\n0\\n\", \"1.4142135624\\n1.9727878477\\n0\\n\", \"1.3416407865\\n0\\n0.7844645406\\n\", \"1.3416407865\\n0\\n0.8485281374\\n\", \"1.4142135624\\n1.9845557534\\n0\\n\", \"1.0000000000\\n0\\n0.8485281374\\n\", \"0.4472135955\\n1.9845557534\\n0\\n\", \"1.0000000000\\n0\\n0.7071067812\\n\", \"0.4472135955\\n1.9949173997\\n0\\n\", \"0\\n1.9949173997\\n0\\n\", \"1.0000000000\\n0\\n0.4120816918\\n\", \"1.0000000000\\n0.6625891564\\n0.4120816918\\n\", \"0\\n2.2360679775\\n0\\n\", \"1.0000000000\\n1.0000000000\\n0.4120816918\\n\", \"2.0000000000\\n0\\n0.4120816918\\n\", \"0\\n1.0000000000\\n0.6324555320\\n\", \"0\\n2.0000000000\\n0.6324555320\\n\", \"0\\n2.2360679775\\n0.6324555320\\n\", \"2.0000000000\\n0\\n0.6575959492\\n\", \"0\\n2.5997347345\\n0\\n\", \"2.2360679775\\n0\\n0.6575959492\\n\", \"1.0000000000\\n2.5997347345\\n0\\n\", \"2.2360679775\\n0\\n0.5322001449\\n\", \"1.0000000000\\n2.0000000000\\n0\\n\", \"1.0000000000\\n2.0000000000\\n0.1373605639\\n\", \"2.2360679775\\n1.0000000000\\n0.5322001449\\n\", \"1.0000000000\\n2.0000000000\\n0.4472135955\\n\", \"1.2649110641\\n2.0000000000\\n0.4472135955\\n\", \"2.0000000000\\n1.0000000000\\n0.5322001449\\n\", \"2.2135943621\\n2.0000000000\\n0.4472135955\\n\", \"2.0000000000\\n1.0000000000\\n0.4242640687\\n\", \"2.2135943621\\n3.0000000000\\n0.4472135955\\n\", \"2.0000000000\\n1.0000000000\\n0.6337502223\\n\", \"2.0000000000\\n1.0000000000\\n0.7110681947\\n\", \"2.0000000000\\n1.0000000000\\n0.8561726895\\n\", \"2.0000000000\\n1.1094003925\\n0.8561726895\\n\", \"2.5495097568\\n1.1094003925\\n0.8561726895\\n\", \"2.5495097568\\n1.1094003925\\n0.7110681947\\n\", \"2.4041630560\\n1.1094003925\\n0.7110681947\\n\", \"2.4041630560\\n1.1094003925\\n0.6337502223\\n\", \"2.4041630560\\n0.2208630521\\n0.6337502223\\n\", \"2.4041630560\\n0.2208630521\\n0.5432144763\\n\", \"2.4041630560\\n0.2208630521\\n0\\n\", \"1.5556349186\\n0.2208630521\\n0\\n\", \"1.5556349186\\n0.1104315261\\n0\\n\", \"2.0604084592\\n0.1104315261\\n0\\n\", \"2.0604084592\\n0\\n0\\n\", \"1.8439088915\\n0.1104315261\\n0\\n\", \"1.8439088915\\n0\\n0\\n\", \"1.8439088915\\n1.0000000000\\n0\\n\", \"2.2135943621\\n1.0000000000\\n0\\n\", \"2.2135943621\\n0\\n0\\n\", \"2.6678918754\\n0\\n0\\n\", \"3.1712389940\\n0\\n0\\n\", \"3.1712389940\\n0.4472135955\\n0\\n\", \"3.0152764205\\n0.4472135955\\n0\\n\", \"3.0152764205\\n1.3416407865\\n0\\n\", \"3.1903665403\\n1.3416407865\\n0\\n\", \"3.1903665403\\n2.2360679775\\n0\\n\", \"1.8973665961\\n2.2360679775\\n0\\n\", \"1.2184153982\\n2.2360679775\\n0\\n\", \"1.2184153982\\n0.4472135955\\n0\\n\", \"1.0000000000\\n1.4142135624\\n0.0000000000\"]}", "source": "primeintellect"}
For given two segments s1 and s2, print the distance between them. s1 is formed by end points p0 and p1, and s2 is formed by end points p2 and p3. Constraints * 1 ≤ q ≤ 1000 * -10000 ≤ xpi, ypi ≤ 10000 * p0 ≠ p1 and p2 ≠ p3. Input The entire input looks like: q (the number of queries) 1st query 2nd query ... qth query Each query consists of integer coordinates of end points of s1 and s2 in the following format: xp0 yp0 xp1 yp1 xp2 yp2 xp3 yp3 Output For each query, print the distance. The output values should be in a decimal fraction with an error less than 0.00000001. Example Input 3 0 0 1 0 0 1 1 1 0 0 1 0 2 1 1 2 -1 0 1 0 0 1 0 -1 Output 1.0000000000 1.4142135624 0.0000000000 Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [[0], [59], [60], [3599], [3600], [86399], [86400], [359999]], \"outputs\": [[\"00:00:00\"], [\"00:00:59\"], [\"00:01:00\"], [\"00:59:59\"], [\"01:00:00\"], [\"23:59:59\"], [\"24:00:00\"], [\"99:59:59\"]]}", "source": "primeintellect"}
Write a function, which takes a non-negative integer (seconds) as input and returns the time in a human-readable format (`HH:MM:SS`) * `HH` = hours, padded to 2 digits, range: 00 - 99 * `MM` = minutes, padded to 2 digits, range: 00 - 59 * `SS` = seconds, padded to 2 digits, range: 00 - 59 The maximum time never exceeds 359999 (`99:59:59`) You can find some examples in the test fixtures. Write your solution by modifying this code: ```python def make_readable(seconds): ``` Your solution should implemented in the function "make_readable". The i Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [\"5 10 7\\n98765 78654 25669 45126 98745\\n\", \"2 7597 8545\\n74807 22362\\n\", \"1 1 1000000000\\n100\\n\", \"5 2 9494412\\n5484 254 1838 18184 9421\\n\", \"95 97575868 5\\n4612 1644 3613 5413 5649 2419 5416 3926 4610 4419 2796 5062 2112 1071 3790 4220 3955 2142 4638 2832 2702 2115 2045 4085 3599 2452 5495 4767 1368 2344 4625 4132 5755 5815 2581 6259 1330 4938 815 5430 1628 3108 4342 3692 2928 1941 3714 4498 4471 4842 1822 867 3395 2587 3372 6394 6423 3728 3720 6525 4296 2091 4400 994 1321 3454 5285 2989 1755 504 5019 2629 3834 3191 6254 844 5338 615 5608 4898 2497 4482 850 5308 2763 1943 6515 5459 5556 829 4646 5258 2019 5582 1226\\n\", \"58 5858758 7544547\\n6977 5621 6200 6790 7495 5511 6214 6771 6526 6557 5936 7020 6925 5462 7519 6166 5974 6839 6505 7113 5674 6729 6832 6735 5363 5817 6242 7465 7252 6427 7262 5885 6327 7046 6922 5607 7238 5471 7145 5822 5465 6369 6115 5694 6561 7330 7089 7397 7409 7093 7537 7279 7613 6764 7349 7095 6967 5984\\n\", \"13 94348844 381845400\\n515 688 5464 155 441 9217 114 21254 55 9449 1800 834 384\\n\", \"1 64 25\\n100000\\n\", \"77 678686 878687\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\n\", \"16 100 100\\n30 89 12 84 62 24 10 59 98 21 13 69 65 12 54 32\\n\", \"1 1000000000 1\\n100\\n\", \"7 5 2\\n1 2 3 4 5 6 7\\n\", \"1 1000000000 1000000000\\n100\\n\", \"47 20 1000000\\n81982 19631 19739 13994 50426 14232 79125 95908 20227 79428 84065 86233 30742 82664 54626 10849 11879 67198 15667 75866 47242 90766 23115 20130 37293 8312 57308 52366 49768 28256 56085 39722 40397 14166 16743 28814 40538 50753 60900 99449 94318 54247 10563 5260 76407 42235 417\\n\", \"5 10 10\\n7 0 7 0 7\\n\", \"17 100 100\\n47 75 22 18 42 53 95 98 94 50 63 55 46 80 9 20 99\\n\", \"79 5464 64574\\n3800 2020 2259 503 4922 975 5869 6140 3808 2635 3420 992 4683 3748 5732 4787 6564 3302 6153 4955 2958 6107 2875 3449 1755 5029 5072 5622 2139 1892 4640 1199 3918 1061 4074 5098 4939 5496 2019 356 5849 4796 4446 4633 1386 1129 3351 639 2040 3769 4106 4048 3959 931 3457 1938 4587 6438 2938 132 2434 3727 3926 2135 1665 2871 2798 6359 989 6220 97 2116 2048 251 4264 3841 4428 5286 1914\\n\", \"6 10 4\\n1 2 3 4 5 6\\n\", \"99 999 999\\n9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9\\n\", \"1 1 1\\n0\\n\", \"3 75579860 8570575\\n10433 30371 14228\\n\", \"5 13 7\\n98765 78654 25669 45126 98745\\n\", \"2 4024 8545\\n74807 22362\\n\", \"1 1 1000000000\\n110\\n\", \"95 97575868 5\\n4612 1644 3613 5413 5649 2419 5416 3926 4610 4419 2796 5062 2112 1071 3790 4220 3955 2142 4638 2832 2702 2115 2045 4085 3599 2452 5495 4767 1368 2344 4625 4132 5755 5815 2581 6259 1330 4938 815 5430 1628 3108 4342 3692 2928 1941 3714 4498 4471 4842 1822 867 3395 2587 3372 6394 6423 3728 3720 6525 4296 2091 4400 994 1321 3454 5285 2989 1755 504 5019 2629 5028 3191 6254 844 5338 615 5608 4898 2497 4482 850 5308 2763 1943 6515 5459 5556 829 4646 5258 2019 5582 1226\\n\", \"13 94348844 381845400\\n515 688 5464 155 441 12028 114 21254 55 9449 1800 834 384\\n\", \"1 53 25\\n100000\\n\", \"1 1000000001 1\\n100\\n\", \"5 10 10\\n7 0 12 0 7\\n\", \"17 100 100\\n47 75 22 18 42 53 95 3 94 50 63 55 46 80 9 20 99\\n\", \"79 5464 64574\\n3800 2020 2259 503 4922 975 5869 6140 3808 2635 3420 992 4683 3748 5732 4787 6564 3302 6153 4955 2958 6107 2875 3449 1755 5029 5072 5622 2139 1892 4640 1199 3918 1061 4074 5098 4939 5496 2019 356 5849 4796 4446 4633 1386 1129 3351 639 2040 3769 4106 4048 3959 931 3457 1938 4587 6438 2938 132 2434 3727 3926 2135 1665 2871 2798 6359 989 6220 97 2116 2048 251 4264 3841 4428 5286 2354\\n\", \"3 75579860 11424186\\n10433 30371 14228\\n\", \"3 2 2\\n1 1 3\\n\", \"1 68 25\\n100000\\n\", \"1 68 41\\n100000\\n\", \"5 2 9494412\\n9090 254 1838 18184 9421\\n\", \"58 5858758 7544547\\n6977 5621 6200 6790 7495 5511 6214 6771 6526 6557 5936 7020 6925 5462 7519 6166 5974 6839 6505 7113 5674 6729 6832 6735 5363 5817 6242 7465 7252 6427 7262 5885 6327 7046 6922 5607 7238 5471 7145 5822 5465 6369 6115 5694 6561 7330 7089 7397 7409 7093 7537 12705 7613 6764 7349 7095 6967 5984\\n\", \"16 100 100\\n30 89 0 84 62 24 10 59 98 21 13 69 65 12 54 32\\n\", \"1 1000000000 1000000000\\n110\\n\", \"47 20 1000000\\n81982 19631 19739 13994 50426 14232 79125 95908 20227 79428 84065 70021 30742 82664 54626 10849 11879 67198 15667 75866 47242 90766 23115 20130 37293 8312 57308 52366 49768 28256 56085 39722 40397 14166 16743 28814 40538 50753 60900 99449 94318 54247 10563 5260 76407 42235 417\\n\", \"6 10 4\\n1 2 3 4 1 6\\n\", \"99 999 999\\n9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 1 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9\\n\", \"1 0 1\\n0\\n\", \"2 3 1\\n2 2\\n\", \"5 4 7\\n98765 78654 25669 45126 98745\\n\", \"2 4024 8545\\n100611 22362\\n\", \"1 1 1000100000\\n110\\n\", \"5 2 9494412\\n9090 254 1838 30619 9421\\n\", \"95 97575868 5\\n4612 1644 3613 5413 5649 2419 5416 3926 4610 4419 2796 5062 2112 1071 3790 4220 3955 2142 4638 2832 2702 2115 2045 4085 3599 2452 5495 4767 1368 2344 4625 4132 5755 5815 2581 4004 1330 4938 815 5430 1628 3108 4342 3692 2928 1941 3714 4498 4471 4842 1822 867 3395 2587 3372 6394 6423 3728 3720 6525 4296 2091 4400 994 1321 3454 5285 2989 1755 504 5019 2629 5028 3191 6254 844 5338 615 5608 4898 2497 4482 850 5308 2763 1943 6515 5459 5556 829 4646 5258 2019 5582 1226\\n\", \"58 5858758 7544547\\n6977 5621 6200 6790 7495 5511 6214 6771 6526 6557 5936 7020 6925 5462 7519 6166 5385 6839 6505 7113 5674 6729 6832 6735 5363 5817 6242 7465 7252 6427 7262 5885 6327 7046 6922 5607 7238 5471 7145 5822 5465 6369 6115 5694 6561 7330 7089 7397 7409 7093 7537 12705 7613 6764 7349 7095 6967 5984\\n\", \"13 94348844 381845400\\n515 688 5464 155 441 12028 114 21254 55 9449 1800 579 384\\n\", \"16 100 101\\n30 89 0 84 62 24 10 59 98 21 13 69 65 12 54 32\\n\", \"1 1000000001 1\\n000\\n\", \"1 1000000000 1000000010\\n110\\n\", \"47 20 1000000\\n81982 19631 19739 13994 50426 14232 79125 95908 20227 79428 84065 70021 30742 82664 54626 15499 11879 67198 15667 75866 47242 90766 23115 20130 37293 8312 57308 52366 49768 28256 56085 39722 40397 14166 16743 28814 40538 50753 60900 99449 94318 54247 10563 5260 76407 42235 417\\n\", \"5 10 20\\n7 0 12 0 7\\n\", \"17 110 100\\n47 75 22 18 42 53 95 3 94 50 63 55 46 80 9 20 99\\n\", \"79 5464 64574\\n3800 2020 2259 503 4922 975 5869 6140 3808 2635 3420 992 4683 3748 5732 4787 6564 3302 6153 4955 2958 6107 2875 3449 1755 5029 5072 5622 2139 1892 4640 1199 3918 1061 4074 5098 4939 5496 2019 356 5849 4796 4446 6652 1386 1129 3351 639 2040 3769 4106 4048 3959 931 3457 1938 4587 6438 2938 132 2434 3727 3926 2135 1665 2871 2798 6359 989 6220 97 2116 2048 251 4264 3841 4428 5286 2354\\n\", \"6 10 4\\n1 2 3 8 1 6\\n\", \"99 999 999\\n9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 1 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 18 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9\\n\", \"3 75579860 11424186\\n10433 32287 14228\\n\", \"3 2 2\\n0 1 3\\n\", \"2 2 1\\n2 2\\n\", \"5 4 7\\n98765 78654 18245 45126 98745\\n\", \"2 4024 8545\\n100611 5650\\n\", \"1 2 1000100000\\n110\\n\", \"5 1 9494412\\n9090 254 1838 30619 9421\\n\", \"95 97575868 5\\n4612 1644 3613 5413 5649 2419 5416 3926 4610 4419 2796 5062 2112 1071 3790 4220 3955 2142 4638 2832 2702 2115 2045 4085 3599 2452 5495 4767 1368 2344 4625 4132 5755 5815 2581 4004 1330 4938 815 5430 1628 3108 4342 3692 2928 1941 3714 4498 4471 4842 1822 867 3395 2587 3372 6394 6423 3728 3720 6525 4296 2091 4400 994 1321 2088 5285 2989 1755 504 5019 2629 5028 3191 6254 844 5338 615 5608 4898 2497 4482 850 5308 2763 1943 6515 5459 5556 829 4646 5258 2019 5582 1226\\n\", \"58 4209870 7544547\\n6977 5621 6200 6790 7495 5511 6214 6771 6526 6557 5936 7020 6925 5462 7519 6166 5385 6839 6505 7113 5674 6729 6832 6735 5363 5817 6242 7465 7252 6427 7262 5885 6327 7046 6922 5607 7238 5471 7145 5822 5465 6369 6115 5694 6561 7330 7089 7397 7409 7093 7537 12705 7613 6764 7349 7095 6967 5984\\n\", \"13 94348844 381845400\\n515 688 5464 155 441 12028 114 21254 55 9449 780 579 384\\n\", \"16 100 100\\n30 89 0 84 62 24 10 59 98 21 13 69 65 12 54 30\\n\", \"1 1000010000 1000000010\\n110\\n\", \"10 10 20\\n7 0 12 0 7\\n\", \"17 110 100\\n47 75 22 18 42 53 95 3 165 50 63 55 46 80 9 20 99\\n\", \"79 5464 64574\\n3800 2020 2259 503 4922 975 5869 6140 3808 2635 3420 992 4683 3748 5732 4787 6564 3302 10476 4955 2958 6107 2875 3449 1755 5029 5072 5622 2139 1892 4640 1199 3918 1061 4074 5098 4939 5496 2019 356 5849 4796 4446 6652 1386 1129 3351 639 2040 3769 4106 4048 3959 931 3457 1938 4587 6438 2938 132 2434 3727 3926 2135 1665 2871 2798 6359 989 6220 97 2116 2048 251 4264 3841 4428 5286 2354\\n\", \"6 10 4\\n1 2 0 8 1 6\\n\", \"99 999 999\\n9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 1 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 4 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 18 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9\\n\", \"3 2 2\\n4 1 3\\n\", \"2 3 1\\n2 3\\n\"], \"outputs\": [\" 21\", \"0\", \"100\\n\", \" 0\", \"815\\n\", \"0\", \"55\\n\", \" 1600\", \"1\\n\", \"0\", \"100\\n\", \"1\\n\", \"100\\n\", \" 0\", \"7\\n\", \"9\\n\", \"97\\n\", \"0\", \"9\\n\", \"0\\n\", \"10433\\n\", \"28\\n\", \"0\\n\", \"110\\n\", \"815\\n\", \"55\\n\", \"1325\\n\", \"100\\n\", \"7\\n\", \"9\\n\", \"97\\n\", \"10433\\n\", \"1\\n\", \"1700\\n\", \"2788\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"110\\n\", \"0\\n\", \"0\\n\", \"9\\n\", \"0\\n\", \"0\\n\", \"7\\n\", \"0\\n\", \"110\\n\", \"0\\n\", \"815\\n\", \"0\\n\", \"55\\n\", \"0\\n\", \"0\\n\", \"110\\n\", \"0\\n\", \"7\\n\", \"9\\n\", \"97\\n\", \"0\\n\", \"9\\n\", \"10433\\n\", \"0\\n\", \"0\\n\", \"7\\n\", \"0\\n\", \"110\\n\", \"0\\n\", \"815\\n\", \"0\\n\", \"55\\n\", \"0\\n\", \"110\\n\", \"0\\n\", \"9\\n\", \"97\\n\", \"0\\n\", \"9\\n\", \" 2\", \"0\\n\"]}", "source": "primeintellect"}
It is nighttime and Joe the Elusive got into the country's main bank's safe. The safe has n cells positioned in a row, each of them contains some amount of diamonds. Let's make the problem more comfortable to work with and mark the cells with positive numbers from 1 to n from the left to the right. Unfortunately, Joe didn't switch the last security system off. On the plus side, he knows the way it works. Every minute the security system calculates the total amount of diamonds for each two adjacent cells (for the cells between whose numbers difference equals 1). As a result of this check we get an n - 1 sums. If at least one of the sums differs from the corresponding sum received during the previous check, then the security system is triggered. Joe can move the diamonds from one cell to another between the security system's checks. He manages to move them no more than m times between two checks. One of the three following operations is regarded as moving a diamond: moving a diamond from any cell to any other one, moving a diamond from any cell to Joe's pocket, moving a diamond from Joe's pocket to any cell. Initially Joe's pocket is empty, and it can carry an unlimited amount of diamonds. It is considered that before all Joe's actions the system performs at least one check. In the morning the bank employees will come, which is why Joe has to leave the bank before that moment. Joe has only k minutes left before morning, and on each of these k minutes he can perform no more than m operations. All that remains in Joe's pocket, is considered his loot. Calculate the largest amount of diamonds Joe can carry with him. Don't forget that the security system shouldn't be triggered (even after Joe leaves the bank) and Joe should leave before morning. Input The first line contains integers n, m and k (1 ≤ n ≤ 104, 1 ≤ m, k ≤ 109). The next line contains n numbers. The i-th number is equal to the amount of diamonds in the i-th cell — it is an integer from 0 to 105. Output Print a single number — the maximum number of diamonds Joe can steal. Examples Input 2 3 1 2 3 Output 0 Input 3 2 2 4 1 3 Output 2 Note In the second sample Joe can act like this: The diamonds' initial positions are 4 1 3. During the first period of time Joe moves a diamond from the 1-th cell to the 2-th one and a diamond from the 3-th cell to his pocket. By the end of the first period the diamonds' positions are 3 2 2. The check finds no difference and the security system doesn't go off. During the second period Joe moves a diamond from the 3-rd cell to the 2-nd one and puts a diamond from the 1-st cell to his pocket. By the end of the second period the diamonds' positions are 2 3 1. The check finds no difference again and the security system doesn't go off. Now Joe leaves with 2 diamonds in his pocket. Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [[\"ceggodegge heggeregge\"], [\"FeggUNegg KeggATeggA\"], [\"egegggegg\"], [\"Heggeleggleggo weggoreggleggdegg\"], [\"seggceggreggameggbeggleggedegg egegggeggsegg\"], [\"egegggeggyegg beggreggeadegg\"], [\"veggegeggyeggmeggitegge onegg teggoaseggtegg\"]], \"outputs\": [[\"code here\"], [\"FUN KATA\"], [\"egg\"], [\"Hello world\"], [\"scrambled eggs\"], [\"eggy bread\"], [\"vegymite on toast\"]]}", "source": "primeintellect"}
Unscramble the eggs. The string given to your function has had an "egg" inserted directly after each consonant. You need to return the string before it became eggcoded. ## Example Kata is supposed to be for beginners to practice regular expressions, so commenting would be appreciated. Write your solution by modifying this code: ```python def unscramble_eggs(word): ``` Your solution should implemented in the function "unscramble_eggs". The i Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [\"5\\n3\\nTMT\\n3\\nMTT\\n6\\nTMTMTT\\n6\\nTMTTTT\\n6\\nTTMMTT\\n\", \"5\\n3\\nTMT\\n3\\nMTT\\n6\\nTMTMTT\\n6\\nMTTTTT\\n6\\nTTMMTT\\n\", \"5\\n3\\nTMT\\n3\\nMTT\\n6\\nTMTMTT\\n6\\nMTTTTT\\n6\\nTTMTTM\\n\", \"5\\n3\\nTMT\\n3\\nMTT\\n6\\nTTTMMT\\n6\\nTMTTTT\\n6\\nTTMMTT\\n\", \"5\\n3\\nTTM\\n3\\nTTM\\n6\\nTMTMTT\\n6\\nMTTTTT\\n6\\nTTMMTT\\n\", \"5\\n3\\nTTM\\n3\\nTMT\\n6\\nTMTMTT\\n6\\nMTTTTT\\n6\\nTTMMTT\\n\", \"5\\n3\\nTMT\\n3\\nTMT\\n6\\nTMTMTT\\n6\\nTMTTTT\\n6\\nTTMTTM\\n\", \"5\\n3\\nTMT\\n3\\nMTT\\n6\\nTMTTTM\\n6\\nMTTTTT\\n6\\nTTMTTM\\n\", \"5\\n3\\nTMT\\n3\\nTMT\\n6\\nTMTTTM\\n6\\nMTTTTT\\n6\\nTTMTTM\\n\", \"5\\n3\\nTMT\\n3\\nTMT\\n6\\nTMTTTM\\n6\\nMTTTTT\\n6\\nTTMMTT\\n\", \"5\\n3\\nTTM\\n3\\nMTT\\n6\\nTTTMMT\\n6\\nTMTTTT\\n6\\nTTMMTT\\n\", \"5\\n3\\nTTM\\n3\\nMTT\\n6\\nTMTMTT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nNO\\nYES\\nNO\\nNO\\n\", \"YES\\nNO\\nNO\\nNO\\nYES\\n\", \"NO\\nNO\\nYES\\nNO\\nYES\\n\", \"NO\\nYES\\nYES\\nNO\\nYES\\n\", \"YES\\nYES\\nYES\\nNO\\nNO\\n\", \"YES\\nNO\\nNO\\nNO\\nNO\\n\", \"YES\\nYES\\nNO\\nNO\\nNO\\n\", \"YES\\nYES\\nNO\\nNO\\nYES\\n\", \"NO\\nNO\\nNO\\nNO\\nYES\\n\", \"NO\\nNO\\nYES\\nNO\\nNO\\n\", \"NO\\nYES\\nYES\\nNO\\nNO\\n\", \"NO\\nYES\\nNO\\nNO\\nNO\\n\", \"NO\\nNO\\nNO\\nNO\\nNO\\n\", \"YES\\nYES\\nYES\\nNO\\nYES\\n\", \"YES\\nNO\\nYES\\nNO\\nYES\\n\", \"YES\\nNO\\nYES\\nNO\\nYES\\n\", \"YES\\nNO\\nYES\\nNO\\nNO\\n\", \"YES\\nNO\\nNO\\nNO\\nYES\\n\", \"YES\\nNO\\nYES\\nNO\\nNO\\n\", \"NO\\nNO\\nYES\\nNO\\nYES\\n\", \"YES\\nNO\\nNO\\nNO\\nYES\\n\", \"NO\\nNO\\nYES\\nNO\\nYES\\n\", \"YES\\nNO\\nYES\\nNO\\nYES\\n\", \"YES\\nNO\\nYES\\nNO\\nYES\\n\", \"YES\\nNO\\nNO\\nNO\\nYES\\n\", \"YES\\nYES\\nYES\\nNO\\nNO\\n\", \"YES\\nNO\\nYES\\nNO\\nNO\\n\", \"YES\\nNO\\nNO\\nNO\\nYES\\n\", \"YES\\nNO\\nYES\\nNO\\nNO\\n\", \"NO\\nYES\\nYES\\nNO\\nYES\\n\", \"YES\\nYES\\nYES\\nNO\\nNO\\n\", \"YES\\nNO\\nYES\\nNO\\nNO\\n\", \"YES\\nNO\\nNO\\nNO\\nYES\\n\", \"YES\\nYES\\nNO\\nNO\\nNO\\n\", \"YES\\nNO\\nYES\\nNO\\nYES\\n\", \"YES\\nNO\\nYES\\nNO\\nYES\\n\", \"YES\\nNO\\nYES\\nNO\\nYES\\n\", \"YES\\nNO\\nNO\\nNO\\nNO\\n\", \"YES\\nNO\\nNO\\nNO\\nYES\\n\", \"YES\\nNO\\nNO\\nNO\\nYES\\n\", \"YES\\nYES\\nYES\\nNO\\nNO\\n\", \"YES\\nNO\\nNO\\nNO\\nYES\\n\", \"YES\\nYES\\nYES\\nNO\\nNO\\n\", \"YES\\nNO\\nYES\\nNO\\nYES\\n\", \"YES\\nNO\\nYES\\nNO\\nNO\\n\", \"YES\\nNO\\nYES\\nNO\\nNO\\n\", \"NO\\nYES\\nYES\\nNO\\nNO\\n\", \"YES\\nYES\\nNO\\nNO\\nNO\\n\", \"NO\\nNO\\nYES\\nNO\\nNO\\n\", \"YES\\nNO\\nYES\\nNO\\nYES\\n\", \"YES\\nYES\\nYES\\nNO\\nNO\\n\", \"NO\\nNO\\nYES\\nNO\\nYES\\n\", \"YES\\nNO\\nNO\\nNO\\nNO\\n\", \"YES\\nNO\\nNO\\nNO\\nNO\\n\", \"YES\\nNO\\nYES\\nNO\\nYES\\n\", \"NO\\nNO\\nYES\\nNO\\nNO\\n\", \"NO\\nYES\\nYES\\nNO\\nNO\\n\", \"YES\\nNO\\nYES\\nNO\\nYES\\n\", \"NO\\nNO\\nYES\\nNO\\nYES\\n\", \"YES\\nYES\\nYES\\nNO\\nNO\\n\", \"NO\\nNO\\nYES\\nNO\\nNO\\n\", \"YES\\nNO\\nNO\\nNO\\nNO\\n\", \"YES\\nNO\\nNO\\nNO\\nYES\\n\", \"YES\\nNO\\nYES\\nNO\\nYES\\n\", \"NO\\nNO\\nYES\\nNO\\nNO\\n\", \"YES\\nNO\\nYES\\nNO\\nNO\\n\", \"YES\\nNO\\nYES\\nNO\\nNO\\n\", \"YES\\nYES\\nYES\\nNO\\nNO\\n\", \"YES\\nNO\\nYES\\nNO\\nYES\\n\", \"YES\\nNO\\nNO\\nNO\\nNO\\n\", \"YES\\nYES\\nYES\\nNO\\nNO\\n\", \"YES\\nNO\\nNO\\nNO\\nNO\\n\", \"YES\\nNO\\nNO\\nNO\\nNO\\n\", \"NO\\nNO\\nYES\\nNO\\nNO\\n\", \"YES\\nNO\\nNO\\nNO\\nNO\\n\", \"YES\\nNO\\nNO\\nNO\\nNO\\n\", \"YES\\nNO\\nYES\\nNO\\nYES\\n\", \"YES\\nNO\\nYES\\nNO\\nNO\\n\", \"YES\\nNO\\nNO\\nNO\\nNO\\n\", \"YES\\nNO\\nYES\\nNO\\nYES\\n\", \"YES\\nNO\\nYES\\nNO\\nNO\\n\", \"NO\\nNO\\nYES\\nNO\\nNO\\n\", \"YES\\nNO\\nYES\\nNO\\nNO\\n\", \"YES\\nNO\\nYES\\nNO\\nNO\\n\", \"NO\\nYES\\nYES\\nNO\\nNO\\n\", \"YES\\nNO\\nYES\\nNO\\nYES\\n\", \"YES\\nNO\\nYES\\nNO\\nNO\\n\", \"YES\\nNO\\nYES\\nNO\\nNO\\n\", \"YES\\nNO\\nYES\\nNO\\nNO\\n\", \"YES\\nNO\\nNO\\nNO\\nNO\\n\", \"NO\\nNO\\nYES\\nNO\\nNO\\n\", \"NO\\nNO\\nYES\\nNO\\nYES\\n\", \"NO\\nYES\\nYES\\nNO\\nYES\\n\", \"NO\\nYES\\nNO\\nNO\\nNO\\n\", \"YES\\nNO\\nNO\\nNO\\nNO\\n\", \"YES\\nNO\\nNO\\nNO\\nNO\\n\", \"YES\\nNO\\nYES\\nNO\\nYES\\n\", \"NO\\nNO\\nYES\\nNO\\nYES\\n\", \"NO\\nNO\\nYES\\nNO\\nNO\\n\", \"YES\\nNO\\nYES\\nNO\\nYES\\n\", \"YES\\nNO\\nNO\\nNO\\nNO\\n\", \"YES\\nNO\\nYES\\nNO\\nNO\\n\", \"NO\\nYES\\nYES\\nNO\\nYES\\n\", \"YES\\nNO\\nYES\\nNO\\nYES\\n\", \"YES\\nNO\\nNO\\nNO\\nYES\\n\", \"NO\\nNO\\nYES\\nNO\\nYES\\n\", \"NO\\nNO\\nYES\\nNO\\nYES\\n\", \"YES\\nNO\\nYES\\nNO\\nYES\\n\", \"NO\\nNO\\nYES\\nNO\\nNO\\n\", \"YES\\nNO\\nYES\\nNO\\nNO\\n\", \"NO\\nYES\\nYES\\nNO\\nNO\\n\", \"NO\\nNO\\nYES\\nNO\\nYES\\n\", \"YES\\nNO\\nYES\\nNO\\nYES\\n\", \"YES\\nNO\\nYES\\nNO\\nNO\\n\", \"NO\\nNO\\nYES\\nNO\\nNO\\n\", \"YES\\nNO\\nNO\\nNO\\nNO\\n\", \"NO\\nNO\\nYES\\nNO\\nNO\\n\", \"YES\\nNO\\nNO\\nNO\\nNO\\n\", \"YES\\nNO\\nNO\\nNO\\nYES\\n\", \"NO\\nNO\\nYES\\nNO\\nYES\\n\", \"YES\\nNO\\nYES\\nNO\\nYES\\n\", \"YES\\nNO\\nYES\\nNO\\nYES\\n\", \"YES\\nNO\\nNO\\nNO\\nNO\\n\", \"YES\\nNO\\nNO\\nNO\\nYES\\n\", \"YES\\nNO\\nYES\\nNO\\nNO\\n\", \"YES\\nNO\\nNO\\nNO\\nNO\\n\", \"NO\\nYES\\nYES\\nNO\\nNO\\n\", \"NO\\nNO\\nYES\\nNO\\nNO\\n\", \"YES\\nYES\\nNO\\nNO\\nNO\\n\", \"YES\\nYES\\nYES\\nNO\\nNO\\n\", \"NO\\nNO\\nNO\\nNO\\nNO\\n\", \"NO\\nNO\\nYES\\nNO\\nNO\\n\", \"YES\\nNO\\nYES\\nNO\\nNO\\n\", \"NO\\nNO\\nYES\\nNO\\nYES\\n\", \"YES\\nNO\\nYES\\nNO\\nYES\\n\", \"NO\\nYES\\nYES\\nNO\\nYES\\n\", \"YES\\nNO\\nNO\\nNO\\nNO\\n\", \"YES\\nNO\\nYES\\nNO\\nNO\\n\", \"YES\\nNO\\nYES\\nNO\\nNO\\n\", \"NO\\nNO\\nYES\\nNO\\nYES\\n\", \"YES\\nNO\\nNO\\nNO\\nNO\\n\", \"YES\\nNO\\nNO\\nNO\\nNO\\n\", \"NO\\nNO\\nNO\\nNO\\nNO\\n\", \"YES\\nNO\\nYES\\nNO\\nNO\\n\", \"YES\\nNO\\nYES\\nNO\\nNO\\n\", \"\\nYES\\nNO\\nYES\\nNO\\nYES\\n\"]}", "source": "primeintellect"}
The student council has a shared document file. Every day, some members of the student council write the sequence TMT (short for Towa Maji Tenshi) in it. However, one day, the members somehow entered the sequence into the document at the same time, creating a jumbled mess. Therefore, it is Suguru Doujima's task to figure out whether the document has malfunctioned. Specifically, he is given a string of length $n$ whose characters are all either T or M, and he wants to figure out if it is possible to partition it into some number of disjoint subsequences, all of which are equal to TMT. That is, each character of the string should belong to exactly one of the subsequences. A string $a$ is a subsequence of a string $b$ if $a$ can be obtained from $b$ by deletion of several (possibly, zero) characters. -----Input----- The first line contains an integer $t$ ($1 \le t \le 5000$) — the number of test cases. The first line of each test case contains an integer $n$ ($3 \le n < 10^5$), the number of characters in the string entered in the document. It is guaranteed that $n$ is divisible by $3$. The second line of each test case contains a string of length $n$ consisting of only the characters T and M. It is guaranteed that the sum of $n$ over all test cases does not exceed $10^5$. -----Output----- For each test case, print a single line containing YES if the described partition exists, and a single line containing NO otherwise. -----Examples----- Input 5 3 TMT 3 MTT 6 TMTMTT 6 TMTTTT 6 TTMMTT Output YES NO YES NO YES -----Note----- In the first test case, the string itself is already a sequence equal to TMT. In the third test case, we may partition the string into the subsequences TMTMTT. Both the bolded and the non-bolded subsequences are equal to TMT. Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0.125
{"tests": "{\"inputs\": [\"5\\n7\\n?R???BR\\n7\\n???R???\\n1\\n?\\n1\\nB\\n10\\n?R??RB??B?\\n\", \"1\\n2\\n??\\n\", \"5\\n7\\n?R???BR\\n7\\n???R???\\n1\\n?\\n1\\nB\\n10\\n?R??RB??B?\\n\", \"1\\n2\\n??\\n\", \"5\\n7\\n?R???BR\\n7\\n???R???\\n1\\n?\\n1\\nB\\n10\\n?B??BR??R?\\n\", \"5\\n7\\n?B???RR\\n7\\n???R???\\n1\\n?\\n1\\nB\\n10\\n?R??RB??B?\\n\", \"5\\n7\\n?B???RR\\n7\\n???R???\\n1\\n?\\n1\\nB\\n10\\n?B??BR??R?\\n\", \"5\\n7\\nRR???B?\\n7\\n???R???\\n1\\n?\\n1\\nB\\n10\\n?B??BR??R?\\n\", \"5\\n7\\n??R??BR\\n7\\n???R???\\n1\\n?\\n1\\nB\\n10\\n?R??RB??B?\\n\", \"5\\n7\\n?B???RR\\n7\\n???R???\\n1\\n?\\n1\\nB\\n10\\n?B???R??RB\\n\", \"5\\n7\\n?R?R?B?\\n7\\nR??????\\n1\\n?\\n1\\nB\\n10\\n?B??BR??R?\\n\", \"5\\n7\\n??R??BR\\n7\\n???R???\\n1\\n?\\n1\\nB\\n10\\n?B??BR??R?\\n\", \"5\\n7\\n?R?R?B?\\n7\\nR??????\\n1\\n?\\n1\\nB\\n10\\n?R??RB??B?\\n\", \"5\\n7\\n??R??BR\\n7\\n??R????\\n1\\n?\\n1\\nB\\n10\\n?B??BR??R?\\n\", \"5\\n7\\n?R???BR\\n7\\n???R???\\n1\\n?\\n1\\nB\\n10\\n????BRB?R?\\n\", \"5\\n7\\nRR???B?\\n7\\n???R???\\n1\\n?\\n1\\nB\\n10\\n?R??RB??B?\\n\", \"5\\n7\\n???R?BR\\n7\\n???R???\\n1\\n?\\n1\\nB\\n10\\n?R??RB??B?\\n\", \"5\\n7\\n?B???RR\\n7\\n??R????\\n1\\n?\\n1\\nB\\n10\\n?B???R??RB\\n\", \"5\\n7\\n?R?R?B?\\n7\\nR??????\\n1\\n?\\n1\\nB\\n10\\n?B??RB??R?\\n\", \"5\\n7\\n?R???BR\\n7\\n???R???\\n1\\n?\\n1\\nB\\n10\\n?R??RBB???\\n\", \"5\\n7\\n????BRR\\n7\\n???R???\\n1\\n?\\n1\\nB\\n10\\n?B???R??RB\\n\", \"5\\n7\\n????BRR\\n7\\n???R???\\n1\\n?\\n1\\nB\\n10\\nBR??R???B?\\n\", \"5\\n7\\n?R?R??B\\n7\\n??????R\\n1\\n?\\n1\\nB\\n10\\n?R??RB??B?\\n\", \"5\\n7\\n?RR??B?\\n7\\n???R???\\n1\\n?\\n1\\nB\\n10\\n?R??RB??B?\\n\", \"5\\n7\\nR?B?R??\\n7\\n??R????\\n1\\n?\\n1\\nB\\n10\\n?B??BR??R?\\n\", \"5\\n7\\n?R?R??B\\n7\\n??????R\\n1\\n?\\n1\\nB\\n10\\n?B??BR??R?\\n\", \"5\\n7\\nRB??R??\\n7\\n??R????\\n1\\n?\\n1\\nB\\n10\\n?R??RB??B?\\n\", \"5\\n7\\n?BR???R\\n7\\n??R????\\n1\\n?\\n1\\nB\\n10\\n?B???R??RB\\n\", \"5\\n7\\nRR???B?\\n7\\n???R???\\n1\\n?\\n1\\nB\\n10\\n?B???R??RB\\n\", \"5\\n7\\nR??R?B?\\n7\\nR??????\\n1\\n?\\n1\\nB\\n10\\n?R??RB??B?\\n\", \"5\\n7\\n???R?BR\\n7\\n???R???\\n1\\n?\\n1\\nB\\n10\\n??R?RB??B?\\n\", \"5\\n7\\nRR???B?\\n7\\n??R????\\n1\\n?\\n1\\nB\\n10\\n?B???R??RB\\n\", \"5\\n7\\nRB??R??\\n7\\n???R???\\n1\\n?\\n1\\nB\\n10\\n?R???B?RB?\\n\", \"5\\n7\\nRR????B\\n7\\n??R????\\n1\\n?\\n1\\nB\\n10\\n?B???R??RB\\n\", \"5\\n7\\n?R?R?B?\\n7\\nR??????\\n1\\n?\\n1\\nB\\n10\\n?B??BRR???\\n\", \"5\\n7\\n?B???RR\\n7\\n??R????\\n1\\n?\\n1\\nB\\n10\\nBR??R???B?\\n\", \"5\\n7\\n??R??RB\\n7\\n??R????\\n1\\n?\\n1\\nB\\n10\\n?B??B??RR?\\n\", \"5\\n7\\nBR?R???\\n7\\nR??????\\n1\\n?\\n1\\nB\\n10\\n?B??BRR???\\n\", \"5\\n7\\n??R??BR\\n7\\n???R???\\n1\\n?\\n1\\nB\\n10\\n?BB??R??R?\\n\", \"5\\n7\\nR???R?B\\n7\\n??R????\\n1\\n?\\n1\\nB\\n10\\n?B???R??RB\\n\", \"5\\n7\\nR???R?B\\n7\\n??R????\\n1\\n?\\n1\\nB\\n10\\n?R??RB??B?\\n\", \"5\\n7\\n?R??RB?\\n7\\n???R???\\n1\\n?\\n1\\nB\\n10\\n?R??RB??B?\\n\", \"5\\n7\\n?RR???B\\n7\\n??R????\\n1\\n?\\n1\\nB\\n10\\n?B???R??RB\\n\", \"5\\n7\\n?B???RR\\n7\\n???R???\\n1\\n?\\n1\\nB\\n10\\n?B??R???RB\\n\", \"5\\n7\\nRR????B\\n7\\n??R????\\n1\\n?\\n1\\nB\\n10\\n?BR??R???B\\n\", \"5\\n7\\n????BRR\\n7\\n??R????\\n1\\n?\\n1\\nB\\n10\\nBR??R???B?\\n\", \"5\\n7\\n?R??RB?\\n7\\n???R???\\n1\\n?\\n1\\nB\\n10\\n?B??BR??R?\\n\", \"5\\n7\\n????BRR\\n7\\n??R????\\n1\\n?\\n1\\nB\\n10\\n?B???R??RB\\n\", \"5\\n7\\n??R??BR\\n7\\n???R???\\n1\\n?\\n1\\nB\\n10\\n?R??BR??B?\\n\", \"5\\n7\\n?B?R?R?\\n7\\nR??????\\n1\\n?\\n1\\nB\\n10\\n?R??RB??B?\\n\", \"5\\n7\\nRR????B\\n7\\n????R??\\n1\\n?\\n1\\nB\\n10\\nBR??R???B?\\n\", \"5\\n7\\n?RR??B?\\n7\\n???R???\\n1\\n?\\n1\\nB\\n10\\n?B??BR??R?\\n\", \"5\\n7\\n?B???RR\\n7\\n???R???\\n1\\n?\\n1\\nB\\n10\\n?BR?BR????\\n\", \"5\\n7\\n??R?B?R\\n7\\n??R????\\n1\\n?\\n1\\nB\\n10\\n?B??BR??R?\\n\", \"5\\n7\\n???R?BR\\n7\\n???R???\\n1\\n?\\n1\\nB\\n10\\n?B??BR?R??\\n\", \"5\\n7\\n?R?R?B?\\n7\\n???R???\\n1\\n?\\n1\\nB\\n10\\n?B??BR??R?\\n\", \"5\\n7\\nRB??R??\\n7\\n???R???\\n1\\n?\\n1\\nB\\n10\\n?B??BR??R?\\n\", \"5\\n7\\n?R?R?B?\\n7\\n??????R\\n1\\n?\\n1\\nB\\n10\\n?R??RB??B?\\n\", \"5\\n7\\n?R???BR\\n7\\n???R???\\n1\\n?\\n1\\nB\\n10\\n???BBR??R?\\n\", \"5\\n7\\nRB??R??\\n7\\n??R????\\n1\\n?\\n1\\nB\\n10\\n?B??BR??R?\\n\", \"5\\n7\\nRB??R??\\n7\\n????R??\\n1\\n?\\n1\\nB\\n10\\n?B??BR??R?\\n\", \"5\\n7\\nRB??R??\\n7\\n???R???\\n1\\n?\\n1\\nB\\n10\\n?R??RB??B?\\n\", \"5\\n7\\nRR???B?\\n7\\n?R?????\\n1\\n?\\n1\\nB\\n10\\n?B??BR??R?\\n\", \"5\\n7\\n??R??BR\\n7\\n??R????\\n1\\n?\\n1\\nB\\n10\\n?B??B??RR?\\n\", \"5\\n7\\n?R???BR\\n7\\n?R?????\\n1\\n?\\n1\\nB\\n10\\n???BBR??R?\\n\", \"5\\n7\\n?R?R??B\\n7\\nR??????\\n1\\n?\\n1\\nB\\n10\\n?R??RB??B?\\n\", \"5\\n7\\nRB??R??\\n7\\n???R???\\n1\\n?\\n1\\nB\\n10\\n?BR?B???R?\\n\", \"5\\n7\\nRR????B\\n7\\n????R??\\n1\\n?\\n1\\nB\\n10\\n?B???R??RB\\n\", \"5\\n7\\n?R?R?B?\\n7\\n??????R\\n1\\n?\\n1\\nB\\n10\\n?B??BR??R?\\n\", \"5\\n7\\nR??BR??\\n7\\n??R????\\n1\\n?\\n1\\nB\\n10\\n?R??RB??B?\\n\", \"5\\n7\\n??R??BR\\n7\\n???R???\\n1\\n?\\n1\\nB\\n10\\n?BR?B???R?\\n\", \"5\\n7\\n?BR???R\\n7\\n????R??\\n1\\n?\\n1\\nB\\n10\\n?B???R??RB\\n\", \"5\\n7\\n??R??BR\\n7\\n????R??\\n1\\n?\\n1\\nB\\n10\\n?BR?B???R?\\n\", \"5\\n7\\n?BR???R\\n7\\n????R??\\n1\\n?\\n1\\nB\\n10\\nBR??R???B?\\n\", \"5\\n7\\nR??R?B?\\n7\\n??????R\\n1\\n?\\n1\\nB\\n10\\n?R??RB??B?\\n\", \"5\\n7\\n??R??RB\\n7\\n??R????\\n1\\n?\\n1\\nB\\n10\\n???BB??RR?\\n\", \"5\\n7\\nBR?R???\\n7\\n??????R\\n1\\n?\\n1\\nB\\n10\\n?B??BRR???\\n\", \"5\\n7\\n???R?RB\\n7\\n??????R\\n1\\n?\\n1\\nB\\n10\\n?B??BRR???\\n\", \"5\\n7\\nR???R?B\\n7\\n??R????\\n1\\n?\\n1\\nB\\n10\\nBR??R???B?\\n\", \"5\\n7\\nB????RR\\n7\\n????R??\\n1\\n?\\n1\\nB\\n10\\nBR??R???B?\\n\", \"5\\n7\\n?R???BR\\n7\\n??R????\\n1\\n?\\n1\\nB\\n10\\n?B??BR??R?\\n\", \"5\\n7\\n???R?BR\\n7\\n???R???\\n1\\n?\\n1\\nB\\n10\\n?B??BR??R?\\n\", \"5\\n7\\nB??R?R?\\n7\\n??????R\\n1\\n?\\n1\\nB\\n10\\n?B??BR??R?\\n\", \"5\\n7\\nRR??B??\\n7\\n??R????\\n1\\n?\\n1\\nB\\n10\\n?B???R??RB\\n\", \"5\\n7\\n???RBR?\\n7\\n??R????\\n1\\n?\\n1\\nB\\n10\\nBR??R???B?\\n\", \"5\\n7\\n?R???BR\\n7\\n???R???\\n1\\n?\\n1\\nB\\n10\\n?R??RB??B?\\n\"], \"outputs\": [\"BRBRBBR\\nBRBRBRB\\nR\\nB\\nBRBRRBRBBR\\n\", \"RB\\n\", \"BRBRBBR\\nBRBRBRB\\nB\\nB\\nBRBRRBRBBR\\n\", \"BR\\n\", \"BRBRBBR\\nBRBRBRB\\nB\\nB\\nRBRBBRBRRB\\n\", \"RBRBRRR\\nB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nB\\nBRBRRBRBBR\\n\", \"RBRRBBR\\nRBRBRBR\\nB\\nB\\nBRBRRBRBBR\\n\", \"RBRBRRB\\nRBRBRBR\\nB\\nB\\nRBRBBRBRRB\\n\", \"BRBRBRB\\nRBRBRBR\\nB\\nB\\nRBRBBRRBRB\\n\", \"BRBRBRB\\nRBRBRBR\\nB\\nB\\nRBRBBRRBRB\\n\", \"RBRBRBB\\nRBRBRBR\\nB\\nB\\nBRBRRBRBBR\\n\", \"BRBRBRR\\nRBRBRBR\\nB\\nB\\nBRBRRBRBBR\\n\", \"BRBRBBR\\nRBRBRBR\\nB\\nB\\nRBRBBRBRRB\\n\", \"BRBRBBR\\nBRBRBRB\\nB\\nB\\nRBRBBRBRRB\\n\", \"BRBRBRB\\nRBRBRBR\\nB\\nB\\nRBRBBRBRRB\\n\", \"RRBRBRB\\nRBRBRBR\\nB\\nB\\nRBRBRRBRRB\\n\", \"BRBRBRB\\nRBRBRBR\\nB\\nB\\nBRBRRBRBBR\\n\", \"BRBRBBR\\nBRBRBRB\\nB\\nB\\nBRBRRBRBBR\\n\"]}", "source": "primeintellect"}
As their story unravels, a timeless tale is told once again... Shirahime, a friend of Mocha's, is keen on playing the music game Arcaea and sharing Mocha interesting puzzles to solve. This day, Shirahime comes up with a new simple puzzle and wants Mocha to solve them. However, these puzzles are too easy for Mocha to solve, so she wants you to solve them and tell her the answers. The puzzles are described as follow. There are $n$ squares arranged in a row, and each of them can be painted either red or blue. Among these squares, some of them have been painted already, and the others are blank. You can decide which color to paint on each blank square. Some pairs of adjacent squares may have the same color, which is imperfect. We define the imperfectness as the number of pairs of adjacent squares that share the same color. For example, the imperfectness of "BRRRBBR" is $3$, with "BB" occurred once and "RR" occurred twice. Your goal is to minimize the imperfectness and print out the colors of the squares after painting. -----Input----- Each test contains multiple test cases. The first line contains a single integer $t$ ($1 \le t \le 100$) — the number of test cases. Each test case consists of two lines. The first line of each test case contains an integer $n$ ($1\leq n\leq 100$) — the length of the squares row. The second line of each test case contains a string $s$ with length $n$, containing characters 'B', 'R' and '?'. Here 'B' stands for a blue square, 'R' for a red square, and '?' for a blank square. -----Output----- For each test case, print a line with a string only containing 'B' and 'R', the colors of the squares after painting, which imperfectness is minimized. If there are multiple solutions, print any of them. -----Examples----- Input 5 7 ?R???BR 7 ???R??? 1 ? 1 B 10 ?R??RB??B? Output BRRBRBR BRBRBRB B B BRRBRBBRBR -----Note----- In the first test case, if the squares are painted "BRRBRBR", the imperfectness is $1$ (since squares $2$ and $3$ have the same color), which is the minimum possible imperfectness. Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [[\"LOL\"], [\"HOW R U\"], [\"WHERE DO U WANT 2 MEET L8R\"], [\"lol\"], [\"0\"], [\"ZER0\"], [\"1\"], [\"IS NE1 OUT THERE\"], [\"#\"], [\"#codewars #rocks\"]], \"outputs\": [[9], [13], [47], [9], [2], [11], [1], [31], [1], [36]]}", "source": "primeintellect"}
Prior to having fancy iPhones, teenagers would wear out their thumbs sending SMS messages on candybar-shaped feature phones with 3x4 numeric keypads. ------- ------- ------- | | | ABC | | DEF | | 1 | | 2 | | 3 | ------- ------- ------- ------- ------- ------- | GHI | | JKL | | MNO | | 4 | | 5 | | 6 | ------- ------- ------- ------- ------- ------- |PQRS | | TUV | | WXYZ| | 7 | | 8 | | 9 | ------- ------- ------- ------- ------- ------- | | |space| | | | * | | 0 | | # | ------- ------- ------- Prior to the development of T9 (predictive text entry) systems, the method to type words was called "multi-tap" and involved pressing a button repeatedly to cycle through the possible values. For example, to type a letter `"R"` you would press the `7` key three times (as the screen display for the current character cycles through `P->Q->R->S->7`). A character is "locked in" once the user presses a different key or pauses for a short period of time (thus, no extra button presses are required beyond what is needed for each letter individually). The zero key handles spaces, with one press of the key producing a space and two presses producing a zero. In order to send the message `"WHERE DO U WANT 2 MEET L8R"` a teen would have to actually do 47 button presses. No wonder they abbreviated. For this assignment, write a module that can calculate the amount of button presses required for any phrase. Punctuation can be ignored for this exercise. Likewise, you can assume the phone doesn't distinguish between upper/lowercase characters (but you should allow your module to accept input in either for convenience). Hint: While it wouldn't take too long to hard code the amount of keypresses for all 26 letters by hand, try to avoid doing so! (Imagine you work at a phone manufacturer who might be testing out different keyboard layouts, and you want to be able to test new ones rapidly.) Write your solution by modifying this code: ```python def presses(phrase): ``` Your solution should implemented in the function "presses". The i Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [\"10000\\n5000 3150\\n5000 5000\\n0 0\\n5000 1050\\n5000 3980\\n5000 210\\n5000 5000\\n5000 5000\\n0 0\\n5000 2100\\n5000 2100\\n5000 2100\\n29170\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 101000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 70831\\n0\", \"10000\\n1225 3150\\n5000 5000\\n0 0\\n5000 1050\\n5000 3980\\n5000 210\\n5000 5000\\n5000 5000\\n0 0\\n5000 2100\\n5000 2494\\n5000 2100\\n29170\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 101000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 70831\\n0\", \"10000\\n1225 3150\\n5000 5000\\n0 0\\n5000 1050\\n5000 3980\\n5000 210\\n5000 5000\\n5000 5000\\n0 0\\n5075 2100\\n5000 2494\\n5000 2100\\n29170\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 101000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 000000\\n100000 70831\\n0\", \"10000\\n1225 3150\\n5000 6694\\n0 0\\n5000 1050\\n5000 3980\\n5000 210\\n5000 5000\\n5000 5000\\n0 0\\n5075 2100\\n5000 2494\\n5000 2100\\n29170\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 101000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 000000\\n100000 70831\\n0\", \"10000\\n1225 3150\\n5000 6694\\n0 0\\n5000 1050\\n5000 3980\\n5000 210\\n5000 5000\\n5000 5000\\n0 0\\n5075 2100\\n9143 2494\\n5000 2100\\n29170\\n100000 000000\\n100010 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 101000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 000000\\n100000 70831\\n0\", \"10000\\n1225 3150\\n5000 6694\\n0 0\\n5000 1050\\n5000 2519\\n5000 210\\n5000 5000\\n5000 5000\\n-1 0\\n5075 2100\\n9143 2494\\n5000 2100\\n29170\\n100000 000000\\n100010 110000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 101000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 000000\\n100000 70831\\n0\", \"10000\\n1225 3150\\n5000 5000\\n0 0\\n5000 1050\\n5000 3980\\n5000 210\\n5000 5000\\n5000 2831\\n0 0\\n5075 2100\\n5000 2494\\n5000 2100\\n29170\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 101000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 000000\\n100000 70831\\n0\", \"10000\\n1225 3150\\n5000 6694\\n0 0\\n5000 1050\\n5000 3980\\n5000 210\\n5000 6907\\n5000 5000\\n0 0\\n5075 2100\\n5000 2494\\n5000 2100\\n29170\\n100000 100000\\n100010 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 101000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 000000\\n100000 70831\\n0\", \"10000\\n1225 3150\\n5000 6694\\n1 0\\n7545 1050\\n5000 2519\\n5000 210\\n5000 5000\\n5000 5000\\n-1 0\\n5075 1589\\n9143 2494\\n5000 2100\\n29170\\n100000 000000\\n100010 110000\\n100000 100000\\n100000 100000\\n100100 100000\\n100000 111000\\n100000 100000\\n101000 100000\\n100000 100000\\n100000 100000\\n100000 000000\\n100000 131331\\n0\", \"10000\\n1225 3150\\n5000 6694\\n0 0\\n5000 1050\\n5000 2519\\n5000 254\\n522 5000\\n5000 7588\\n-1 0\\n5075 3046\\n9143 2494\\n5000 2100\\n29170\\n100000 000000\\n100010 110000\\n100000 100000\\n100000 100000\\n101100 100000\\n100000 111000\\n101000 100000\\n101000 100000\\n100000 100000\\n100000 100000\\n100000 000000\\n100000 131331\\n0\", \"10000\\n5000 3150\\n5000 5000\\n0 0\\n5000 1050\\n5000 3980\\n5000 210\\n5000 5000\\n5000 5000\\n0 0\\n5000 2100\\n5000 4903\\n5000 2100\\n29170\\n100000 100000\\n100000 100000\\n100010 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 001000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 70831\\n0\", \"10000\\n5000 3150\\n5000 5000\\n0 0\\n5000 1050\\n5000 3980\\n5000 210\\n5000 5000\\n5000 5000\\n0 0\\n5000 2100\\n4860 2494\\n5000 2100\\n29170\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 000000\\n100000 100000\\n100000 101000\\n100000 100000\\n100000 101000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 70831\\n0\", \"10000\\n1225 3150\\n5000 6694\\n0 0\\n5000 1050\\n5000 3980\\n5000 210\\n5000 443\\n5000 5000\\n0 0\\n5075 2100\\n5000 2494\\n5000 2100\\n29170\\n100000 110000\\n100000 100000\\n100000 100100\\n100000 101000\\n100000 100000\\n100000 101000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 000000\\n100000 70831\\n0\", \"10000\\n1225 3150\\n109 6694\\n0 0\\n5000 1050\\n5000 3980\\n5000 210\\n5000 5000\\n5000 5000\\n0 0\\n5075 2100\\n9143 3892\\n5000 2100\\n29170\\n100000 100000\\n100010 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 101000\\n100000 000000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 000000\\n100000 70831\\n0\", \"10000\\n5000 3150\\n5000 5000\\n0 0\\n5000 1050\\n5000 3980\\n5000 210\\n6485 5000\\n5000 6519\\n0 0\\n5000 2100\\n5000 2100\\n1395 2100\\n29170\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n110000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 70831\\n0\", \"10000\\n1225 3150\\n5000 5000\\n0 0\\n5000 2028\\n5000 3980\\n5000 210\\n5000 5000\\n5000 5000\\n0 0\\n5075 2100\\n5000 2494\\n5000 2100\\n29170\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 110000\\n100000 100000\\n100000 111000\\n100000 100000\\n100000 100000\\n100000 100000\\n100010 100000\\n100000 100000\\n100000 70831\\n0\", \"10000\\n1225 3150\\n5000 40\\n0 0\\n5000 1050\\n5000 3980\\n5000 210\\n5000 443\\n5000 5000\\n0 0\\n5075 2100\\n5000 2494\\n5000 2100\\n29170\\n100000 110000\\n100000 100000\\n100000 100100\\n100000 101000\\n100000 100000\\n100000 101000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 000000\\n100000 70831\\n0\", \"10000\\n1225 3150\\n5000 6694\\n0 0\\n2199 1050\\n5000 3980\\n5000 210\\n5000 6907\\n5000 5000\\n0 0\\n5075 2100\\n5000 2494\\n5000 2100\\n29170\\n100000 100000\\n100010 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 101000\\n100000 100000\\n100000 100000\\n100000 101000\\n100000 100000\\n100000 000000\\n100000 70831\\n0\", \"10000\\n5000 3150\\n5000 5000\\n0 0\\n5000 906\\n5000 133\\n5000 210\\n5000 5000\\n5000 5000\\n0 0\\n5000 2100\\n5000 2100\\n5000 2100\\n29170\\n100000 100000\\n100000 100100\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 101000\\n100000 100000\\n100000 101000\\n100000 100000\\n100000 101000\\n100000 100000\\n100000 101531\\n0\", \"10000\\n1225 3150\\n5000 5000\\n0 0\\n5000 464\\n5000 3980\\n5000 210\\n5000 5000\\n5000 5000\\n0 0\\n5000 2979\\n5000 2494\\n5000 2100\\n29170\\n100000 100000\\n100000 000000\\n100100 100000\\n100000 100000\\n100000 100100\\n100010 101010\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 70831\\n0\", \"10000\\n5000 3150\\n5000 5000\\n0 0\\n5000 1050\\n2495 3980\\n5000 210\\n5000 5000\\n5000 5000\\n0 0\\n5000 2100\\n4860 2494\\n5000 2100\\n29170\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 000000\\n100000 100000\\n100000 101000\\n100000 100000\\n100000 101000\\n100000 100001\\n100001 100000\\n100000 100000\\n100000 70831\\n0\", \"10000\\n1225 3150\\n7409 40\\n0 0\\n5000 1050\\n5000 3980\\n5000 210\\n4194 676\\n5000 5000\\n0 0\\n5075 2100\\n5000 2494\\n5000 2100\\n29170\\n100000 110000\\n100000 100000\\n100000 100100\\n100000 001000\\n100000 100000\\n100000 101000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 000000\\n100000 70831\\n0\", \"10000\\n1225 3150\\n109 6694\\n0 0\\n5000 1050\\n3592 3980\\n5000 210\\n5000 5000\\n8886 5000\\n0 0\\n5075 2100\\n9143 3892\\n5000 2100\\n29170\\n100000 100000\\n100010 101000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 101000\\n100000 000000\\n100001 100000\\n101000 100000\\n100000 100000\\n100000 000000\\n100000 70831\\n0\", \"10000\\n1225 3150\\n861 12737\\n0 -1\\n5000 1050\\n5000 4211\\n5000 412\\n5000 5000\\n5000 5000\\n-1 -1\\n5075 1951\\n9143 2494\\n5000 2100\\n29170\\n100000 000000\\n100010 110000\\n100000 100000\\n100000 100000\\n100100 100100\\n100000 111000\\n100000 100000\\n101000 100000\\n100000 100010\\n100000 100000\\n100000 000000\\n100000 131331\\n0\", \"10000\\n1225 5385\\n5000 3433\\n0 0\\n2199 1050\\n5000 3980\\n5000 210\\n5000 6907\\n5000 5000\\n0 0\\n5075 2100\\n1758 2494\\n5000 2100\\n29170\\n100000 100000\\n100010 100000\\n100000 100000\\n100000 100000\\n100000 110000\\n100000 101000\\n100000 100000\\n100000 100000\\n100000 001000\\n100000 100000\\n100000 000000\\n100000 70831\\n0\", \"10000\\n1225 3150\\n109 12029\\n0 0\\n5000 1050\\n3592 3980\\n5000 210\\n5000 5000\\n8886 5000\\n0 0\\n5075 2100\\n9143 3892\\n5000 2100\\n29170\\n100000 100000\\n100010 101000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 101000\\n100000 000000\\n100001 100000\\n101000 100000\\n100000 100000\\n100000 000000\\n100000 70831\\n0\", \"10000\\n1225 3150\\n5129 6694\\n0 0\\n734 1050\\n5000 3980\\n5000 210\\n5000 5000\\n7377 8286\\n-1 0\\n9564 2100\\n9143 2494\\n5000 2100\\n29170\\n100000 100000\\n100010 110000\\n100000 000000\\n100000 100000\\n100000 110000\\n100000 001000\\n100000 100000\\n100000 100000\\n100000 000000\\n100000 100000\\n100000 000000\\n100000 70831\\n0\", \"10000\\n1225 3150\\n5000 941\\n0 0\\n5000 464\\n5000 3980\\n5000 210\\n5000 5000\\n5000 5000\\n0 0\\n5000 2979\\n5000 2494\\n5000 2100\\n29170\\n100000 100000\\n101000 000000\\n100101 100000\\n100000 100000\\n100000 111100\\n100010 101010\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 70831\\n0\", \"10000\\n1225 3150\\n4647 6694\\n0 0\\n734 1050\\n5000 3782\\n5000 210\\n5000 5000\\n7377 8286\\n-1 0\\n9564 2100\\n3420 2494\\n5000 2100\\n29170\\n100000 100000\\n100010 110000\\n100000 000000\\n100000 100000\\n100000 110000\\n100000 001000\\n100000 100000\\n100000 101000\\n100000 000000\\n100000 100000\\n100000 000000\\n100000 70831\\n0\", \"10000\\n1225 3150\\n7409 40\\n0 0\\n5000 1672\\n5000 2040\\n5000 210\\n4194 676\\n5000 5000\\n0 0\\n5075 3140\\n5000 2494\\n5000 2100\\n29170\\n000000 110000\\n100000 100000\\n100010 100100\\n100010 001000\\n100000 100000\\n100000 101000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100010 000000\\n100000 47616\\n0\", \"10000\\n1225 3150\\n4647 6694\\n0 0\\n734 1478\\n5000 3782\\n5000 210\\n5000 8648\\n7377 8286\\n-1 0\\n9564 2100\\n3420 2494\\n5000 2100\\n29170\\n100000 100000\\n100010 110000\\n100000 000000\\n100000 110000\\n100000 110000\\n100000 001000\\n100000 100000\\n100000 101000\\n100000 000000\\n100000 100000\\n100001 000000\\n100000 70831\\n0\", \"10000\\n1225 2413\\n7304 6694\\n0 0\\n5000 1050\\n13172 2519\\n9264 254\\n5000 5000\\n6657 3205\\n0 0\\n5075 3056\\n9143 4498\\n5000 4125\\n25708\\n100010 000000\\n100010 110000\\n100100 100000\\n100010 100100\\n101100 100000\\n100000 111000\\n101100 100000\\n101000 100000\\n000100 000000\\n100000 100000\\n100000 000000\\n100000 70070\\n0\", \"10000\\n1116 3150\\n5000 5000\\n0 0\\n5000 1050\\n7273 3980\\n5000 210\\n6485 5000\\n7598 6519\\n0 0\\n5000 2100\\n5000 2100\\n1386 2100\\n29170\\n000100 100000\\n100100 110000\\n000000 100000\\n101000 010000\\n110000 100000\\n100000 100000\\n100000 100010\\n000000 100000\\n100000 100000\\n100000 100100\\n101000 100000\\n100000 70831\\n0\", \"10000\\n5000 3150\\n5000 5000\\n0 0\\n5000 1050\\n2495 5038\\n1979 210\\n5000 5000\\n5000 5000\\n0 0\\n5000 2100\\n4860 376\\n5000 3022\\n29170\\n101000 100000\\n100000 100000\\n100000 100000\\n100000 000000\\n100000 100011\\n100000 101000\\n110100 100000\\n100000 101000\\n000000 001001\\n110001 100000\\n100000 100000\\n100000 70831\\n0\", \"10000\\n1225 3150\\n7409 113\\n0 0\\n5000 1672\\n5000 2040\\n5000 210\\n4194 676\\n5000 5000\\n0 0\\n5075 1161\\n5000 2494\\n5000 2100\\n29170\\n000000 110000\\n100000 100001\\n100010 100100\\n100010 001000\\n100000 100000\\n100000 101000\\n100000 100010\\n110000 100000\\n110000 100001\\n000000 100000\\n100010 000000\\n100000 47616\\n0\", \"10000\\n1225 1857\\n5000 5000\\n-1 0\\n477 2028\\n4385 4197\\n5000 210\\n811 3030\\n5000 5000\\n0 0\\n5075 2100\\n7382 2494\\n3312 2100\\n57992\\n100000 100000\\n100000 100001\\n100100 100000\\n100000 110000\\n100000 100000\\n100001 111000\\n100000 100000\\n100010 100010\\n101000 110000\\n100010 100010\\n100000 100000\\n100001 70831\\n0\", \"10000\\n1225 3150\\n4647 2574\\n0 0\\n160 1478\\n5000 3782\\n5000 210\\n5000 14685\\n7377 8286\\n-1 1\\n17580 603\\n3420 2494\\n5000 2100\\n40126\\n100010 100000\\n100010 110100\\n100000 001000\\n100000 110000\\n100000 100000\\n100000 001000\\n100000 100000\\n101000 101000\\n100001 000000\\n101000 000000\\n100001 000000\\n100000 52383\\n0\", \"10000\\n8123 3150\\n7407 5000\\n-2 -1\\n5000 20\\n3472 2975\\n5698 64\\n9039 5000\\n4099 5000\\n0 0\\n1452 2100\\n5000 2494\\n5000 2100\\n29170\\n100000 100000\\n000000 110000\\n000011 100000\\n000000 100000\\n100000 101001\\n000000 101010\\n100000 100000\\n100000 110000\\n100010 110100\\n100000 100100\\n101001 100000\\n100000 206880\\n0\", \"10000\\n1225 2727\\n5000 6004\\n0 -1\\n2108 240\\n5706 3980\\n5000 210\\n5000 6907\\n2336 7309\\n0 0\\n5075 3335\\n1050 4134\\n5000 2100\\n18695\\n000001 100100\\n100011 100000\\n100000 000100\\n100000 000000\\n100000 110000\\n100100 101000\\n100001 100000\\n110000 100001\\n100001 001101\\n100000 101000\\n110010 000000\\n100001 70831\\n0\", \"10000\\n12996 3150\\n7407 5359\\n-2 -1\\n8035 20\\n3472 756\\n5698 64\\n9039 5000\\n4099 5000\\n-1 0\\n1452 2100\\n2429 2494\\n5000 2100\\n29170\\n100000 100000\\n000000 110000\\n000011 100000\\n000000 100000\\n100000 101001\\n000000 101010\\n100000 100000\\n100000 110000\\n100010 110100\\n100000 100100\\n101001 100000\\n100000 206880\\n0\", \"10000\\n1225 3150\\n5000 6694\\n0 0\\n5000 1050\\n5000 2519\\n5000 254\\n8584 5000\\n5000 5000\\n-1 0\\n5075 1589\\n9143 2494\\n5000 2100\\n29170\\n100000 000000\\n100010 110000\\n100000 100000\\n100000 100000\\n101100 100000\\n100000 111000\\n100000 100000\\n101000 100000\\n100000 100000\\n100000 100000\\n100000 000000\\n100000 131331\\n0\", \"10000\\n5000 3150\\n5000 5000\\n0 0\\n5000 1050\\n5000 3980\\n5698 210\\n5000 5000\\n5000 5000\\n0 0\\n5000 2100\\n5000 2494\\n5000 2100\\n29170\\n100000 100000\\n000000 100000\\n100000 100000\\n100000 000000\\n100000 000000\\n100000 101000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 79962\\n0\", \"10000\\n1225 3150\\n5000 5000\\n0 0\\n5000 2028\\n5000 3980\\n5000 210\\n5000 5000\\n5000 5000\\n0 0\\n1651 2100\\n5000 2494\\n7746 2100\\n29170\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 110000\\n100000 100000\\n100000 111000\\n100000 100000\\n100000 100000\\n100000 100000\\n100010 100000\\n100000 100000\\n100000 70831\\n0\", \"10000\\n5000 3150\\n5000 118\\n0 0\\n5000 1050\\n5000 3980\\n5000 210\\n5000 5000\\n5000 5000\\n0 0\\n5000 2100\\n4860 2494\\n5000 2100\\n29170\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 000000\\n100000 100000\\n100000 101000\\n100000 100000\\n100000 101000\\n100000 100001\\n100001 100000\\n100000 100000\\n100000 70831\\n0\", \"10000\\n1225 5385\\n5000 3433\\n0 0\\n2199 1050\\n5000 3980\\n8311 210\\n5000 6907\\n5000 5000\\n0 0\\n5075 2100\\n1758 2494\\n5000 2100\\n29170\\n100000 100000\\n100010 100000\\n100000 100000\\n100000 100000\\n100000 110000\\n100000 101000\\n100000 100000\\n100000 100000\\n100000 001000\\n100000 100000\\n100000 000000\\n100000 70831\\n0\", \"10000\\n1225 3150\\n5000 5000\\n0 0\\n875 1050\\n5000 3980\\n9730 210\\n5000 5000\\n5000 2831\\n0 0\\n5066 2100\\n5000 2494\\n5000 2100\\n29170\\n100000 100000\\n100000 100010\\n100000 100000\\n100000 100000\\n100100 100000\\n000000 101001\\n100000 100000\\n100000 100000\\n100000 110000\\n101000 100000\\n100000 000000\\n110000 70831\\n0\", \"10000\\n1225 3150\\n7409 40\\n0 0\\n5000 1672\\n5000 2040\\n5000 210\\n4194 676\\n5000 5000\\n0 0\\n5075 3140\\n5000 2494\\n5000 2100\\n29170\\n100000 110000\\n100000 000000\\n100000 100100\\n100000 001000\\n100000 100000\\n100000 101000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100010 000000\\n100000 70831\\n0\", \"10000\\n5000 3150\\n5000 5000\\n0 0\\n5000 1050\\n5000 3980\\n5000 210\\n5000 5000\\n5000 5000\\n0 0\\n5000 2100\\n5000 2494\\n5000 2100\\n29170\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 101000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 70831\\n0\", \"10000\\n5000 3150\\n5000 5000\\n0 0\\n5000 1050\\n5000 3980\\n5000 210\\n5000 5000\\n5000 5000\\n0 0\\n5000 2100\\n5000 2494\\n5000 2100\\n29170\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 101000\\n100000 100000\\n100000 101000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 70831\\n0\", \"10000\\n5000 3150\\n5000 5000\\n0 0\\n5000 1050\\n5000 3980\\n5000 210\\n5000 5000\\n5000 5000\\n0 0\\n5000 2100\\n5000 2494\\n5000 2100\\n29170\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 101000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 70831\\n0\", \"10000\\n1225 3150\\n5000 5000\\n0 0\\n5000 1050\\n5000 3980\\n5000 210\\n5000 5000\\n5000 5000\\n0 0\\n5075 2100\\n5000 2494\\n5000 2100\\n29170\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 101000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 70831\\n0\", \"10000\\n1225 3150\\n5000 6694\\n0 0\\n5000 1050\\n5000 3980\\n5000 210\\n5000 5000\\n5000 5000\\n0 0\\n5075 2100\\n5000 2494\\n5000 2100\\n29170\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 101000\\n100000 100000\\n100000 101000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 000000\\n100000 70831\\n0\", \"10000\\n1225 3150\\n5000 6694\\n0 0\\n5000 1050\\n5000 3980\\n5000 210\\n5000 5000\\n5000 5000\\n0 0\\n5075 2100\\n5000 2494\\n5000 2100\\n29170\\n100000 100000\\n100010 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 101000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 000000\\n100000 70831\\n0\", \"10000\\n1225 3150\\n5000 6694\\n0 0\\n5000 1050\\n5000 3980\\n5000 210\\n5000 5000\\n5000 5000\\n0 0\\n5075 2100\\n9143 2494\\n5000 2100\\n29170\\n100000 100000\\n100010 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 101000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 000000\\n100000 70831\\n0\", \"10000\\n1225 3150\\n5000 6694\\n0 0\\n5000 1050\\n5000 3980\\n5000 210\\n5000 5000\\n5000 5000\\n0 0\\n5075 2100\\n9143 2494\\n5000 2100\\n29170\\n100000 000000\\n100010 110000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 101000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 000000\\n100000 70831\\n0\", \"10000\\n1225 3150\\n5000 6694\\n0 0\\n5000 1050\\n5000 3980\\n5000 210\\n5000 5000\\n5000 5000\\n-1 0\\n5075 2100\\n9143 2494\\n5000 2100\\n29170\\n100000 000000\\n100010 110000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 101000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 000000\\n100000 70831\\n0\", \"10000\\n1225 3150\\n5000 6694\\n0 0\\n5000 1050\\n5000 2519\\n5000 210\\n5000 5000\\n5000 5000\\n-1 0\\n5075 1589\\n9143 2494\\n5000 2100\\n29170\\n100000 000000\\n100010 110000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 101000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 000000\\n100000 70831\\n0\", \"10000\\n1225 3150\\n5000 6694\\n0 0\\n5000 1050\\n5000 2519\\n5000 210\\n5000 5000\\n5000 5000\\n-1 0\\n5075 1589\\n9143 2494\\n5000 2100\\n29170\\n100000 000000\\n100010 110000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 101000\\n100000 100000\\n101000 100000\\n100000 100000\\n100000 100000\\n100000 000000\\n100000 70831\\n0\", \"10000\\n1225 3150\\n5000 6694\\n0 0\\n5000 1050\\n5000 2519\\n5000 210\\n5000 5000\\n5000 5000\\n-1 0\\n5075 1589\\n9143 2494\\n5000 2100\\n29170\\n100000 000000\\n100010 110000\\n100000 100000\\n100000 100000\\n100100 100000\\n100000 101000\\n100000 100000\\n101000 100000\\n100000 100000\\n100000 100000\\n100000 000000\\n100000 70831\\n0\", \"10000\\n1225 3150\\n5000 6694\\n0 0\\n5000 1050\\n5000 2519\\n5000 210\\n5000 5000\\n5000 5000\\n-1 0\\n5075 1589\\n9143 2494\\n5000 2100\\n29170\\n100000 000000\\n100010 110000\\n100000 100000\\n100000 100000\\n100100 100000\\n100000 111000\\n100000 100000\\n101000 100000\\n100000 100000\\n100000 100000\\n100000 000000\\n100000 70831\\n0\", \"10000\\n1225 3150\\n5000 6694\\n0 0\\n5000 1050\\n5000 2519\\n5000 210\\n5000 5000\\n5000 5000\\n-1 0\\n5075 1589\\n9143 2494\\n5000 2100\\n29170\\n100000 000000\\n100010 110000\\n100000 100000\\n100000 100000\\n100100 100000\\n100000 111000\\n100000 100000\\n101000 100000\\n100000 100000\\n100000 100000\\n100000 000000\\n100000 131331\\n0\", \"10000\\n1225 3150\\n5000 6694\\n0 0\\n5000 1050\\n5000 2519\\n5000 412\\n5000 5000\\n5000 5000\\n-1 0\\n5075 1589\\n9143 2494\\n5000 2100\\n29170\\n100000 000000\\n100010 110000\\n100000 100000\\n100000 100000\\n100100 100000\\n100000 111000\\n100000 100000\\n101000 100000\\n100000 100000\\n100000 100000\\n100000 000000\\n100000 131331\\n0\", \"10000\\n1225 3150\\n5000 6694\\n0 0\\n5000 1050\\n5000 2519\\n5000 254\\n5000 5000\\n5000 5000\\n-1 0\\n5075 1589\\n9143 2494\\n5000 2100\\n29170\\n100000 000000\\n100010 110000\\n100000 100000\\n100000 100000\\n100100 100000\\n100000 111000\\n100000 100000\\n101000 100000\\n100000 100000\\n100000 100000\\n100000 000000\\n100000 131331\\n0\", \"10000\\n1225 3150\\n5000 6694\\n0 0\\n5000 1050\\n5000 2519\\n5000 254\\n5000 5000\\n5000 5000\\n-1 0\\n5075 1589\\n9143 2494\\n5000 2100\\n29170\\n100000 000000\\n100010 110000\\n100000 100000\\n100000 100000\\n101100 100000\\n100000 111000\\n100000 100000\\n101000 100000\\n100000 100000\\n100000 100000\\n100000 000000\\n100000 131331\\n0\", \"10000\\n1225 3150\\n5000 6694\\n0 0\\n5000 1050\\n5000 2519\\n5000 254\\n5000 5000\\n5000 7588\\n-1 0\\n5075 1589\\n9143 2494\\n5000 2100\\n29170\\n100000 000000\\n100010 110000\\n100000 100000\\n100000 100000\\n101100 100000\\n100000 111000\\n100000 100000\\n101000 100000\\n100000 100000\\n100000 100000\\n100000 000000\\n100000 131331\\n0\", \"10000\\n1225 3150\\n5000 6694\\n0 0\\n5000 1050\\n5000 2519\\n5000 254\\n5000 5000\\n5000 7588\\n-1 0\\n5075 1589\\n9143 2494\\n5000 2100\\n29170\\n100000 000000\\n100010 110000\\n100000 100000\\n100000 100000\\n101100 100000\\n100000 111000\\n101000 100000\\n101000 100000\\n100000 100000\\n100000 100000\\n100000 000000\\n100000 131331\\n0\", \"10000\\n1225 3150\\n5000 6694\\n0 0\\n5000 1050\\n5000 2519\\n5000 254\\n5000 5000\\n5000 7588\\n-1 0\\n5075 1589\\n9143 2494\\n5000 2100\\n43893\\n100000 000000\\n100010 110000\\n100000 100000\\n100000 100000\\n101100 100000\\n100000 111000\\n101000 100000\\n101000 100000\\n100000 100000\\n100000 100000\\n100000 000000\\n100000 131331\\n0\", \"10000\\n1225 3150\\n5000 6694\\n0 0\\n5000 1050\\n5000 2519\\n5000 254\\n5000 5000\\n5000 7588\\n-1 0\\n5075 1589\\n9143 2494\\n5000 2100\\n43893\\n100000 000000\\n100010 110000\\n100000 100000\\n100000 100000\\n101100 100000\\n100000 111000\\n101000 100000\\n101100 100000\\n100000 100000\\n100000 100000\\n100000 000000\\n100000 131331\\n0\", \"10000\\n1225 3150\\n5000 6694\\n0 0\\n5000 1050\\n5000 2519\\n5000 254\\n5000 5000\\n5000 7588\\n-1 0\\n5075 1589\\n9143 2494\\n5000 2100\\n43893\\n100000 001000\\n100010 110000\\n100000 100000\\n100000 100000\\n101100 100000\\n100000 111000\\n101000 100000\\n101100 100000\\n100000 100000\\n100000 100000\\n100000 000000\\n100000 131331\\n0\", \"10000\\n5000 3150\\n5000 5000\\n0 0\\n5000 1050\\n5000 3980\\n5000 210\\n5000 5000\\n5000 6519\\n0 0\\n5000 2100\\n5000 2100\\n5000 2100\\n29170\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 70831\\n0\", \"10000\\n5000 3150\\n5000 5000\\n0 0\\n5000 1050\\n5000 3980\\n5000 210\\n5000 5000\\n5000 5000\\n0 0\\n5000 2100\\n5000 2100\\n5000 2100\\n29170\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 101000\\n100000 100000\\n100000 101000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 70831\\n0\", \"10000\\n5000 3150\\n5000 5000\\n0 0\\n5000 1050\\n5000 3980\\n5000 210\\n5000 5000\\n5000 5000\\n0 0\\n5000 2100\\n5000 2494\\n5000 2100\\n29170\\n100000 100000\\n100000 100000\\n100010 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 101000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 70831\\n0\", \"10000\\n5000 3150\\n5000 5000\\n0 0\\n5000 1050\\n5000 3980\\n5000 210\\n5000 5000\\n5000 5000\\n0 0\\n5000 2100\\n9374 2494\\n5000 2100\\n29170\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 101000\\n100000 100000\\n100000 101000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 70831\\n0\", \"10000\\n5000 3150\\n5000 5000\\n0 0\\n5000 1050\\n5000 3980\\n5000 210\\n5000 5000\\n5000 5000\\n0 0\\n5000 2100\\n5000 2494\\n5000 2100\\n29170\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 101000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 79962\\n0\", \"10000\\n1225 3150\\n5000 5000\\n0 0\\n5000 1050\\n5000 3980\\n5000 210\\n5000 5000\\n5000 5000\\n0 0\\n5000 2100\\n5000 2494\\n5000 2100\\n29170\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 101010\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 70831\\n0\", \"10000\\n1225 3150\\n5000 5000\\n0 0\\n5000 1050\\n5000 3980\\n5000 210\\n5000 5000\\n5000 5000\\n0 0\\n5075 2100\\n5000 2494\\n5000 2100\\n29170\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 111000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 70831\\n0\", \"10000\\n1225 3150\\n5000 6694\\n0 0\\n5000 1050\\n5000 3980\\n5000 210\\n5000 5000\\n5000 5000\\n0 0\\n5075 2100\\n5000 2494\\n5000 2100\\n29170\\n100000 100000\\n100000 100001\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 101000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 000000\\n100000 70831\\n0\", \"10000\\n1225 3150\\n5000 6694\\n0 0\\n5000 1050\\n5000 3980\\n5000 210\\n5000 5000\\n5000 5000\\n0 0\\n5075 2100\\n5000 2494\\n5000 2100\\n29170\\n100000 100000\\n100000 100000\\n100000 100100\\n100000 101000\\n100000 100000\\n100000 101000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 000000\\n100000 70831\\n0\", \"10000\\n1225 3150\\n5000 6694\\n0 0\\n5000 1050\\n5000 3980\\n5000 210\\n5000 5000\\n5000 5000\\n0 0\\n5075 2100\\n9143 3892\\n5000 2100\\n29170\\n100000 100000\\n100010 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 101000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 000000\\n100000 70831\\n0\", \"10000\\n1225 3150\\n5000 6694\\n0 0\\n5000 1050\\n5000 3980\\n5000 210\\n5000 5000\\n5000 5000\\n0 0\\n5075 2100\\n13547 2494\\n5000 2100\\n29170\\n100000 000000\\n100010 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 101000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 000000\\n100000 70831\\n0\", \"10000\\n1225 3150\\n5000 6694\\n0 0\\n5000 1050\\n5000 3980\\n5000 210\\n5000 5000\\n5000 5000\\n0 0\\n5075 2100\\n9143 2494\\n5000 2100\\n29170\\n100000 000000\\n100010 110000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 101000\\n100000 100010\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 000000\\n100000 70831\\n0\", \"10000\\n1225 3150\\n5000 6694\\n0 0\\n5000 1050\\n5000 3980\\n5000 210\\n5000 5000\\n5000 5000\\n-1 0\\n5075 2100\\n9143 2494\\n5000 2100\\n29170\\n100000 000000\\n100010 110000\\n100000 100000\\n100000 100000\\n100000 110000\\n100000 101000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 000000\\n100000 70831\\n0\", \"10000\\n1225 3150\\n5000 6694\\n0 0\\n5000 1050\\n2582 2519\\n5000 210\\n5000 5000\\n5000 5000\\n-1 0\\n5075 2100\\n9143 2494\\n5000 2100\\n29170\\n100000 000000\\n100010 110000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 101000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 000000\\n100000 70831\\n0\", \"10000\\n1225 3150\\n5000 6694\\n0 0\\n5000 1050\\n5000 2519\\n5000 210\\n5000 5000\\n5000 5000\\n-1 0\\n5075 1589\\n9143 2494\\n5000 2100\\n29170\\n100000 000000\\n100010 110000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 101000\\n100000 100000\\n100000 100000\\n100000 000000\\n100000 100000\\n100000 000000\\n100000 70831\\n0\", \"10000\\n1225 3150\\n5000 6694\\n0 0\\n5000 1050\\n5000 2519\\n5000 210\\n5000 5000\\n5000 5000\\n-1 0\\n5075 1589\\n9143 2494\\n5000 2100\\n29170\\n100000 000000\\n100010 110000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 101001\\n100000 100000\\n101000 100000\\n100000 100000\\n100000 100000\\n100000 000000\\n100000 70831\\n0\", \"10000\\n1225 3150\\n5000 6694\\n0 0\\n5000 1050\\n5000 2519\\n5000 210\\n5000 5000\\n5000 5000\\n-1 0\\n5075 1589\\n9143 2494\\n5000 2100\\n29170\\n100000 000000\\n100010 110000\\n100000 000000\\n100000 100000\\n100100 100000\\n100000 101000\\n100000 100000\\n101000 100000\\n100000 100000\\n100000 100000\\n100000 000000\\n100000 70831\\n0\", \"10000\\n1225 3150\\n5000 6694\\n0 0\\n5000 1050\\n5000 2519\\n5000 210\\n5000 5000\\n5000 5000\\n-1 0\\n5075 1589\\n9143 2494\\n5000 2100\\n29170\\n100000 000000\\n100010 110000\\n100000 100000\\n100000 100000\\n100100 100001\\n100000 111000\\n100000 100000\\n101000 100000\\n100000 100000\\n100000 100000\\n100000 000000\\n100000 70831\\n0\", \"10000\\n1225 3150\\n5000 6694\\n1 0\\n5000 1050\\n5000 2519\\n5000 210\\n5000 5000\\n5000 5000\\n-1 0\\n5075 1589\\n9143 2494\\n5000 2100\\n29170\\n100000 000000\\n100010 110000\\n100000 100000\\n100000 100000\\n100100 100000\\n100000 111000\\n100000 100000\\n101000 100000\\n100000 100000\\n100000 100000\\n100000 000000\\n100000 131331\\n0\", \"10000\\n1225 3150\\n861 6694\\n0 0\\n5000 1050\\n5000 2519\\n5000 412\\n5000 5000\\n5000 5000\\n-1 0\\n5075 1589\\n9143 2494\\n5000 2100\\n29170\\n100000 000000\\n100010 110000\\n100000 100000\\n100000 100000\\n100100 100000\\n100000 111000\\n100000 100000\\n101000 100000\\n100000 100000\\n100000 100000\\n100000 000000\\n100000 131331\\n0\", \"10000\\n1225 3150\\n5000 6694\\n0 0\\n3412 1050\\n5000 2519\\n5000 254\\n5000 5000\\n5000 5000\\n-1 0\\n5075 1589\\n9143 2494\\n5000 2100\\n29170\\n100000 000000\\n100010 110000\\n100000 100000\\n100000 100000\\n100100 100000\\n100000 111000\\n100000 100000\\n101000 100000\\n100000 100000\\n100000 100000\\n100000 000000\\n100000 131331\\n0\", \"10000\\n1225 3150\\n5000 6694\\n0 0\\n5000 1050\\n5000 2519\\n5000 254\\n5000 5000\\n5000 5000\\n-1 0\\n5075 1589\\n9143 2494\\n5000 2100\\n29170\\n100000 000000\\n100010 110000\\n100000 100000\\n100000 100000\\n101100 100000\\n100000 111000\\n100001 100000\\n101000 100000\\n100000 100000\\n100000 100000\\n100000 000000\\n100000 131331\\n0\", \"10000\\n1225 3150\\n5000 6694\\n0 0\\n5000 1050\\n5000 2519\\n5000 254\\n5000 5000\\n5000 7588\\n-1 0\\n5075 1589\\n5648 2494\\n5000 2100\\n29170\\n100000 000000\\n100010 110000\\n100000 100000\\n100000 100000\\n101100 100000\\n100000 111000\\n100000 100000\\n101000 100000\\n100000 100000\\n100000 100000\\n100000 000000\\n100000 131331\\n0\", \"10000\\n1225 3150\\n5000 6694\\n0 0\\n5000 1050\\n5000 2519\\n5000 254\\n5000 5000\\n5000 7588\\n-1 0\\n5075 3046\\n9143 2494\\n5000 2100\\n29170\\n100000 000000\\n100010 110000\\n100000 100000\\n100000 100000\\n101100 100000\\n100000 111000\\n101000 100000\\n101000 100000\\n100000 100000\\n100000 100000\\n100000 000000\\n100000 131331\\n0\", \"10000\\n1225 3150\\n5000 6694\\n0 0\\n5000 1050\\n5000 2519\\n5000 254\\n5000 5000\\n5000 7588\\n-1 0\\n5075 1589\\n9143 2494\\n5000 2100\\n43893\\n100000 000000\\n100010 110000\\n100100 100000\\n100000 100000\\n101100 100000\\n100000 111000\\n101000 100000\\n101000 100000\\n100000 100000\\n100000 100000\\n100000 000000\\n100000 131331\\n0\", \"10000\\n1225 3150\\n5000 6694\\n0 0\\n5000 1050\\n5000 2519\\n5000 254\\n5000 5000\\n5000 7588\\n-1 0\\n5075 1589\\n9143 4136\\n5000 2100\\n43893\\n100000 001000\\n100010 110000\\n100000 100000\\n100000 100000\\n101100 100000\\n100000 111000\\n101000 100000\\n101100 100000\\n100000 100000\\n100000 100000\\n100000 000000\\n100000 131331\\n0\", \"10000\\n5000 3150\\n5000 5000\\n0 0\\n5000 1050\\n5000 3980\\n5000 210\\n6485 5000\\n5000 6519\\n0 0\\n5000 2100\\n5000 2100\\n5000 2100\\n29170\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 70831\\n0\", \"10000\\n5000 3150\\n5000 5000\\n0 0\\n5000 906\\n5000 3980\\n5000 210\\n5000 5000\\n5000 5000\\n0 0\\n5000 2100\\n5000 2100\\n5000 2100\\n29170\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 101000\\n100000 100000\\n100000 101000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 70831\\n0\", \"10000\\n5000 3150\\n5000 5000\\n0 0\\n5000 1050\\n5000 3980\\n5000 210\\n5000 5000\\n5000 5000\\n0 0\\n5000 2100\\n5000 4903\\n5000 2100\\n29170\\n100000 100000\\n100000 100000\\n100010 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 101000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 70831\\n0\", \"10000\\n5000 3150\\n5000 5000\\n0 0\\n5000 1050\\n5000 3980\\n5000 210\\n5000 5000\\n5000 5000\\n0 0\\n5000 2100\\n4860 2494\\n5000 2100\\n29170\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 101000\\n100000 100000\\n100000 101000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 70831\\n0\", \"10000\\n5000 3150\\n5000 5000\\n0 0\\n5000 1050\\n5000 3980\\n5000 210\\n5000 5000\\n5000 5000\\n0 0\\n5000 2100\\n5000 2494\\n5000 2100\\n29170\\n100000 100000\\n000000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 101000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 79962\\n0\", \"10000\\n5000 3150\\n5000 5000\\n0 0\\n5000 1050\\n5000 3980\\n5000 210\\n5000 5000\\n5000 5000\\n0 0\\n5000 2100\\n5000 2100\\n5000 2100\\n29170\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 100000\\n100000 70831\\n0\"], \"outputs\": [\"6\\nNA\\n\", \"10\\nNA\\n\", \"10\\n11\\n\", \"11\\n11\\n\", \"11\\n1\\n\", \"10\\n1\\n\", \"8\\n11\\n\", \"12\\n11\\n\", \"6\\n1\\n\", \"12\\n1\\n\", \"6\\n8\\n\", \"6\\n4\\n\", \"7\\n11\\n\", \"12\\n7\\n\", \"6\\n12\\n\", \"11\\nNA\\n\", \"6\\n11\\n\", \"NA\\n11\\n\", \"5\\nNA\\n\", \"10\\n2\\n\", \"10\\n4\\n\", \"5\\n4\\n\", \"11\\n7\\n\", \"NA\\n1\\n\", \"NA\\n9\\n\", \"NA\\n7\\n\", \"11\\n3\\n\", \"6\\n2\\n\", \"12\\n3\\n\", \"5\\n11\\n\", \"NA\\n3\\n\", \"5\\n1\\n\", \"7\\nNA\\n\", \"11\\n4\\n\", \"5\\n12\\n\", \"NA\\nNA\\n\", \"10\\n3\\n\", \"4\\nNA\\n\", \"NA\\n4\\n\", \"2\\nNA\\n\", \"7\\n1\\n\", \"6\\n5\\n\", \"12\\nNA\\n\", \"4\\n4\\n\", \"12\\n9\\n\", \"8\\n12\\n\", \"5\\n2\\n\", \"6\\nNA\\n\", \"6\\nNA\\n\", \"6\\nNA\\n\", \"10\\nNA\\n\", \"11\\n11\\n\", \"11\\n11\\n\", \"11\\n11\\n\", \"11\\n1\\n\", \"11\\n1\\n\", \"10\\n1\\n\", \"10\\n1\\n\", \"10\\n1\\n\", \"10\\n1\\n\", \"10\\n1\\n\", \"10\\n1\\n\", \"10\\n1\\n\", \"10\\n1\\n\", \"11\\n1\\n\", \"11\\n1\\n\", \"11\\n1\\n\", \"11\\n1\\n\", \"11\\n1\\n\", \"6\\nNA\\n\", \"6\\nNA\\n\", \"6\\nNA\\n\", \"6\\nNA\\n\", \"6\\nNA\\n\", \"10\\nNA\\n\", \"10\\nNA\\n\", \"11\\n11\\n\", \"11\\n11\\n\", \"11\\n11\\n\", \"11\\n1\\n\", \"11\\n1\\n\", \"11\\n1\\n\", \"11\\n1\\n\", \"10\\n1\\n\", \"10\\n1\\n\", \"10\\n1\\n\", \"10\\n1\\n\", \"10\\n1\\n\", \"11\\n1\\n\", \"11\\n1\\n\", \"10\\n1\\n\", \"11\\n1\\n\", \"11\\n1\\n\", \"11\\n1\\n\", \"11\\n1\\n\", \"6\\nNA\\n\", \"6\\nNA\\n\", \"6\\nNA\\n\", \"6\\nNA\\n\", \"6\\nNA\\n\", \"6\\nNA\"]}", "source": "primeintellect"}
You want to go on a trip with a friend. However, friends who have a habit of spending money cannot easily save travel expenses. I don't know when my friends will go on a trip if they continue their current lives. So, if you want to travel early, you decide to create a program to help your friends save in a planned manner. If you have a friend's pocket money of M yen and the money you spend in that month is N yen, you will save (M --N) yen in that month. Create a program that inputs the monthly income and expenditure information M and N and outputs the number of months it takes for the savings amount to reach the travel cost L. However, if your savings do not reach your travel expenses after 12 months, print NA. Input A sequence of multiple datasets is given as input. The end of the input is indicated by a single line of zeros. Each dataset is given in the following format: L M1 N1 M2 N2 :: M12 N12 The first line gives the travel cost L (1 ≤ L ≤ 1000000, integer). The next 12 lines are given the balance information for the i month, Mi, Ni (0 ≤ Mi, Ni ≤ 100000, Ni ≤ Mi, integer). The number of datasets does not exceed 1000. Output For each input dataset, print the number of months it takes for your savings to reach your travel costs on a single line. Example Input 10000 5000 3150 5000 5000 0 0 5000 1050 5000 3980 5000 210 5000 5000 5000 5000 0 0 5000 2100 5000 2100 5000 2100 29170 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 70831 0 Output 6 NA Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [\"3\\n3\\n1 10 100\\n1\\n1\\n2\\n2 4\\n\", \"1\\n100\\n74 14 24 45 22 9 49 78 79 20 60 1 31 91 32 39 90 5 42 57 30 58 64 68 12 11 86 8 3 38 76 17 98 26 85 92 56 65 89 66 36 87 23 67 13 48 15 47 81 73 63 50 34 93 82 44 77 69 96 100 41 19 35 16 88 27 99 40 62 95 70 18 46 21 53 59 37 6 61 71 2 4 52 28 97 25 29 51 7 33 80 83 72 10 75 94 43 84 54 55\\n\", \"1\\n100\\n74 14 24 45 22 9 49 78 79 20 60 1 31 91 32 39 90 5 42 57 30 58 64 68 12 11 86 8 3 38 76 17 98 26 85 92 56 65 89 66 36 87 23 67 13 48 15 47 81 73 63 50 34 93 82 44 77 69 96 100 41 19 35 16 88 27 99 40 62 95 70 18 46 21 53 59 37 6 61 71 2 4 52 28 97 25 29 51 7 33 80 83 72 10 75 94 43 84 54 55\\n\", \"3\\n3\\n1 10 100\\n1\\n1\\n2\\n3 4\\n\", \"1\\n100\\n74 14 24 45 22 9 49 78 79 20 60 1 31 91 32 39 90 5 42 57 30 58 64 68 12 11 86 8 3 38 76 17 98 26 85 92 56 65 89 66 36 87 23 67 13 48 15 47 81 73 117 50 34 93 82 44 77 69 96 100 41 19 35 16 88 27 99 40 62 95 70 18 46 21 53 59 37 6 61 71 2 4 52 28 97 25 29 51 7 33 80 83 72 10 75 94 43 84 54 55\\n\", \"3\\n3\\n1 8 100\\n1\\n1\\n2\\n2 4\\n\", \"3\\n3\\n2 1 100\\n1\\n1\\n2\\n3 4\\n\", \"3\\n3\\n1 17 100\\n1\\n1\\n2\\n3 4\\n\", \"3\\n3\\n2 17 100\\n1\\n1\\n2\\n3 4\\n\", \"3\\n3\\n1 17 100\\n1\\n1\\n2\\n3 8\\n\", \"3\\n3\\n1 15 100\\n1\\n1\\n2\\n3 8\\n\", \"3\\n3\\n1 17 100\\n1\\n1\\n2\\n3 7\\n\", \"3\\n3\\n2 17 101\\n1\\n1\\n2\\n3 4\\n\", \"3\\n3\\n2 15 100\\n1\\n1\\n2\\n3 8\\n\", \"3\\n3\\n1 34 100\\n1\\n1\\n2\\n3 7\\n\", \"3\\n3\\n1 8 100\\n1\\n1\\n2\\n2 3\\n\", \"3\\n3\\n2 8 100\\n1\\n1\\n2\\n3 4\\n\", \"3\\n3\\n1 12 100\\n1\\n1\\n2\\n3 8\\n\", \"3\\n3\\n1 15 100\\n1\\n1\\n2\\n3 12\\n\", \"3\\n3\\n1 17 100\\n1\\n1\\n2\\n5 7\\n\", \"3\\n3\\n1 34 100\\n1\\n1\\n2\\n3 10\\n\", \"3\\n3\\n1 15 101\\n1\\n1\\n2\\n3 12\\n\", \"3\\n3\\n1 21 101\\n1\\n1\\n2\\n3 12\\n\", \"3\\n3\\n1 10 100\\n1\\n1\\n2\\n1 6\\n\", \"1\\n100\\n74 14 24 45 22 9 49 78 79 20 60 1 31 91 32 39 90 5 42 57 30 58 64 68 12 11 86 8 3 38 76 17 98 26 85 92 56 65 89 66 36 87 23 67 13 48 15 47 81 73 117 50 34 93 82 44 77 69 96 100 41 19 35 16 88 27 99 40 62 95 70 18 46 21 53 59 37 6 61 71 2 4 52 28 97 25 29 51 7 33 80 83 72 10 75 94 43 109 54 55\\n\", \"3\\n3\\n1 36 100\\n1\\n1\\n2\\n3 7\\n\", \"3\\n3\\n1 15 100\\n1\\n1\\n2\\n3 17\\n\", \"3\\n3\\n1 34 100\\n1\\n1\\n2\\n3 9\\n\", \"3\\n3\\n1 38 100\\n1\\n1\\n2\\n3 7\\n\", \"3\\n3\\n1 15 110\\n1\\n1\\n2\\n3 17\\n\", \"3\\n3\\n1 34 100\\n1\\n1\\n2\\n3 2\\n\", \"3\\n3\\n1 9 100\\n1\\n1\\n2\\n2 4\\n\", \"3\\n3\\n2 17 100\\n1\\n1\\n2\\n3 1\\n\", \"3\\n3\\n2 15 100\\n1\\n1\\n2\\n3 11\\n\", \"3\\n3\\n1 34 100\\n1\\n1\\n2\\n3 5\\n\", \"3\\n3\\n2 10 100\\n1\\n1\\n2\\n3 4\\n\", \"3\\n3\\n1 42 100\\n1\\n1\\n2\\n3 10\\n\", \"3\\n3\\n1 21 101\\n1\\n1\\n2\\n3 20\\n\", \"3\\n3\\n1 11 100\\n1\\n1\\n2\\n1 6\\n\", \"3\\n3\\n1 9 100\\n1\\n1\\n2\\n3 9\\n\", \"3\\n3\\n1 15 110\\n1\\n1\\n2\\n1 17\\n\", \"3\\n3\\n1 9 110\\n1\\n1\\n2\\n2 4\\n\", \"3\\n3\\n4 17 100\\n1\\n1\\n2\\n3 1\\n\", \"3\\n3\\n2 23 100\\n1\\n1\\n2\\n3 11\\n\", \"3\\n3\\n1 48 100\\n1\\n1\\n2\\n3 5\\n\", \"3\\n3\\n1 15 111\\n1\\n1\\n2\\n1 17\\n\", \"3\\n3\\n1 10 110\\n1\\n1\\n2\\n3 4\\n\", \"3\\n3\\n2 17 100\\n1\\n1\\n2\\n3 2\\n\", \"3\\n3\\n1 17 110\\n1\\n1\\n2\\n3 8\\n\", \"3\\n3\\n2 17 101\\n1\\n1\\n2\\n3 1\\n\", \"3\\n3\\n2 15 110\\n1\\n1\\n2\\n3 8\\n\", \"3\\n3\\n1 2 100\\n1\\n1\\n2\\n2 3\\n\", \"3\\n3\\n1 30 100\\n1\\n1\\n2\\n3 12\\n\", \"3\\n3\\n1 15 101\\n1\\n1\\n2\\n3 1\\n\", \"3\\n3\\n1 21 100\\n1\\n1\\n2\\n3 12\\n\", \"3\\n3\\n1 10 100\\n1\\n1\\n2\\n2 4\\n\"], \"outputs\": [\"YES\\n1 2 3 \\nYES\\n1 \\nYES\\n1 2 \\n\", \"YES\\n1 101 201 301 401 501 601 701 801 901 1001 1101 1201 1301 1401 1501 1601 1701 1801 1901 2001 2101 2201 2301 2401 2501 2601 2701 2801 2901 3001 3101 3201 3301 3401 3501 3601 3701 3801 3901 4001 4101 4201 4301 4401 4501 4601 4701 4801 4901 5001 5101 5201 5301 5401 5501 5601 5701 5801 5901 6001 6101 6201 6301 6401 6501 6601 6701 6801 6901 7001 7101 7201 7301 7401 7501 7601 7701 7801 7901 8001 8101 8201 8301 8401 8501 8601 8701 8801 8901 9001 9101 9201 9301 9401 9501 9601 9701 9801 9901 \\n\", \"YES\\n1 101 201 301 401 501 601 701 801 901 1001 1101 1201 1301 1401 1501 1601 1701 1801 1901 2001 2101 2201 2301 2401 2501 2601 2701 2801 2901 3001 3101 3201 3301 3401 3501 3601 3701 3801 3901 4001 4101 4201 4301 4401 4501 4601 4701 4801 4901 5001 5101 5201 5301 5401 5501 5601 5701 5801 5901 6001 6101 6201 6301 6401 6501 6601 6701 6801 6901 7001 7101 7201 7301 7401 7501 7601 7701 7801 7901 8001 8101 8201 8301 8401 8501 8601 8701 8801 8901 9001 9101 9201 9301 9401 9501 9601 9701 9801 9901\\n\", \"YES\\n1 2 3\\nYES\\n1\\nYES\\n1 3\\n\", \"YES\\n1 118 235 352 469 586 703 820 937 1054 1171 1288 1405 1522 1639 1756 1873 1990 2107 2224 2341 2458 2575 2692 2809 2926 3043 3160 3277 3394 3511 3628 3745 3862 3979 4096 4213 4330 4447 4564 4681 4798 4915 5032 5149 5266 5383 5500 5617 5734 5851 5968 6085 6202 6319 6436 6553 6670 6787 6904 7021 7138 7255 7372 7489 7606 7723 7840 7957 8074 8191 8308 8425 8542 8659 8776 8893 9010 9127 9244 9361 9478 9595 9712 9829 9946 10063 10180 10297 10414 10531 10648 10765 10882 10999 11116 11233 11350 11467 11584\\n\", \"YES\\n1 2 3\\nYES\\n1\\nYES\\n1 2\\n\", \"YES\\n1 3 5\\nYES\\n1\\nYES\\n1 3\\n\", \"YES\\n1 2 3\\nYES\\n1\\nYES\\n1 3\\n\", \"YES\\n1 2 3\\nYES\\n1\\nYES\\n1 3\\n\", \"YES\\n1 2 3\\nYES\\n1\\nYES\\n1 2\\n\", \"YES\\n1 2 3\\nYES\\n1\\nYES\\n1 2\\n\", \"YES\\n1 2 3\\nYES\\n1\\nYES\\n1 2\\n\", \"YES\\n1 2 3\\nYES\\n1\\nYES\\n1 3\\n\", \"YES\\n1 2 3\\nYES\\n1\\nYES\\n1 2\\n\", \"YES\\n1 2 3\\nYES\\n1\\nYES\\n1 2\\n\", \"YES\\n1 2 3\\nYES\\n1\\nYES\\n1 3\\n\", \"YES\\n1 2 3\\nYES\\n1\\nYES\\n1 3\\n\", \"YES\\n1 2 3\\nYES\\n1\\nYES\\n1 2\\n\", \"YES\\n1 2 3\\nYES\\n1\\nYES\\n1 2\\n\", \"YES\\n1 2 3\\nYES\\n1\\nYES\\n1 2\\n\", \"YES\\n1 2 3\\nYES\\n1\\nYES\\n1 2\\n\", \"YES\\n1 2 3\\nYES\\n1\\nYES\\n1 2\\n\", \"YES\\n1 2 3\\nYES\\n1\\nYES\\n1 2\\n\", \"YES\\n1 2 3\\nYES\\n1\\nYES\\n1 2\\n\", \"YES\\n1 118 235 352 469 586 703 820 937 1054 1171 1288 1405 1522 1639 1756 1873 1990 2107 2224 2341 2458 2575 2692 2809 2926 3043 3160 3277 3394 3511 3628 3745 3862 3979 4096 4213 4330 4447 4564 4681 4798 4915 5032 5149 5266 5383 5500 5617 5734 5851 5968 6085 6202 6319 6436 6553 6670 6787 6904 7021 7138 7255 7372 7489 7606 7723 7840 7957 8074 8191 8308 8425 8542 8659 8776 8893 9010 9127 9244 9361 9478 9595 9712 9829 9946 10063 10180 10297 10414 10531 10648 10765 10882 10999 11116 11233 11350 11467 11584\\n\", \"YES\\n1 2 3\\nYES\\n1\\nYES\\n1 2\\n\", \"YES\\n1 2 3\\nYES\\n1\\nYES\\n1 2\\n\", \"YES\\n1 2 3\\nYES\\n1\\nYES\\n1 2\\n\", \"YES\\n1 2 3\\nYES\\n1\\nYES\\n1 2\\n\", \"YES\\n1 2 3\\nYES\\n1\\nYES\\n1 2\\n\", \"YES\\n1 2 3\\nYES\\n1\\nYES\\n1 3\\n\", \"YES\\n1 2 3\\nYES\\n1\\nYES\\n1 2\\n\", \"YES\\n1 2 3\\nYES\\n1\\nYES\\n1 2\\n\", \"YES\\n1 2 3\\nYES\\n1\\nYES\\n1 2\\n\", \"YES\\n1 2 3\\nYES\\n1\\nYES\\n1 2\\n\", \"YES\\n1 2 3\\nYES\\n1\\nYES\\n1 3\\n\", \"YES\\n1 2 3\\nYES\\n1\\nYES\\n1 2\\n\", \"YES\\n1 2 3\\nYES\\n1\\nYES\\n1 2\\n\", \"YES\\n1 2 3\\nYES\\n1\\nYES\\n1 2\\n\", \"YES\\n1 2 3\\nYES\\n1\\nYES\\n1 2\\n\", \"YES\\n1 2 3\\nYES\\n1\\nYES\\n1 2\\n\", \"YES\\n1 2 3\\nYES\\n1\\nYES\\n1 2\\n\", \"YES\\n1 2 3\\nYES\\n1\\nYES\\n1 2\\n\", \"YES\\n1 2 3\\nYES\\n1\\nYES\\n1 2\\n\", \"YES\\n1 2 3\\nYES\\n1\\nYES\\n1 2\\n\", \"YES\\n1 2 3\\nYES\\n1\\nYES\\n1 2\\n\", \"YES\\n1 2 3\\nYES\\n1\\nYES\\n1 3\\n\", \"YES\\n1 2 3\\nYES\\n1\\nYES\\n1 3\\n\", \"YES\\n1 2 3\\nYES\\n1\\nYES\\n1 2\\n\", \"YES\\n1 2 3\\nYES\\n1\\nYES\\n1 2\\n\", \"YES\\n1 2 3\\nYES\\n1\\nYES\\n1 2\\n\", \"YES\\n1 3 5\\nYES\\n1\\nYES\\n1 3\\n\", \"YES\\n1 2 3\\nYES\\n1\\nYES\\n1 2\\n\", \"YES\\n1 2 3\\nYES\\n1\\nYES\\n1 2\\n\", \"YES\\n1 2 3\\nYES\\n1\\nYES\\n1 2\\n\", \"YES\\n1 2 3\\nYES\\n1\\nYES\\n1 2\\n\"]}", "source": "primeintellect"}
Masha and Grisha like studying sets of positive integers. One day Grisha has written a set A containing n different integers a_{i} on a blackboard. Now he asks Masha to create a set B containing n different integers b_{j} such that all n^2 integers that can be obtained by summing up a_{i} and b_{j} for all possible pairs of i and j are different. Both Masha and Grisha don't like big numbers, so all numbers in A are from 1 to 10^6, and all numbers in B must also be in the same range. Help Masha to create the set B that satisfies Grisha's requirement. -----Input----- Input data contains multiple test cases. The first line contains an integer t — the number of test cases (1 ≤ t ≤ 100). Each test case is described in the following way: the first line of the description contains one integer n — the number of elements in A (1 ≤ n ≤ 100). The second line contains n integers a_{i} — the elements of A (1 ≤ a_{i} ≤ 10^6). -----Output----- For each test first print the answer: NO, if Masha's task is impossible to solve, there is no way to create the required set B. YES, if there is the way to create the required set. In this case the second line must contain n different positive integers b_{j} — elements of B (1 ≤ b_{j} ≤ 10^6). If there are several possible sets, output any of them. -----Example----- Input 3 3 1 10 100 1 1 2 2 4 Output YES 1 2 3 YES 1 YES 1 2 Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [\"4 5\\n1 3 5\\n3 4 6\\n4 2 7\\n2 1 18\\n2 3 17\", \"4 5\\n1 3 5\\n3 4 6\\n4 2 7\\n2 1 6\\n2 3 17\", \"4 5\\n1 3 5\\n3 2 6\\n4 2 7\\n2 1 18\\n2 3 12\", \"4 5\\n1 3 5\\n3 4 6\\n4 2 13\\n2 1 6\\n2 3 17\", \"4 1\\n1 3 5\\n3 2 6\\n4 2 7\\n2 1 18\\n2 3 12\", \"8 5\\n1 3 5\\n3 4 6\\n4 2 7\\n2 1 18\\n2 3 12\", \"4 5\\n1 1 5\\n3 4 6\\n4 2 13\\n2 1 6\\n2 3 17\", \"7 1\\n1 2 5\\n4 4 3\\n4 2 7\\n0 1 25\\n2 6 12\", \"4 5\\n1 3 5\\n3 4 6\\n2 2 7\\n2 1 1\\n2 3 17\", \"4 5\\n1 2 5\\n3 4 6\\n2 2 7\\n2 1 1\\n2 3 26\", \"4 5\\n1 2 5\\n3 4 6\\n2 2 7\\n1 1 2\\n2 3 26\", \"4 5\\n1 4 5\\n3 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 13\", \"5 1\\n1 3 5\\n3 7 3\\n4 4 14\\n0 1 17\\n2 6 12\", \"5 1\\n1 3 1\\n3 7 4\\n4 4 14\\n0 1 10\\n2 6 12\", \"5 1\\n1 3 5\\n3 7 6\\n8 4 14\\n0 1 10\\n2 6 12\", \"5 1\\n1 3 5\\n3 7 4\\n8 4 14\\n0 2 10\\n2 2 12\", \"5 1\\n1 3 5\\n4 7 4\\n8 4 14\\n0 2 10\\n2 1 12\", \"5 1\\n1 3 10\\n3 13 4\\n8 4 14\\n0 2 10\\n2 1 12\", \"5 1\\n1 3 10\\n0 7 4\\n8 4 14\\n1 2 10\\n2 1 12\", \"4 5\\n1 3 5\\n3 4 9\\n4 2 7\\n2 1 0\\n2 3 17\", \"4 5\\n1 3 7\\n3 2 6\\n4 3 7\\n2 1 18\\n2 3 12\", \"4 1\\n1 3 5\\n0 2 6\\n4 2 11\\n2 1 18\\n2 3 12\", \"4 1\\n1 3 5\\n3 2 4\\n4 2 7\\n2 0 18\\n2 6 12\", \"4 1\\n1 3 5\\n3 2 6\\n4 1 7\\n0 1 18\\n2 6 16\", \"4 1\\n1 3 5\\n4 2 6\\n5 2 7\\n0 1 18\\n2 6 21\", \"4 1\\n1 3 5\\n4 4 6\\n4 2 7\\n1 1 18\\n3 6 12\", \"4 1\\n1 3 5\\n4 8 0\\n4 2 7\\n0 1 25\\n2 6 12\", \"7 1\\n1 2 5\\n4 4 3\\n4 2 7\\n0 1 49\\n2 6 12\", \"7 1\\n1 3 5\\n4 4 3\\n4 2 14\\n0 1 27\\n2 6 33\", \"7 1\\n2 3 5\\n3 4 3\\n4 2 14\\n0 1 27\\n2 12 12\", \"7 1\\n1 3 5\\n3 7 3\\n4 2 14\\n0 1 0\\n1 6 12\", \"7 1\\n1 3 5\\n3 7 3\\n8 3 14\\n0 1 27\\n2 10 12\", \"7 1\\n1 3 1\\n3 7 3\\n4 3 14\\n0 1 10\\n2 6 13\", \"5 1\\n1 3 5\\n3 7 3\\n4 6 14\\n0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n8 4 14\\n0 1 10\\n4 12 12\", \"5 1\\n1 3 5\\n4 7 4\\n8 4 14\\n0 4 10\\n2 1 12\", \"4 5\\n1 3 5\\n3 4 6\\n4 2 7\\n2 1 18\\n2 3 12\"], \"outputs\": [\"SAD\\nSAD\\nSAD\\nSOSO\\nSOSO\\n\", \"SAD\\nSAD\\nSAD\\nHAPPY\\nSOSO\\n\", \"SAD\\nSAD\\nSOSO\\nSOSO\\nSOSO\\n\", \"SAD\\nSAD\\nSAD\\nHAPPY\\nHAPPY\\n\", \"SOSO\\n\", \"SAD\\nSAD\\nSAD\\nSOSO\\nHAPPY\\n\", \"SOSO\\nSOSO\\nSOSO\\nHAPPY\\nSOSO\\n\", \"SAD\\n\", \"SOSO\\nSOSO\\nSOSO\\nHAPPY\\nHAPPY\\n\", \"SAD\\nSOSO\\nSOSO\\nHAPPY\\nSOSO\\n\", \"SAD\\nSOSO\\nSOSO\\nSOSO\\nSOSO\\n\", \"SOSO\\nHAPPY\\nSOSO\\nSOSO\\nSOSO\\n\", \"SAD\\nSAD\\n\", \"SOSO\\nSOSO\\n\", \"SAD\\nSOSO\\n\", \"SOSO\\nSAD\\nSOSO\\nSOSO\\nSOSO\\n\", \"SOSO\\nSOSO\\nHAPPY\\nHAPPY\\nSOSO\\n\", \"SAD\\nSAD\\nSAD\\nSOSO\\nSOSO\\n\", \"SOSO\\n\", \"SOSO\\n\", \"SOSO\\n\", \"SOSO\\n\", \"SOSO\\n\", \"SOSO\\n\", \"SOSO\\n\", \"SOSO\\n\", \"SOSO\\n\", \"SOSO\\n\", \"SOSO\\n\", \"SOSO\\n\", \"SOSO\\n\", \"SOSO\\n\", \"SOSO\\n\", \"SOSO\\n\", \"SOSO\\n\", \"SOSO\\n\", \"SOSO\\n\", \"SOSO\\n\", \"SOSO\\n\", \"SOSO\\n\", \"SAD\\nSAD\\nSAD\\nHAPPY\\nSOSO\\n\", \"SAD\\nSAD\\nSAD\\nHAPPY\\nSOSO\\n\", \"SAD\\nSAD\\nSOSO\\nSOSO\\nSOSO\\n\", \"SOSO\\n\", \"SOSO\\n\", \"SOSO\\n\", \"SOSO\\n\", \"SOSO\\n\", \"SOSO\\n\", \"SOSO\\n\", \"SOSO\\n\", \"SOSO\\n\", \"SOSO\\n\", \"SOSO\\n\", \"SOSO\\n\", \"SOSO\\n\", \"SOSO\\n\", \"SOSO\\n\", \"SOSO\\n\", \"SOSO\\n\", \"SOSO\\n\", \"SOSO\\n\", \"SAD\\nSAD\\nSAD\\nHAPPY\\nSOSO\\n\", \"SAD\\nSAD\\nSOSO\\nSOSO\\nSOSO\\n\", \"SOSO\\n\", \"SOSO\\n\", \"SOSO\\n\", \"SOSO\\n\", \"SOSO\\n\", \"SOSO\\n\", \"SAD\\n\", \"SOSO\\n\", \"SOSO\\n\", \"SOSO\\n\", \"SOSO\\n\", \"SOSO\\n\", \"SOSO\\n\", \"SOSO\\n\", \"SOSO\\n\", \"SOSO\\n\", \"SOSO\\n\", \"SOSO\\n\", \"SOSO\\nSOSO\\nSOSO\\nHAPPY\\nSOSO\\n\", \"SOSO\\nSOSO\\nSOSO\\nHAPPY\\nHAPPY\\n\", \"SAD\\nSAD\\nSOSO\\nSOSO\\nSOSO\\n\", \"SOSO\\n\", \"SOSO\\n\", \"SOSO\\n\", \"SOSO\\n\", \"SOSO\\n\", \"SOSO\\n\", \"SAD\\n\", \"SOSO\\n\", \"SOSO\\n\", \"SOSO\\n\", \"SOSO\\n\", \"SOSO\\n\", \"SOSO\\n\", \"SOSO\\n\", \"SOSO\\n\", \"SAD\\nSAD\\nSAD\\nSOSO\\nHAPPY\"]}", "source": "primeintellect"}
Problem F Pizza Delivery Alyssa is a college student, living in New Tsukuba City. All the streets in the city are one-way. A new social experiment starting tomorrow is on alternative traffic regulation reversing the one-way directions of street sections. Reversals will be on one single street section between two adjacent intersections for each day; the directions of all the other sections will not change, and the reversal will be canceled on the next day. Alyssa orders a piece of pizza everyday from the same pizzeria. The pizza is delivered along the shortest route from the intersection with the pizzeria to the intersection with Alyssa's house. Altering the traffic regulation may change the shortest route. Please tell Alyssa how the social experiment will affect the pizza delivery route. Input The input consists of a single test case in the following format. $n$ $m$ $a_1$ $b_1$ $c_1$ ... $a_m$ $b_m$ $c_m$ The first line contains two integers, $n$, the number of intersections, and $m$, the number of street sections in New Tsukuba City ($2 \leq n \leq 100 000, 1 \leq m \leq 100 000$). The intersections are numbered $1$ through $n$ and the street sections are numbered $1$ through $m$. The following $m$ lines contain the information about the street sections, each with three integers $a_i$, $b_i$, and $c_i$ ($1 \leq a_i n, 1 \leq b_i \leq n, a_i \ne b_i, 1 \leq c_i \leq 100 000$). They mean that the street section numbered $i$ connects two intersections with the one-way direction from $a_i$ to $b_i$, which will be reversed on the $i$-th day. The street section has the length of $c_i$. Note that there may be more than one street section connecting the same pair of intersections. The pizzeria is on the intersection 1 and Alyssa's house is on the intersection 2. It is guaranteed that at least one route exists from the pizzeria to Alyssa's before the social experiment starts. Output The output should contain $m$ lines. The $i$-th line should be * HAPPY if the shortest route on the $i$-th day will become shorter, * SOSO if the length of the shortest route on the $i$-th day will not change, and * SAD if the shortest route on the $i$-th day will be longer or if there will be no route from the pizzeria to Alyssa's house. Alyssa doesn't mind whether the delivery bike can go back to the pizzeria or not. Sample Input 1 4 5 1 3 5 3 4 6 4 2 7 2 1 18 2 3 12 Sample Output 1 SAD SAD SAD SOSO HAPPY Sample Input 2 7 5 1 3 2 1 6 3 4 2 4 6 2 5 7 5 6 Sample Output 2 SOSO SAD SOSO SAD SOSO Sample Input 3 10 14 1 7 9 1 8 3 2 8 4 2 6 11 3 7 8 3 4 4 3 2 1 3 2 7 4 8 4 5 6 11 5 8 12 6 10 6 7 10 8 8 3 6 Sample Output 3 SOSO SAD HAPPY SOSO SOSO SOSO SAD SOSO SOSO SOSO SOSO SOSO SOSO SAD Example Input 4 5 1 3 5 3 4 6 4 2 7 2 1 18 2 3 12 Output SAD SAD SAD SOSO HAPPY Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [\"9\\n487264 453898 452366 383095 172725 168148 164570 141228 1\\n\", \"28\\n434419 433070 431479 424448 423449 392416 368998 367310 329030 316399 311541 302510 283863 262469 257928 248272 242310 217371 183364 172064 164154 131734 131169 117466 23544 19990 11006 1\\n\", \"58\\n3000000 2511334 2511333 2102003 1901011 1700000 1200000 800000 750000 508111 202000 101000 80000 35000 20000 9000 5000 2000 899 504 405 404 403 402 401 305 304 303 302 301 205 204 203 202 201 105 104 103 102 101 56 55 54 53 52 51 50 13 12 10 9 8 7 5 4 3 2 1\\n\", \"7\\n21 15 10 5 3 2 1\\n\", \"3\\n250 100 1\\n\", \"21\\n495512 445997 403739 389462 371069 349426 316341 261014 246618 222432 199502 185241 172680 155152 90507 87176 64608 58781 55482 51081 1\\n\", \"42\\n899 504 405 404 403 402 401 305 304 303 302 301 205 204 203 202 201 105 104 103 102 101 56 55 54 53 52 51 50 13 12 11 10 9 8 7 6 5 4 3 2 1\\n\", \"44\\n800000 80000 899 504 405 404 403 402 401 305 304 303 302 301 205 204 203 202 201 105 104 103 102 101 56 55 54 53 52 51 50 13 12 11 10 9 8 7 6 5 4 3 2 1\\n\", \"39\\n497634 495009 494063 483944 451886 448180 446192 441429 434545 429614 417363 402833 384941 384693 383154 331915 326597 321084 293206 274672 239694 239524 236198 233609 229670 226033 222079 157049 146525 141417 131035 118766 70980 58945 51894 50469 1773 558 1\\n\", \"5\\n10 7 5 2 1\\n\", \"5\\n9 8 5 2 1\\n\", \"7\\n447790 366103 338088 127192 119283 73058 1\\n\", \"2\\n500000 1\\n\", \"9\\n440526 404455 396537 310357 288186 187476 66947 17125 1\\n\", \"2\\n2 1\\n\", \"22\\n484731 436693 432081 387148 385052 369760 340058 311053 274965 263426 257736 253057 204507 198863 173100 153737 136236 133973 117279 49285 10635 1\\n\", \"5\\n18 17 10 2 1\\n\", \"14\\n472313 469103 339876 336194 308551 248071 166133 156622 154291 133164 110132 71138 33236 1\\n\", \"12\\n234 144 89 55 34 21 13 8 5 3 2 1\\n\", \"20\\n483959 458820 443030 396109 340406 334711 283762 278455 253801 253009 210156 208557 206641 169337 150807 121158 41861 41781 30976 1\\n\", \"9\\n359113 291909 263064 208071 185843 149260 94352 58856 1\\n\", \"4\\n25 10 5 1\\n\", \"50\\n500000 96 94 92 90 88 86 84 82 80 78 76 74 72 70 68 66 64 62 60 58 56 54 52 50 48 46 44 42 40 38 36 34 32 30 28 26 24 22 20 18 16 14 12 10 8 6 4 2 1\\n\", \"25\\n486881 460940 449767 431421 407350 404925 399937 398840 387683 386968 290650 286122 275574 264283 257659 254750 132977 88279 82487 48945 46514 45560 30078 19083 1\\n\", \"1\\n1\\n\", \"31\\n495696 494916 482481 477452 476590 455869 439117 434349 430442 422009 419764 414718 406279 400915 400223 392067 374574 360035 358987 342956 307082 298876 267886 249356 190282 186130 86642 76932 50898 41267 1\\n\", \"3\\n110 50 1\\n\", \"3\\n456782 213875 1\\n\", \"11\\n447804 447682 436259 404021 392659 376034 367731 268597 145236 138718 1\\n\", \"2\\n227967 1\\n\", \"50\\n500000 96 94 92 90 88 86 84 82 80 78 76 74 72 70 68 66 64 62 60 58 56 54 52 50 48 46 44 42 40 38 36 34 32 30 28 26 24 22 20 18 16 14 12 10 8 6 4 3 1\\n\", \"2\\n467971 1\\n\", \"21\\n469177 434800 431701 392733 387609 373571 336673 317296 308699 275508 274622 250969 230783 207596 204963 165701 132461 119669 58221 44668 1\\n\", \"28\\n490849 431182 419223 344530 312448 307141 301286 295369 281234 272874 270974 266173 257650 252736 222659 201481 193625 187072 145349 130491 111128 95714 92096 58715 37147 6341 5498 1\\n\", \"25\\n486057 441139 430698 427152 408599 383365 343126 339252 243930 223716 219312 216608 170945 163699 154598 141066 128583 79423 78606 58072 30640 28228 24571 5383 1\\n\", \"2\\n353767 1\\n\", \"47\\n496705 492806 462703 446368 424326 398277 392315 383243 372226 371522 361579 360696 356273 339981 330738 287896 287634 281675 277054 253588 215824 204345 201450 194746 163926 159313 157418 155438 145068 142673 132488 129873 126535 126163 122414 119202 96854 91808 88824 78898 77961 66091 51953 50293 41578 23871 1\\n\", \"91\\n4000000 3000000 2900000 2511334 2511333 2102003 1901011 1700000 1200000 999999 800000 750000 600000 508111 202000 101000 35000 20000 9000 5000 2000 899 630 629 628 627 626 625 624 623 622 621 620 619 618 617 616 615 614 613 612 611 610 609 608 607 606 605 604 603 602 601 504 405 404 403 402 401 305 304 303 302 301 205 204 203 202 201 105 104 103 102 101 56 55 54 53 52 51 50 13 12 10 9 8 7 5 4 3 2 1\\n\", \"44\\n497740 484010 477990 474388 466289 465183 446018 441372 423091 415352 385791 365228 356372 335550 327462 311065 304033 294885 291767 264525 260472 251770 250269 234813 214163 186129 166948 131304 120039 114941 106418 95802 92888 81526 81226 81172 75533 69794 69540 51954 49533 39272 12299 1\\n\", \"26\\n488655 449635 420758 337786 333696 329417 326150 285413 281835 273319 226900 208862 195375 175739 163162 160822 146976 104568 97418 96208 88790 78402 48286 26152 24564 1\\n\", \"21\\n472112 431946 411829 406527 399130 395891 385543 377038 361918 360308 356334 312243 305948 206826 199258 182494 179322 103717 31666 5333 1\\n\", \"22\\n430292 392392 391275 385209 370127 359090 311623 300514 265716 213205 200436 196664 191059 150927 146478 111868 101347 88871 73268 56725 30639 1\\n\", \"25\\n494273 487040 483980 449842 405763 383373 378433 347085 338845 284162 276741 270769 243629 213677 132684 129380 124239 100462 92951 87003 75776 56281 33220 13169 1\\n\", \"43\\n494369 493360 454400 448348 441640 436359 402863 401152 386813 370360 365576 345832 319343 316740 312530 292656 268899 264495 243804 239368 236670 229069 216624 211903 209871 199189 185267 180886 180668 159763 157998 153674 153270 142608 132757 132541 119705 68207 59506 58596 56040 14699 1\\n\", \"43\\n499757 498394 494467 494430 490217 487135 467623 461915 425822 400145 392402 368528 361824 357415 355141 352566 347715 326964 321584 317670 306465 280958 218579 216402 213660 180022 118457 115776 88678 82331 69984 69423 60451 56563 56365 48016 31055 24772 15544 2919 2200 1227 1\\n\", \"3\\n389909 142619 1\\n\", \"43\\n494419 475439 473426 456392 445433 431242 426289 425690 418018 402924 379683 376621 334000 322846 320891 317240 311817 308876 278091 271657 269026 262973 224579 192149 177832 165986 128118 119033 112104 105502 76211 74773 71557 67947 67559 67425 62142 47834 47585 19596 11198 7035 1\\n\", \"50\\n500000 499999 499998 499997 499996 499995 499994 499993 499992 499991 499990 499989 499988 499987 499986 499985 499984 499983 499982 499981 499980 499979 499978 499977 499976 499975 499974 499973 499972 499971 499970 499969 499968 499967 499966 499965 499964 499963 499962 499961 499960 499959 499958 499957 499956 499955 499954 499953 499952 1\\n\", \"30\\n205 204 203 202 201 105 104 103 102 101 56 55 54 53 52 51 50 13 12 11 10 9 8 7 6 5 4 3 2 1\\n\", \"28\\n499767 465863 409631 394241 389304 383062 342044 267362 233500 208747 205255 202242 199753 187685 185714 183202 163533 148220 142514 140009 139233 137046 75954 67079 66246 46908 16602 1\\n\", \"28\\n492480 477288 470289 392974 378641 376009 365748 364172 341864 307796 301010 257710 257594 216542 194868 164331 142397 139139 109890 105906 105464 93772 87446 85023 66294 51969 26330 1\\n\", \"4\\n25 20 10 1\\n\", \"50\\n500000 499999 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1\\n\", \"13\\n313 217 201 127 63 31 15 12 7 5 3 2 1\\n\", \"20\\n489868 466294 428151 412378 394446 317619 316891 307256 199979 190697 181240 161325 143287 115819 111476 89766 71400 63806 32885 1\\n\", \"4\\n5 4 3 1\\n\", \"19\\n262144 131072 65536 32768 16384 8192 4096 2048 1024 512 256 128 64 32 16 8 4 2 1\\n\", \"24\\n498804 485678 468139 437676 385667 362095 356653 355933 320469 292428 277311 272265 249544 210894 207237 199958 197976 109903 75290 52108 38180 37537 20930 1\\n\", \"5\\n454748 375083 231979 228729 1\\n\", \"38\\n499229 495127 492174 485565 485544 447205 436284 425604 391744 391263 389916 386798 385484 363315 348314 330911 324192 314185 307277 297202 296116 263928 260467 253314 243583 211620 189479 182591 156707 152281 137039 120083 114556 109738 86227 33547 4957 1\\n\", \"15\\n471739 409412 379958 365326 363517 219800 219742 152834 143060 109805 86434 39410 8208 4578 1\\n\", \"3\\n429655 401440 1\\n\", \"50\\n500000 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1\\n\", \"27\\n477764 440484 431041 427346 368028 323248 314692 310003 299283 277684 269855 267120 229578 224810 220515 210521 161374 158029 150799 141291 115593 59379 37803 34726 27618 24403 1\\n\", \"32\\n492066 469227 464311 435058 417006 414732 397127 394962 386377 364630 347968 343897 341581 339433 338590 302427 298316 293383 273532 229938 213982 173494 171191 170922 146178 141986 139758 120345 118826 91184 46938 1\\n\", \"50\\n500000 96 94 92 90 88 86 84 80 79 78 76 74 72 70 68 66 64 62 60 58 56 54 52 50 48 46 44 42 40 38 36 34 32 30 28 26 24 22 20 18 16 14 12 10 8 6 4 2 1\\n\", \"19\\n471558 461066 456587 453273 388550 344142 314691 298434 237269 173595 167045 143089 78600 75441 62529 44939 26814 1094 1\\n\", \"8\\n406324 317344 298165 217984 201340 124738 102678 1\\n\", \"37\\n497929 464223 451341 425516 401751 360871 345120 339165 332320 327088 325949 321681 321255 312179 306305 300100 268659 268282 236636 232536 230145 202281 183443 181845 174423 159166 158458 155492 138575 113413 98040 91707 63679 51416 21296 11433 1\\n\", \"49\\n487033 478497 477190 468339 464679 442615 442353 417495 395024 388721 371348 369146 368473 362006 355135 337332 335814 330942 327739 324659 316101 284491 277738 276615 259056 254219 253581 245423 238528 236553 230196 229992 216788 200669 194784 190311 164328 157601 152545 105292 94967 76049 55151 43335 39024 38606 3720 447 1\\n\", \"3\\n3 2 1\\n\", \"3\\n500000 499999 1\\n\", \"8\\n456034 327797 326500 321462 312039 303728 110658 1\\n\", \"30\\n461488 412667 406467 389755 375075 351026 332191 320180 312165 280759 266670 259978 258741 251297 248771 235766 218200 209793 142034 131703 115953 115369 92627 78342 71508 70411 61656 51268 39439 1\\n\", \"43\\n499775 490519 483154 474647 472568 471619 440605 437066 434554 433454 412132 403425 394878 377320 363904 363097 330413 325438 316926 316009 313018 312685 293695 286675 277379 269071 260734 260348 240829 238798 191166 154910 120927 119970 116321 104280 104077 96025 83649 67903 52781 14197 1\\n\", \"3\\n25 15 1\\n\", \"4\\n73 70 33 1\\n\", \"8\\n50000 25020 25010 40 30 20 10 1\\n\", \"13\\n496784 464754 425906 370916 351740 336779 292952 238796 178464 166413 75629 11855 1\\n\", \"21\\n477846 443845 425918 402914 362857 346087 339332 322165 312882 299423 275613 221233 173300 159327 145354 141628 133996 93551 85703 809 1\\n\", \"9\\n487264 453898 452366 383095 172725 298389 164570 141228 1\\n\", \"28\\n434419 433070 431479 424448 423449 392416 368998 367310 329030 316399 311541 302510 283863 262469 257928 248272 242310 72318 183364 172064 164154 131734 131169 117466 23544 19990 11006 1\\n\", \"3\\n491 100 1\\n\", \"21\\n495512 445997 403739 389462 520523 349426 316341 261014 246618 222432 199502 185241 172680 155152 90507 87176 64608 58781 55482 51081 1\\n\", \"42\\n899 504 405 404 403 402 401 305 304 371 302 301 205 204 203 202 201 105 104 103 102 101 56 55 54 53 52 51 50 13 12 11 10 9 8 7 6 5 4 3 2 1\\n\", \"39\\n497634 495009 494063 483944 451886 448180 446192 441429 434545 429614 417363 402833 384941 384693 383154 331915 326597 321084 293206 274672 239694 239524 236198 233609 229670 226033 222079 157049 146525 206180 131035 118766 70980 58945 51894 50469 1773 558 1\\n\", \"5\\n9 8 5 1 1\\n\", \"7\\n762719 366103 338088 127192 119283 73058 1\\n\", \"2\\n562670 1\\n\", \"9\\n440526 404455 396537 310357 110283 187476 66947 17125 1\\n\", \"22\\n484731 436693 432081 387148 385052 369760 340058 311053 274965 263426 257736 253057 204507 198863 173100 153737 174932 133973 117279 49285 10635 1\\n\", \"5\\n18 17 12 2 1\\n\", \"14\\n472313 469103 339876 336194 308551 248071 166133 92487 154291 133164 110132 71138 33236 1\\n\", \"20\\n483959 458820 443030 396109 340406 334711 283762 278455 253801 253009 210156 208557 206641 169337 150807 121158 80451 41781 30976 1\\n\", \"9\\n135834 291909 263064 208071 185843 149260 94352 58856 1\\n\", \"31\\n495696 494916 482481 477452 476590 455869 439117 434349 430442 422009 419764 414718 406279 400915 400223 392067 374574 360035 358987 342956 307082 298876 267886 249356 190282 340860 86642 76932 50898 41267 1\\n\", \"3\\n697176 213875 1\\n\", \"11\\n447804 447682 436259 404021 392659 376034 367731 268597 145236 25238 1\\n\", \"50\\n500000 96 94 92 90 88 86 84 82 80 78 76 74 72 70 68 66 64 62 60 58 56 54 52 50 48 46 44 42 40 38 36 34 32 30 28 26 24 22 20 18 16 14 12 10 8 6 8 3 1\\n\", \"21\\n469177 434800 431701 392733 387609 373571 336673 317296 424119 275508 274622 250969 230783 207596 204963 165701 132461 119669 58221 44668 1\\n\", \"28\\n490849 431182 419223 344530 312448 307141 301286 295369 281234 197683 270974 266173 257650 252736 222659 201481 193625 187072 145349 130491 111128 95714 92096 58715 37147 6341 5498 1\\n\", \"25\\n486057 441139 430698 427152 408599 383365 343126 339252 185006 223716 219312 216608 170945 163699 154598 141066 128583 79423 78606 58072 30640 28228 24571 5383 1\\n\", \"47\\n496705 492806 462703 446368 424326 398277 392315 383243 372226 371522 361579 360696 356273 339981 330738 287896 287634 281675 277054 253588 215824 204345 201450 194746 260181 159313 157418 155438 145068 142673 132488 129873 126535 126163 122414 119202 96854 91808 88824 78898 77961 66091 51953 50293 41578 23871 1\\n\", \"91\\n4000000 3000000 2900000 2511334 2511333 2102003 1901011 1700000 1200000 999999 800000 750000 600000 508111 202000 101000 35000 20000 9000 5000 2000 899 630 629 628 627 626 625 624 623 622 621 620 619 618 617 616 905 614 613 612 611 610 609 608 607 606 605 604 603 602 601 504 405 404 403 402 401 305 304 303 302 301 205 204 203 202 201 105 104 103 102 101 56 55 54 53 52 51 50 13 12 10 9 8 7 5 4 3 2 1\\n\", \"44\\n497740 484010 477990 474388 466289 465183 446018 441372 423091 415352 385791 365228 356372 335550 327462 311065 304033 294885 291767 264525 260472 251770 250269 234813 214163 175447 166948 131304 120039 114941 106418 95802 92888 81526 81226 81172 75533 69794 69540 51954 49533 39272 12299 1\\n\", \"26\\n488655 449635 420758 337786 333696 329417 326150 285413 281835 273319 226900 208862 195375 175739 163162 160822 146976 104568 92127 96208 88790 78402 48286 26152 24564 1\\n\", \"21\\n472112 431946 411829 406527 399130 395891 385543 377038 361918 360308 264501 312243 305948 206826 199258 182494 179322 103717 31666 5333 1\\n\", \"22\\n430292 392392 391275 385209 370127 359090 311623 300514 394413 213205 200436 196664 191059 150927 146478 111868 101347 88871 73268 56725 30639 1\\n\", \"25\\n494273 487040 483980 449842 405763 383373 378433 196651 338845 284162 276741 270769 243629 213677 132684 129380 124239 100462 92951 87003 75776 56281 33220 13169 1\\n\", \"43\\n494369 493360 454400 448348 441640 436359 402863 401152 772803 370360 365576 345832 319343 316740 312530 292656 268899 264495 243804 239368 236670 229069 216624 211903 209871 199189 185267 180886 180668 159763 157998 153674 153270 142608 132757 132541 119705 68207 59506 58596 56040 14699 1\\n\", \"43\\n499757 498394 494467 494430 490217 487135 467623 461915 425822 400145 392402 368528 361824 357415 355141 352566 347715 326964 321584 317670 306465 280958 218579 216402 213660 180022 118457 115776 88678 82331 69984 83103 60451 56563 56365 48016 31055 24772 15544 2919 2200 1227 1\\n\", \"3\\n389909 41286 1\\n\", \"43\\n494419 475439 473426 456392 445433 431242 426289 425690 418018 402924 379683 376621 334000 322846 320891 317240 311817 308876 278091 271657 269026 262973 224579 192149 177832 165986 128118 119033 112104 105502 76211 74773 71557 67947 67559 67425 62142 76719 47585 19596 11198 7035 1\\n\", \"28\\n499767 465863 409631 394241 389304 538988 342044 267362 233500 208747 205255 202242 199753 187685 185714 183202 163533 148220 142514 140009 139233 137046 75954 67079 66246 46908 16602 1\\n\", \"4\\n29 20 10 1\\n\", \"13\\n313 217 201 127 63 31 15 12 6 5 3 2 1\\n\", \"20\\n489868 466294 428151 412378 394446 317619 316891 307256 199979 190697 181240 161325 143287 115819 111476 94559 71400 63806 32885 1\\n\", \"4\\n5 4 2 1\\n\", \"19\\n262144 131072 65536 32768 16384 8192 6798 2048 1024 512 256 128 64 32 16 8 4 2 1\\n\", \"24\\n498804 485678 468139 437676 385667 362095 356653 355933 320469 292428 277311 272265 249544 210894 207237 199958 197976 109903 75290 55418 38180 37537 20930 1\\n\", \"5\\n454748 375083 231979 63085 1\\n\", \"38\\n499229 467571 492174 485565 485544 447205 436284 425604 391744 391263 389916 386798 385484 363315 348314 330911 324192 314185 307277 297202 296116 263928 260467 253314 243583 211620 189479 182591 156707 152281 137039 120083 114556 109738 86227 33547 4957 1\\n\", \"15\\n471739 409412 379958 365326 363517 219800 226391 152834 143060 109805 86434 39410 8208 4578 1\\n\", \"27\\n477764 440484 431041 427346 368028 323248 314692 310003 299283 277684 269855 267120 229578 224810 78680 210521 161374 158029 150799 141291 115593 59379 37803 34726 27618 24403 1\\n\", \"19\\n471558 461066 456587 453273 522288 344142 314691 298434 237269 173595 167045 143089 78600 75441 62529 44939 26814 1094 1\\n\", \"37\\n497929 464223 451341 425516 401751 360871 345120 339165 332320 327088 325949 321681 321255 312179 306305 300100 268659 268282 236636 232536 230145 202281 183443 181845 174423 159166 158458 96297 138575 113413 98040 91707 63679 51416 21296 11433 1\\n\", \"49\\n487033 478497 477190 468339 464679 442615 442353 417495 395024 388721 371348 369146 368473 362006 355135 337332 335814 330942 327739 324659 316101 546718 277738 276615 259056 254219 253581 245423 238528 236553 230196 229992 216788 200669 194784 190311 164328 157601 152545 105292 94967 76049 55151 43335 39024 38606 3720 447 1\\n\", \"8\\n456034 327797 447968 321462 312039 303728 110658 1\\n\", \"30\\n461488 412667 406467 389755 375075 351026 332191 320180 312165 280759 266670 259978 258741 251297 248771 149134 218200 209793 142034 131703 115953 115369 92627 78342 71508 70411 61656 51268 39439 1\\n\", \"3\\n50 15 1\\n\", \"13\\n496784 464754 425906 370916 351740 336779 292952 77507 178464 166413 75629 11855 1\\n\", \"21\\n477846 443845 425918 402914 362857 346087 339332 322165 312882 299423 275613 221233 173300 159327 244196 141628 133996 93551 85703 809 1\\n\", \"2\\n4 1\\n\", \"12\\n458 144 89 55 34 21 13 8 5 3 2 1\\n\", \"2\\n283419 1\\n\", \"2\\n438673 1\\n\", \"2\\n648775 1\\n\", \"3\\n4 2 1\\n\", \"5\\n47 10 5 2 1\\n\", \"3\\n4 3 1\\n\", \"5\\n25 10 5 2 1\\n\"], \"outputs\": [\"282456\\n\", \"22012\\n\", \"19\\n\", \"25\\n\", \"300\\n\", \"102162\\n\", \"100\\n\", \"100\\n\", \"2232\\n\", \"14\\n\", \"13\\n\", \"146116\\n\", \"-1\\n\", \"68500\\n\", \"-1\\n\", \"53175\\n\", \"27\\n\", \"99708\\n\", \"246\\n\", \"61952\\n\", \"117712\\n\", \"-1\\n\", \"-1\\n\", \"38166\\n\", \"-1\\n\", \"82534\\n\", \"150\\n\", \"641625\\n\", \"277436\\n\", \"-1\\n\", \"98\\n\", \"-1\\n\", \"89336\\n\", \"10996\\n\", \"26915\\n\", \"-1\\n\", \"47742\\n\", \"19\\n\", \"49196\\n\", \"49128\\n\", \"31998\\n\", \"61278\\n\", \"39507\\n\", \"58796\\n\", \"2454\\n\", \"427857\\n\", \"14070\\n\", \"999904\\n\", \"100\\n\", \"49806\\n\", \"52660\\n\", \"30\\n\", \"999998\\n\", \"19\\n\", \"65770\\n\", \"7\\n\", \"-1\\n\", \"41860\\n\", \"457458\\n\", \"34699\\n\", \"9156\\n\", \"802880\\n\", \"-1\\n\", \"48806\\n\", \"93876\\n\", \"83\\n\", \"27350\\n\", \"205356\\n\", \"22866\\n\", \"4023\\n\", \"-1\\n\", \"999998\\n\", \"331974\\n\", \"78878\\n\", \"56788\\n\", \"30\\n\", \"99\\n\", \"-1\\n\", \"82985\\n\", \"93793\\n\", \"282456\\n\", \"22012\\n\", \"500\\n\", \"102162\\n\", \"100\\n\", \"2232\\n\", \"13\\n\", \"146116\\n\", \"-1\\n\", \"68500\\n\", \"53175\\n\", \"24\\n\", \"99708\\n\", \"61952\\n\", \"117712\\n\", \"82534\\n\", \"855500\\n\", \"151428\\n\", \"98\\n\", \"89336\\n\", \"10996\\n\", \"26915\\n\", \"47742\\n\", \"19\\n\", \"49196\\n\", \"49128\\n\", \"31998\\n\", \"61278\\n\", \"39507\\n\", \"58796\\n\", \"2454\\n\", \"412860\\n\", \"14070\\n\", \"49806\\n\", \"40\\n\", \"10\\n\", \"65770\\n\", \"8\\n\", \"7168\\n\", \"41860\\n\", \"252340\\n\", \"34699\\n\", \"9156\\n\", \"48806\\n\", \"27350\\n\", \"22866\\n\", \"4023\\n\", \"331974\\n\", \"78878\\n\", \"60\\n\", \"82985\\n\", \"93793\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"6\\n\", \"-1\\n\"]}", "source": "primeintellect"}
Billy investigates the question of applying greedy algorithm to different spheres of life. At the moment he is studying the application of greedy algorithm to the problem about change. There is an amount of n coins of different face values, and the coins of each value are not limited in number. The task is to collect the sum x with the minimum amount of coins. Greedy algorithm with each its step takes the coin of the highest face value, not exceeding x. Obviously, if among the coins' face values exists the face value 1, any sum x can be collected with the help of greedy algorithm. However, greedy algorithm does not always give the optimal representation of the sum, i.e. the representation with the minimum amount of coins. For example, if there are face values {1, 3, 4} and it is asked to collect the sum 6, greedy algorithm will represent the sum as 4 + 1 + 1, while the optimal representation is 3 + 3, containing one coin less. By the given set of face values find out if there exist such a sum x that greedy algorithm will collect in a non-optimal way. If such a sum exists, find out the smallest of these sums. Input The first line contains an integer n (1 ≤ n ≤ 400) — the amount of the coins' face values. The second line contains n integers ai (1 ≤ ai ≤ 109), describing the face values. It is guaranteed that a1 > a2 > ... > an and an = 1. Output If greedy algorithm collects any sum in an optimal way, output -1. Otherwise output the smallest sum that greedy algorithm collects in a non-optimal way. Examples Input 5 25 10 5 2 1 Output -1 Input 3 4 3 1 Output 6 Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [[2, 6, 2], [1, 5, 1], [1, 5, 3], [0, 15, 3], [16, 15, 3], [2, 24, 22], [2, 2, 2], [2, 2, 1], [1, 15, 3], [15, 1, 3]], \"outputs\": [[12], [15], [5], [45], [0], [26], [2], [2], [35], [0]]}", "source": "primeintellect"}
Your task is to make function, which returns the sum of a sequence of integers. The sequence is defined by 3 non-negative values: **begin**, **end**, **step**. If **begin** value is greater than the **end**, function should returns **0** *Examples* ~~~if-not:nasm ~~~ This is the first kata in the series: 1) Sum of a sequence (this kata) 2) [Sum of a Sequence [Hard-Core Version]](https://www.codewars.com/kata/sum-of-a-sequence-hard-core-version/javascript) Write your solution by modifying this code: ```python def sequence_sum(begin_number, end_number, step): ``` Your solution should implemented in the function "sequence_sum". The i Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [\"eternalalexandersookeustzeouuanisafqaqautomaton\\nnoiol\\n\", \"acacdddadaddcbbbbdacb\\nbabbbcadddacacdaddbdc\\n\", \"yz\\nzy\\n\", \"tqlrrtidhfpgevosrsya\\nysrsvgphitrrqtldfeoa\\n\", \"babbaaababbbbabbaaaababbbaabababbaabbaababbaaabaabbabaabbaababababbaabaaabaaaaababbaabaaaaabaabbabaaababbbb\\nbbaabbbbabbbbaaaaaababbbabaaabbbbabababbbaabbbbbabaababbaabaaabaabbababababaaaaabaabbabaaabaaaaaaaaaaaaabbb\\n\", \"dadebcabefcbaffce\\ncffbfcaddebabecae\\n\", \"ebkkiajfffiiifcgheijbcdafkcdckgdakhicebfgkeiffjbkdbgjeb\\nebffigfbciadcdfdbiehgciiifakbekijfffjcakckgkhekejbkdgjb\\n\", \"baabbaaaaa\\nababa\\n\", \"cbaabccadacadbaacbadddcdabcacdbbabccbbcbbcbbaadcabadcbdcadddccbbbbdacdbcbaddacaadbcddadbabbdbbacabdd\\ncccdacdabbacbbcacdca\\n\", \"d\\nd\\n\", \"f\\np\\n\", \"eternalalexandersookeustzeouuanisafqaqautomaton\\nnojol\\n\", \"baabaaaaba\\nbaaba\\n\", \"e\\ne\\n\", \"baabaa`aba\\nbaaba\\n\", \"baabaa`aba\\nbabba\\n\", \"acacdddadaddcbbbbdacb\\nbabbbcadddacacdaddbdd\\n\", \"zz\\nzy\\n\", \"tqlrrtidhfpgevosrsya\\nysrsvgehitrrqtldfpoa\\n\", \"bbbbabaaababbaabaaaaabaabbabaaaaabaaabaabbabababaabbaababbaabaaabbabaabbaabbababaabbbabaaaabbabbbbabaaabbab\\nbbaabbbbabbbbaaaaaababbbabaaabbbbabababbbaabbbbbabaababbaabaaabaabbababababaaaaabaabbabaaabaaaaaaaaaaaaabbb\\n\", \"dadebcacefcbaffce\\ncffbfcaddebabecae\\n\", \"ebkkiaifffiiifcghejjbcdafkcdckgdakhicebfgkeiffjbkdbgjeb\\nebffigfbciadcdfdbiehgciiifakbekijfffjcakckgkhekejbkdgjb\\n\", \"baabbaaaaa\\nbaaba\\n\", \"cbaabccadacadbaacbadddcdabcacdbbabccbbcbbcbbaadcabadcbdcadddccbbbbdacdbcbaddacaadbcddadbabbdbbacabdd\\ncccdaceabbacbbcacdca\\n\", \"d\\ne\\n\", \"g\\np\\n\", \"defineinulonglong\\nsignedmain\\n\", \"rotator\\nrntator\\n\", \"c`cdcdbbbb\\nbdcaccdbbb\\n\", \"eternalalexandersookeustzeouuanisafqaqautomaton\\nnojnl\\n\", \"acacdddadaddcbbbbdacb\\nb`bbbcadddacacdaddbdd\\n\", \"{z\\nzy\\n\", \"tplrrtidhfqgevosrsya\\nysrsvgehitrrqtldfpoa\\n\", \"bbbbabaaabbbbaabaaaaabaabbabaaaaabaaabaabbabababaabbaababbaabaaabbabaabbaabbababaabbbabaaaabbabbbbabaaabbab\\nbbaabbbbabbbbaaaaaababbbabaaabbbbabababbbaabbbbbabaababbaabaaabaabbababababaaaaabaabbabaaabaaaaaaaaaaaaabbb\\n\", \"dadebcacefcbaffce\\ncffbfcaddebabebae\\n\", \"ebkkiaifffiiifcghejjbcdafkcdckgdakhicebfgkeiffjbkdbgjeb\\nebffigfdciadcbfdbiehgciiifakbekijfffjcakckgkhekejbkdgjb\\n\", \"cbaabccadacadbaacbadddcdabcacdbbabccbbcbbcbbaadcabadcbdcadddccbbbbdacdbcbaddacaadbcddadbabbdbbacabdd\\ncccdaceacbacbbcacdca\\n\", \"g\\nq\\n\", \"gnolgnolunienifed\\nsignedmain\\n\", \"rotator\\nrotatnr\\n\", \"c`cdcdbbbb\\nbdcadccbbb\\n\", \"eternalalexandersookeustzeouuanisafqaqautomaton\\nnojnk\\n\", \"acacdddad`ddcbbbbdacb\\nb`bbbcadddacacdaddbdd\\n\", \"{z\\nyz\\n\", \"tplrrtidhfqgrvosesya\\nysrsvgehitrrqtldfpoa\\n\", \"bbbbabaaabbbbaabaaaaabaabbabaaaaabaaabaabbabababaabbaababbaabaaabbabaabbaabbababaabbbabaaaabbabbbbabaaabbab\\nbbbaaaaaaaaaaaaabaaababbaabaaaaabababababbaabaaabaabbabaababbbbbaabbbabababbbbaaababbbabaaaaaabbbbabbbbaabb\\n\", \"ecffabcfecacbedad\\ncffbfcaddebabebae\\n\", \"ebkkiaifffiiifcghejjbcdafkcdckgdakhicebfgkeiffjbkdbgjeb\\nebffigfdciadcbfdbiehgciiifakbekijfffjcakckglhekejbkdgjb\\n\", \"cbaabccadacadbaacbadddcdabcacdbbabccbbcbbcbbaadcabadcbdcadddccbbbbdacdbcbaddacaadbcddadbabbdbbacabdd\\ncccdadeacbacbbcaccca\\n\", \"f\\ne\\n\", \"f\\nq\\n\", \"gnolgnolunneiifed\\nsignedmain\\n\", \"rotator\\nnotatrr\\n\", \"c`cccdbbbb\\nbdcadccbbb\\n\", \"eternalalexandersookeustzeouuanisafqaqautomaton\\nnoknk\\n\", \"acacdddad`ddcbbbcdacb\\nb`bbbcadddacacdaddbdd\\n\", \"zz\\nyz\\n\", \"tpmrrtidhfqgrvosesya\\nysrsvgehitrrqtldfpoa\\n\", \"babbaaababbbbabbaaaababbbaabababbaabbaababbaaabaabbabaabbaababababbaabaaabaaaaababbaabaaaaabaabbbbaaababbbb\\nbbbaaaaaaaaaaaaabaaababbaabaaaaabababababbaabaaabaabbabaababbbbbaabbbabababbbbaaababbbabaaaaaabbbbabbbbaabb\\n\", \"ecffabcfecacbedad\\ncgfbfcaddebabebae\\n\", \"ebkkiaifffiiifcghejjbcdafkcdckgdakhicebfgkeiffjbkdbgjeb\\nbjgdkbjekehlgkckacjfffjikebkafiiicgheibdfbcdaicdfgiffbe\\n\", \"cbaabccadacadbaacbadddcdabcacdbbabccbbcbbcbbaadcabadcbdcadddccbbbbdacdbcbaddacaadbcddadbabbdbcacabdd\\ncccdadeacbacbbcaccca\\n\", \"g\\ne\\n\", \"f\\no\\n\", \"gnolgnolunneiifed\\nniamdengis\\n\", \"rotator\\nnotbtrr\\n\", \"c`cccdbbbb\\nbdcadccbcb\\n\", \"eternalalexandersookeustzeouvanisafqaqautomaton\\nnoknk\\n\", \"acacdddad`ddcbbbcdacb\\nddbddadcacadddacbbb`b\\n\", \"yz\\nyz\\n\", \"tpmrrtidhfqgrvosesyb\\nysrsvgehitrrqtldfpoa\\n\", \"babbaaababbbbabbaaaababbbaabababbaabbaababbaaabaabbabaabbaababababbaab`aabaaaaababbaabaaaaabaabbbbaaababbbb\\nbbbaaaaaaaaaaaaabaaababbaabaaaaabababababbaabaaabaabbabaababbbbbaabbbabababbbbaaababbbabaaaaaabbbbabbbbaabb\\n\", \"dadebcacefcbaffce\\ncgfbfcaddebabebae\\n\", \"ebkkiaifffiiifcghejjbcdafkcdcjgdakhicebfgkeiffjbkdbgjeb\\nebffigfdciadcbfdbiehgciiifakbekijfffjcakckglhekejbkdgjb\\n\", \"baabaa`aba\\ncabba\\n\", \"cbaabccbdacadbaacbadddcdabcacdbbabccbbcbbcbbaadcabadcbdcadddccbbbbdacdbcbaddacaadbcddadbabbdbcacabdd\\ncccdadeacbacbbcaccca\\n\", \"g\\nf\\n\", \"f\\nn\\n\", \"fnolgnolunneiifed\\nniamdengis\\n\", \"rotatnr\\nnotbtrr\\n\", \"bbbbdccc`c\\nbdcadccbcb\\n\", \"eternalalexandersookeustzfouvanisafqaqautomaton\\nnoknk\\n\", \"acacdddad`ddcbbbcdacb\\nddbddadcacaddd`cbbb`b\\n\", \"yz\\n{y\\n\", \"defineintlonglong\\nsignedmain\\n\", \"rotator\\nrotator\\n\", \"cacdcdbbbb\\nbdcaccdbbb\\n\", \"abab\\nba\\n\"], \"outputs\": [\"1920\", \"64\", \"2\", \"2\", \"284471294\", \"2\", \"12\", \"120\", \"773806867\", \"2\", \"0\", \"0\\n\", \"152\\n\", \"2\\n\", \"96\\n\", \"12\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"2\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\", \"4\", \"24\", \"12\"]}", "source": "primeintellect"}
Kaavi, the mysterious fortune teller, deeply believes that one's fate is inevitable and unavoidable. Of course, she makes her living by predicting others' future. While doing divination, Kaavi believes that magic spells can provide great power for her to see the future. <image> Kaavi has a string T of length m and all the strings with the prefix T are magic spells. Kaavi also has a string S of length n and an empty string A. During the divination, Kaavi needs to perform a sequence of operations. There are two different operations: * Delete the first character of S and add it at the front of A. * Delete the first character of S and add it at the back of A. Kaavi can perform no more than n operations. To finish the divination, she wants to know the number of different operation sequences to make A a magic spell (i.e. with the prefix T). As her assistant, can you help her? The answer might be huge, so Kaavi only needs to know the answer modulo 998 244 353. Two operation sequences are considered different if they are different in length or there exists an i that their i-th operation is different. A substring is a contiguous sequence of characters within a string. A prefix of a string S is a substring of S that occurs at the beginning of S. Input The first line contains a string S of length n (1 ≤ n ≤ 3000). The second line contains a string T of length m (1 ≤ m ≤ n). Both strings contain only lowercase Latin letters. Output The output contains only one integer — the answer modulo 998 244 353. Examples Input abab ba Output 12 Input defineintlonglong signedmain Output 0 Input rotator rotator Output 4 Input cacdcdbbbb bdcaccdbbb Output 24 Note The first test: <image> The red ones are the magic spells. In the first operation, Kaavi can either add the first character "a" at the front or the back of A, although the results are the same, they are considered as different operations. So the answer is 6×2=12. Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0.375
{"tests": "{\"inputs\": [[\"\"], [\"A\"], [\"AA\"], [\"AAAABBBCCDAABBB\"], [\"AADD\"], [\"AAD\"], [\"ADD\"], [\"ABBCcAD\"], [[1, 2, 3, 3]], [[\"a\", \"b\", \"b\"]]], \"outputs\": [[[]], [[\"A\"]], [[\"A\"]], [[\"A\", \"B\", \"C\", \"D\", \"A\", \"B\"]], [[\"A\", \"D\"]], [[\"A\", \"D\"]], [[\"A\", \"D\"]], [[\"A\", \"B\", \"C\", \"c\", \"A\", \"D\"]], [[1, 2, 3]], [[\"a\", \"b\"]]]}", "source": "primeintellect"}
Implement the function unique_in_order which takes as argument a sequence and returns a list of items without any elements with the same value next to each other and preserving the original order of elements. For example: ```python unique_in_order('AAAABBBCCDAABBB') == ['A', 'B', 'C', 'D', 'A', 'B'] unique_in_order('ABBCcAD') == ['A', 'B', 'C', 'c', 'A', 'D'] unique_in_order([1,2,2,3,3]) == [1,2,3] ``` Write your solution by modifying this code: ```python def unique_in_order(iterable): ``` Your solution should implemented in the function "unique_in_order". The i Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [\"3\\n3 4 1\", \"5\\n2 1 2 1 2\", \"5\\n2 1 1 1 2\", \"5\\n3 1 1 1 1\", \"3\\n1 3 4\", \"3\\n3 5 1\", \"5\\n2 1 2 2 2\", \"3\\n3 5 2\", \"5\\n3 1 2 2 2\", \"3\\n3 5 3\", \"5\\n6 1 2 2 2\", \"3\\n3 7 3\", \"5\\n1 1 2 2 2\", \"3\\n3 1 3\", \"5\\n1 1 2 1 2\", \"5\\n1 1 2 1 4\", \"3\\n3 3 1\", \"5\\n2 3 2 1 1\", \"3\\n5 3 1\", \"3\\n3 7 1\", \"3\\n3 7 2\", \"5\\n3 1 2 2 4\", \"3\\n3 9 3\", \"5\\n11 1 2 2 2\", \"3\\n5 7 3\", \"3\\n1 3 1\", \"5\\n4 3 2 1 1\", \"5\\n2 1 1 2 2\", \"3\\n6 7 1\", \"5\\n3 2 2 2 4\", \"3\\n3 9 1\", \"5\\n14 1 2 2 2\", \"3\\n5 10 3\", \"3\\n2 3 1\", \"5\\n3 3 2 1 1\", \"5\\n2 1 1 4 2\", \"5\\n3 1 2 1 4\", \"3\\n3 12 1\", \"5\\n28 1 2 2 2\", \"3\\n5 10 2\", \"5\\n3 3 2 1 2\", \"5\\n2 1 1 3 2\", \"5\\n3 1 2 1 8\", \"3\\n6 12 1\", \"3\\n5 2 2\", \"5\\n1 3 2 1 2\", \"5\\n2 1 1 5 2\", \"5\\n3 1 2 1 13\", \"3\\n2 12 1\", \"3\\n10 2 2\", \"5\\n1 3 2 2 2\", \"5\\n4 1 1 5 2\", \"3\\n2 12 2\", \"3\\n18 2 2\", \"5\\n1 3 1 2 2\", \"5\\n3 1 1 5 2\", \"3\\n18 3 2\", \"5\\n3 1 2 5 2\", \"3\\n31 3 2\", \"3\\n31 4 2\", \"3\\n31 3 4\", \"3\\n27 3 4\", \"3\\n54 3 4\", \"3\\n54 3 7\", \"3\\n54 3 2\", \"3\\n52 3 2\", \"3\\n88 3 2\", \"3\\n3 1 1\", \"5\\n2 4 2 1 2\", \"3\\n3 5 4\", \"5\\n2 2 1 2 2\", \"3\\n6 5 2\", \"5\\n1 1 3 2 2\", \"3\\n5 5 3\", \"3\\n1 7 3\", \"3\\n3 6 1\", \"5\\n3 3 1 1 2\", \"3\\n5 3 2\", \"5\\n1 1 1 2 2\", \"3\\n4 5 1\", \"3\\n5 7 2\", \"5\\n3 1 2 3 4\", \"3\\n6 9 3\", \"5\\n11 1 2 2 1\", \"3\\n5 7 5\", \"3\\n1 3 2\", \"5\\n1 1 1 4 2\", \"3\\n6 9 1\", \"5\\n14 1 2 2 3\", \"3\\n8 10 3\", \"5\\n3 3 2 2 2\", \"5\\n3 2 2 1 4\", \"3\\n3 12 2\", \"5\\n23 1 2 2 2\", \"5\\n1 1 2 1 8\", \"3\\n6 20 1\", \"3\\n5 2 1\", \"5\\n1 3 2 1 4\", \"5\\n2 1 1 8 2\", \"5\\n3 1 2 1 3\", \"3\\n3 2 1\", \"5\\n2 3 2 1 2\"], \"outputs\": [\"2\", \"3\", \"4\", \"5\", \"1\", \"2\", \"3\", \"2\", \"3\", \"2\", \"3\", \"2\", \"3\", \"2\", \"3\", \"3\", \"2\", \"3\", \"2\", \"2\", \"2\", \"2\", \"2\", \"3\", \"2\", \"2\", \"3\", \"3\", \"2\", \"2\", \"2\", \"3\", \"2\", \"2\", \"3\", \"3\", \"3\", \"2\", \"3\", \"2\", \"2\", \"3\", \"3\", \"2\", \"2\", \"2\", \"3\", \"3\", \"2\", \"2\", \"2\", \"3\", \"2\", \"2\", \"2\", \"3\", \"2\", \"2\", \"2\", \"2\", \"2\", \"2\", \"2\", \"2\", \"2\", \"2\", \"2\", \"3\", \"2\", \"2\", \"2\", \"2\", \"3\", \"2\", \"2\", \"2\", \"3\", \"2\", \"3\", \"2\", \"2\", \"2\", \"2\", \"3\", \"2\", \"2\", \"3\", \"2\", \"2\", \"2\", \"2\", \"3\", \"2\", \"3\", \"3\", \"2\", \"2\", \"2\", \"3\", \"3\", \"2\", \"2\"]}", "source": "primeintellect"}
There are N strings arranged in a row. It is known that, for any two adjacent strings, the string to the left is lexicographically smaller than the string to the right. That is, S_1<S_2<...<S_N holds lexicographically, where S_i is the i-th string from the left. At least how many different characters are contained in S_1,S_2,...,S_N, if the length of S_i is known to be A_i? Constraints * 1 \leq N \leq 2\times 10^5 * 1 \leq A_i \leq 10^9 * A_i is an integer. Input Input is given from Standard Input in the following format: N A_1 A_2 ... A_N Output Print the minimum possible number of different characters contained in the strings. Examples Input 3 3 2 1 Output 2 Input 5 2 3 2 1 2 Output 2 Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [\"2 1\\n1 2\\n\", \"8 1\\n8 2\\n2 5\\n5 1\\n7 2\\n2 4\\n3 5\\n5 6\\n\", \"5 1\\n4 1\\n3 1\\n5 1\\n1 2\\n\", \"25 2\\n1 2\\n1 3\\n1 4\\n2 5\\n2 6\\n2 7\\n3 8\\n3 9\\n3 10\\n4 11\\n4 12\\n4 13\\n4 14\\n14 15\\n14 16\\n14 17\\n4 18\\n18 19\\n18 20\\n18 21\\n1 22\\n22 23\\n22 24\\n22 25\\n\", \"33 2\\n3 13\\n17 3\\n2 6\\n5 33\\n4 18\\n1 2\\n31 5\\n4 19\\n3 16\\n1 3\\n9 2\\n10 3\\n5 1\\n5 28\\n21 4\\n7 2\\n1 4\\n5 24\\n30 5\\n14 3\\n3 11\\n27 5\\n8 2\\n22 4\\n12 3\\n20 4\\n26 5\\n4 23\\n32 5\\n25 5\\n15 3\\n29 5\\n\", \"13 2\\n1 2\\n1 3\\n1 4\\n1 5\\n1 6\\n1 7\\n1 8\\n1 9\\n1 10\\n1 11\\n1 12\\n1 13\\n\", \"16 2\\n1 12\\n2 12\\n3 12\\n4 13\\n5 13\\n6 13\\n7 16\\n8 16\\n9 15\\n10 15\\n11 15\\n12 14\\n13 14\\n16 14\\n15 14\\n\", \"18 2\\n1 4\\n2 4\\n3 4\\n4 13\\n10 5\\n11 5\\n12 5\\n14 5\\n5 13\\n6 7\\n8 6\\n13 6\\n9 6\\n13 15\\n15 16\\n15 17\\n15 18\\n\", \"7 1\\n1 2\\n1 3\\n1 4\\n5 1\\n1 6\\n1 7\\n\", \"21 2\\n3 1\\n4 1\\n5 1\\n6 2\\n7 2\\n8 2\\n1 2\\n9 1\\n9 10\\n9 11\\n9 12\\n10 13\\n10 14\\n10 15\\n11 16\\n11 17\\n11 18\\n12 19\\n12 20\\n12 21\\n\", \"8 2\\n8 2\\n2 5\\n5 1\\n7 2\\n2 4\\n3 5\\n5 6\\n\", \"4 1\\n2 3\\n4 2\\n1 2\\n\", \"14 1\\n1 4\\n2 4\\n3 4\\n4 13\\n10 5\\n11 5\\n12 5\\n14 5\\n5 13\\n6 7\\n8 6\\n13 6\\n9 6\\n\", \"16 2\\n1 12\\n2 12\\n3 12\\n4 13\\n5 13\\n6 13\\n7 14\\n8 14\\n9 15\\n10 15\\n11 15\\n12 16\\n13 16\\n14 16\\n15 16\\n\", \"2 1\\n2 1\\n\", \"13 1000000000\\n1 2\\n1 3\\n1 4\\n1 5\\n1 6\\n1 7\\n1 8\\n1 9\\n1 10\\n1 11\\n1 12\\n1 13\\n\", \"22 2\\n1 4\\n2 4\\n3 4\\n5 8\\n6 8\\n7 8\\n9 12\\n10 12\\n11 12\\n13 16\\n14 16\\n15 16\\n17 20\\n18 20\\n19 20\\n4 21\\n8 21\\n12 21\\n4 22\\n16 22\\n20 22\\n\", \"1 1\\n\", \"10 980000000\\n5 4\\n7 1\\n3 2\\n10 6\\n2 8\\n6 4\\n7 9\\n1 8\\n3 10\\n\", \"14 3\\n1 4\\n2 4\\n3 4\\n4 13\\n10 5\\n11 5\\n12 5\\n14 5\\n5 13\\n6 7\\n8 6\\n13 6\\n9 6\\n\", \"13 2\\n7 5\\n10 11\\n5 12\\n1 2\\n10 7\\n2 6\\n10 4\\n9 5\\n13 10\\n2 8\\n3 10\\n2 7\\n\", \"2 2\\n1 2\\n\", \"8 1\\n8 2\\n2 5\\n5 1\\n7 2\\n2 4\\n3 2\\n5 6\\n\", \"21 2\\n3 1\\n4 1\\n5 1\\n6 2\\n7 2\\n8 2\\n1 2\\n9 1\\n9 10\\n9 11\\n9 12\\n15 13\\n10 14\\n10 15\\n11 16\\n11 17\\n11 18\\n12 19\\n12 20\\n12 21\\n\", \"8 4\\n8 2\\n2 5\\n5 1\\n7 2\\n2 4\\n3 5\\n5 6\\n\", \"16 2\\n1 12\\n2 12\\n3 12\\n4 13\\n5 13\\n6 13\\n7 14\\n8 14\\n9 15\\n10 15\\n11 15\\n12 16\\n13 16\\n14 16\\n15 12\\n\", \"21 2\\n3 1\\n4 1\\n5 1\\n6 2\\n7 2\\n8 2\\n1 2\\n9 2\\n9 10\\n9 11\\n9 12\\n15 13\\n10 14\\n10 15\\n11 16\\n11 17\\n11 18\\n12 19\\n12 20\\n12 21\\n\", \"5 1\\n4 2\\n3 1\\n5 1\\n1 2\\n\", \"21 2\\n3 1\\n4 1\\n5 1\\n6 2\\n7 2\\n8 2\\n1 2\\n9 1\\n9 10\\n9 11\\n9 12\\n10 13\\n10 14\\n10 15\\n11 16\\n11 17\\n11 18\\n12 19\\n3 20\\n12 21\\n\", \"14 1\\n1 4\\n2 4\\n3 4\\n4 13\\n10 5\\n11 5\\n12 5\\n14 5\\n5 13\\n4 7\\n8 6\\n13 6\\n9 6\\n\", \"1 2\\n\", \"14 3\\n1 4\\n2 4\\n3 4\\n4 13\\n10 5\\n11 5\\n12 5\\n14 5\\n5 13\\n6 7\\n8 6\\n13 8\\n9 6\\n\", \"2 3\\n1 2\\n\", \"21 2\\n3 1\\n4 1\\n5 1\\n6 3\\n7 2\\n8 2\\n1 2\\n9 1\\n9 10\\n9 11\\n9 12\\n15 13\\n10 14\\n10 15\\n11 16\\n11 17\\n11 18\\n12 19\\n12 20\\n12 21\\n\", \"16 2\\n1 12\\n2 12\\n3 12\\n4 13\\n5 13\\n6 13\\n7 10\\n8 14\\n9 15\\n10 15\\n11 15\\n12 16\\n13 16\\n14 16\\n15 12\\n\", \"21 2\\n3 1\\n4 1\\n5 1\\n6 2\\n7 2\\n8 2\\n1 2\\n9 1\\n9 10\\n9 11\\n9 12\\n10 13\\n10 14\\n10 15\\n11 16\\n11 17\\n9 18\\n12 19\\n3 20\\n12 21\\n\", \"16 4\\n1 12\\n2 12\\n3 12\\n4 13\\n5 13\\n6 13\\n7 10\\n8 14\\n9 15\\n10 15\\n11 15\\n12 16\\n13 16\\n14 16\\n15 12\\n\", \"16 4\\n1 12\\n2 12\\n3 12\\n4 13\\n5 13\\n6 13\\n7 10\\n8 14\\n9 15\\n10 15\\n11 15\\n12 16\\n13 16\\n14 15\\n15 12\\n\", \"21 2\\n3 1\\n4 1\\n5 1\\n6 2\\n7 2\\n8 2\\n1 2\\n9 1\\n9 10\\n9 11\\n8 12\\n10 13\\n10 14\\n10 15\\n11 16\\n11 17\\n11 18\\n12 19\\n12 20\\n12 21\\n\", \"1 3\\n1 2\\n\", \"16 4\\n1 12\\n2 12\\n3 12\\n4 13\\n5 13\\n6 13\\n7 10\\n8 14\\n9 15\\n10 15\\n11 15\\n12 5\\n13 16\\n14 16\\n15 12\\n\", \"1 5\\n1 2\\n\", \"16 1\\n1 12\\n2 12\\n3 12\\n4 13\\n5 13\\n6 13\\n7 10\\n8 14\\n9 15\\n10 15\\n11 15\\n12 5\\n13 16\\n14 16\\n15 12\\n\", \"1 5\\n0 2\\n\", \"1 5\\n1 4\\n\", \"8 3\\n8 2\\n2 5\\n5 1\\n7 2\\n2 4\\n3 5\\n5 6\\n\", \"14 1\\n1 4\\n2 4\\n3 4\\n4 13\\n10 5\\n11 5\\n12 5\\n14 5\\n5 13\\n6 7\\n8 4\\n13 6\\n9 6\\n\", \"16 2\\n1 12\\n2 12\\n3 12\\n4 13\\n5 13\\n6 13\\n7 15\\n8 14\\n9 15\\n10 15\\n11 15\\n12 16\\n13 16\\n14 16\\n15 16\\n\", \"7 1000000000\\n1 2\\n1 3\\n1 4\\n1 5\\n1 6\\n1 7\\n1 8\\n1 9\\n1 10\\n1 11\\n1 12\\n1 13\\n\", \"22 2\\n1 4\\n2 4\\n3 4\\n5 8\\n6 8\\n7 8\\n9 12\\n10 12\\n11 12\\n13 16\\n14 16\\n15 16\\n17 20\\n18 20\\n19 20\\n4 21\\n8 21\\n12 21\\n3 22\\n16 22\\n20 22\\n\", \"10 980000000\\n5 4\\n7 1\\n3 2\\n9 6\\n2 8\\n6 4\\n7 9\\n1 8\\n3 10\\n\", \"13 2\\n7 5\\n10 11\\n5 12\\n1 2\\n10 7\\n2 6\\n10 4\\n9 5\\n13 9\\n2 8\\n3 10\\n2 7\\n\", \"14 2\\n1 4\\n2 4\\n3 4\\n1 13\\n10 5\\n11 5\\n12 5\\n14 5\\n5 13\\n6 7\\n8 6\\n13 6\\n9 6\\n\", \"16 3\\n1 12\\n2 12\\n3 12\\n4 13\\n5 13\\n6 13\\n7 14\\n8 14\\n9 15\\n10 15\\n11 15\\n12 16\\n13 16\\n14 16\\n15 12\\n\", \"21 2\\n3 1\\n4 1\\n5 1\\n6 2\\n7 2\\n8 2\\n1 2\\n9 1\\n9 10\\n12 11\\n9 12\\n10 13\\n10 14\\n10 15\\n11 16\\n11 17\\n11 18\\n12 19\\n3 20\\n12 21\\n\", \"1 3\\n\", \"14 3\\n1 4\\n2 4\\n3 4\\n4 13\\n10 5\\n11 5\\n12 6\\n14 5\\n5 13\\n6 7\\n8 6\\n13 8\\n9 6\\n\", \"1 4\\n1 2\\n\", \"1 5\\n-1 2\\n\", \"1 5\\n1 3\\n\", \"3 1\\n1 3\\n2 3\\n\", \"14 2\\n1 4\\n2 4\\n3 4\\n4 13\\n10 5\\n11 5\\n12 5\\n14 5\\n5 13\\n6 7\\n8 6\\n13 6\\n9 6\\n\"], \"outputs\": [\"No\\n\", \"No\\n\", \"Yes\\n\", \"No\\n\", \"Yes\\n\", \"No\\n\", \"No\\n\", \"Yes\\n\", \"Yes\\n\", \"No\\n\", \"No\\n\", \"Yes\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"Yes\\n\"]}", "source": "primeintellect"}
Someone give a strange birthday present to Ivan. It is hedgehog — connected undirected graph in which one vertex has degree at least 3 (we will call it center) and all other vertices has degree 1. Ivan thought that hedgehog is too boring and decided to make himself k-multihedgehog. Let us define k-multihedgehog as follows: * 1-multihedgehog is hedgehog: it has one vertex of degree at least 3 and some vertices of degree 1. * For all k ≥ 2, k-multihedgehog is (k-1)-multihedgehog in which the following changes has been made for each vertex v with degree 1: let u be its only neighbor; remove vertex v, create a new hedgehog with center at vertex w and connect vertices u and w with an edge. New hedgehogs can differ from each other and the initial gift. Thereby k-multihedgehog is a tree. Ivan made k-multihedgehog but he is not sure that he did not make any mistakes. That is why he asked you to check if his tree is indeed k-multihedgehog. Input First line of input contains 2 integers n, k (1 ≤ n ≤ 10^{5}, 1 ≤ k ≤ 10^{9}) — number of vertices and hedgehog parameter. Next n-1 lines contains two integers u v (1 ≤ u, v ≤ n; u ≠ v) — indices of vertices connected by edge. It is guaranteed that given graph is a tree. Output Print "Yes" (without quotes), if given graph is k-multihedgehog, and "No" (without quotes) otherwise. Examples Input 14 2 1 4 2 4 3 4 4 13 10 5 11 5 12 5 14 5 5 13 6 7 8 6 13 6 9 6 Output Yes Input 3 1 1 3 2 3 Output No Note 2-multihedgehog from the first example looks like this: <image> Its center is vertex 13. Hedgehogs created on last step are: [4 (center), 1, 2, 3], [6 (center), 7, 8, 9], [5 (center), 10, 11, 12, 13]. Tree from second example is not a hedgehog because degree of center should be at least 3. Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [\"7\\n1\\n2\\n6\\n13\\n14\\n3620\\n10000\\n\", \"100\\n1\\n2\\n3\\n4\\n5\\n6\\n7\\n8\\n9\\n10\\n11\\n12\\n13\\n14\\n15\\n16\\n17\\n18\\n19\\n20\\n21\\n22\\n23\\n24\\n25\\n26\\n27\\n28\\n29\\n30\\n31\\n32\\n33\\n34\\n35\\n36\\n37\\n38\\n39\\n40\\n41\\n42\\n43\\n44\\n45\\n46\\n47\\n48\\n49\\n50\\n51\\n52\\n53\\n54\\n55\\n56\\n57\\n58\\n59\\n60\\n61\\n62\\n63\\n64\\n65\\n66\\n67\\n68\\n69\\n70\\n71\\n72\\n73\\n74\\n75\\n76\\n77\\n78\\n79\\n80\\n81\\n82\\n83\\n84\\n85\\n86\\n87\\n88\\n89\\n90\\n91\\n92\\n93\\n94\\n95\\n96\\n97\\n98\\n99\\n100\\n\", \"1\\n450283905890997363\\n\", \"100\\n1\\n8\\n4\\n6\\n5\\n4\\n4\\n6\\n8\\n3\\n9\\n5\\n7\\n8\\n8\\n5\\n9\\n6\\n9\\n4\\n5\\n6\\n4\\n4\\n7\\n1\\n2\\n2\\n5\\n6\\n1\\n5\\n10\\n9\\n10\\n9\\n3\\n1\\n2\\n3\\n2\\n6\\n9\\n2\\n9\\n5\\n7\\n7\\n2\\n6\\n9\\n5\\n1\\n7\\n8\\n3\\n7\\n9\\n3\\n1\\n7\\n1\\n2\\n4\\n7\\n2\\n7\\n1\\n1\\n10\\n8\\n5\\n7\\n7\\n10\\n8\\n1\\n7\\n5\\n10\\n7\\n6\\n6\\n6\\n7\\n4\\n9\\n3\\n4\\n9\\n10\\n5\\n1\\n2\\n6\\n9\\n3\\n8\\n10\\n9\\n\", \"1\\n387420490\\n\", \"8\\n1\\n2\\n6\\n13\\n14\\n3620\\n10000\\n1000000000000000000\\n\", \"100\\n1\\n2\\n3\\n4\\n5\\n6\\n7\\n8\\n9\\n10\\n11\\n12\\n13\\n14\\n15\\n16\\n17\\n18\\n19\\n20\\n21\\n22\\n23\\n24\\n25\\n26\\n27\\n28\\n29\\n30\\n31\\n32\\n33\\n34\\n35\\n36\\n37\\n38\\n39\\n40\\n41\\n42\\n43\\n44\\n45\\n46\\n47\\n48\\n49\\n50\\n51\\n52\\n53\\n54\\n55\\n56\\n57\\n58\\n59\\n60\\n61\\n62\\n63\\n64\\n65\\n66\\n67\\n68\\n69\\n70\\n71\\n72\\n73\\n74\\n75\\n76\\n77\\n78\\n79\\n80\\n81\\n82\\n83\\n84\\n85\\n86\\n87\\n88\\n89\\n90\\n91\\n92\\n93\\n94\\n95\\n96\\n97\\n98\\n99\\n100\\n\", \"1\\n788649749283011226\\n\", \"100\\n1\\n8\\n4\\n6\\n5\\n4\\n4\\n6\\n8\\n3\\n9\\n5\\n7\\n8\\n8\\n5\\n9\\n6\\n9\\n4\\n5\\n6\\n4\\n4\\n7\\n1\\n2\\n2\\n5\\n6\\n1\\n5\\n10\\n9\\n10\\n9\\n2\\n1\\n2\\n3\\n2\\n6\\n9\\n2\\n9\\n5\\n7\\n7\\n2\\n6\\n9\\n5\\n1\\n7\\n8\\n3\\n7\\n9\\n3\\n1\\n7\\n1\\n2\\n4\\n7\\n2\\n7\\n1\\n1\\n10\\n8\\n5\\n7\\n7\\n10\\n8\\n1\\n7\\n5\\n10\\n7\\n6\\n6\\n6\\n7\\n4\\n9\\n3\\n4\\n9\\n10\\n5\\n1\\n2\\n6\\n9\\n3\\n8\\n10\\n9\\n\", \"1\\n506859788\\n\", \"8\\n1\\n2\\n7\\n13\\n14\\n3620\\n10000\\n1000000000000000000\\n\", \"100\\n1\\n2\\n3\\n4\\n5\\n6\\n7\\n8\\n14\\n10\\n11\\n12\\n13\\n14\\n15\\n16\\n17\\n18\\n19\\n20\\n21\\n22\\n23\\n24\\n25\\n26\\n27\\n28\\n29\\n30\\n31\\n32\\n33\\n34\\n35\\n36\\n37\\n38\\n39\\n40\\n41\\n42\\n43\\n44\\n45\\n46\\n47\\n48\\n49\\n50\\n51\\n52\\n53\\n54\\n55\\n56\\n57\\n58\\n59\\n60\\n61\\n62\\n63\\n64\\n65\\n66\\n67\\n68\\n69\\n70\\n71\\n72\\n73\\n74\\n75\\n76\\n77\\n78\\n79\\n80\\n81\\n82\\n83\\n84\\n85\\n86\\n87\\n88\\n89\\n90\\n91\\n92\\n93\\n94\\n95\\n96\\n97\\n98\\n99\\n100\\n\", \"7\\n1\\n2\\n10\\n13\\n14\\n3620\\n10000\\n\", \"100\\n1\\n8\\n4\\n6\\n5\\n4\\n4\\n6\\n8\\n3\\n9\\n5\\n7\\n8\\n8\\n5\\n9\\n6\\n9\\n4\\n5\\n6\\n4\\n4\\n7\\n1\\n2\\n2\\n5\\n6\\n1\\n5\\n10\\n9\\n10\\n9\\n2\\n1\\n2\\n3\\n2\\n6\\n9\\n2\\n9\\n5\\n7\\n7\\n2\\n6\\n9\\n5\\n1\\n7\\n8\\n3\\n7\\n9\\n3\\n1\\n7\\n1\\n2\\n4\\n7\\n2\\n7\\n1\\n1\\n10\\n8\\n5\\n7\\n7\\n10\\n8\\n1\\n7\\n5\\n10\\n7\\n6\\n6\\n6\\n7\\n4\\n9\\n3\\n4\\n9\\n10\\n5\\n1\\n2\\n6\\n3\\n3\\n8\\n10\\n9\\n\", \"1\\n132370398\\n\", \"100\\n1\\n2\\n3\\n4\\n5\\n6\\n7\\n8\\n14\\n10\\n11\\n12\\n13\\n14\\n15\\n16\\n17\\n18\\n19\\n20\\n21\\n22\\n23\\n24\\n25\\n26\\n27\\n28\\n29\\n30\\n31\\n32\\n33\\n34\\n35\\n36\\n37\\n38\\n39\\n40\\n41\\n42\\n43\\n44\\n45\\n46\\n47\\n48\\n49\\n50\\n51\\n52\\n53\\n54\\n55\\n56\\n57\\n58\\n59\\n60\\n61\\n62\\n63\\n64\\n65\\n66\\n67\\n68\\n69\\n70\\n71\\n72\\n73\\n74\\n75\\n76\\n77\\n78\\n79\\n80\\n81\\n82\\n83\\n137\\n85\\n86\\n87\\n88\\n89\\n90\\n91\\n92\\n93\\n94\\n95\\n96\\n97\\n98\\n99\\n100\\n\", \"7\\n1\\n2\\n10\\n13\\n7\\n3620\\n10000\\n\", \"1\\n230139648\\n\", \"100\\n1\\n2\\n3\\n4\\n5\\n6\\n7\\n8\\n14\\n10\\n11\\n12\\n13\\n14\\n15\\n16\\n17\\n18\\n19\\n20\\n21\\n22\\n23\\n24\\n25\\n26\\n27\\n28\\n29\\n30\\n31\\n32\\n33\\n34\\n35\\n36\\n37\\n38\\n39\\n40\\n41\\n42\\n43\\n44\\n45\\n46\\n47\\n48\\n49\\n50\\n51\\n52\\n53\\n54\\n55\\n56\\n57\\n58\\n59\\n60\\n61\\n62\\n63\\n64\\n65\\n66\\n67\\n68\\n69\\n70\\n71\\n72\\n73\\n74\\n75\\n76\\n77\\n78\\n79\\n80\\n81\\n82\\n83\\n137\\n85\\n86\\n87\\n88\\n89\\n90\\n91\\n97\\n93\\n94\\n95\\n96\\n97\\n98\\n99\\n100\\n\", \"7\\n2\\n2\\n10\\n13\\n7\\n3620\\n10000\\n\", \"1\\n196757653606102993\\n\", \"8\\n1\\n3\\n13\\n13\\n14\\n3620\\n10000\\n1100000000000000000\\n\", \"1\\n239065226774823548\\n\", \"1\\n152260256\\n\", \"8\\n1\\n3\\n13\\n13\\n14\\n2081\\n10000\\n1100000000000000000\\n\", \"100\\n1\\n2\\n3\\n4\\n5\\n6\\n7\\n8\\n14\\n10\\n11\\n12\\n13\\n14\\n15\\n16\\n17\\n18\\n19\\n20\\n21\\n22\\n22\\n24\\n25\\n26\\n27\\n28\\n29\\n30\\n31\\n32\\n33\\n34\\n35\\n36\\n37\\n38\\n39\\n40\\n41\\n42\\n43\\n44\\n45\\n46\\n47\\n48\\n49\\n50\\n51\\n52\\n53\\n54\\n55\\n56\\n57\\n58\\n59\\n60\\n61\\n62\\n63\\n64\\n65\\n66\\n67\\n68\\n69\\n70\\n71\\n24\\n73\\n74\\n75\\n76\\n77\\n78\\n79\\n80\\n81\\n82\\n83\\n137\\n85\\n86\\n87\\n88\\n89\\n90\\n91\\n97\\n93\\n94\\n95\\n96\\n97\\n98\\n99\\n100\\n\", \"7\\n2\\n2\\n10\\n13\\n2\\n3620\\n11000\\n\", \"100\\n1\\n2\\n3\\n4\\n5\\n6\\n7\\n8\\n14\\n10\\n11\\n12\\n13\\n14\\n15\\n16\\n17\\n18\\n19\\n20\\n21\\n22\\n22\\n24\\n25\\n26\\n27\\n28\\n29\\n30\\n31\\n32\\n33\\n34\\n35\\n36\\n37\\n38\\n39\\n40\\n41\\n42\\n43\\n44\\n8\\n46\\n47\\n48\\n49\\n50\\n51\\n52\\n53\\n54\\n55\\n56\\n57\\n58\\n59\\n60\\n61\\n62\\n63\\n64\\n65\\n66\\n67\\n68\\n69\\n70\\n71\\n24\\n73\\n74\\n75\\n76\\n77\\n78\\n79\\n80\\n81\\n82\\n83\\n137\\n85\\n86\\n87\\n88\\n89\\n90\\n91\\n97\\n93\\n94\\n95\\n96\\n97\\n98\\n99\\n100\\n\", \"1\\n18099502583880351\\n\", \"100\\n1\\n2\\n3\\n4\\n5\\n6\\n7\\n8\\n14\\n10\\n11\\n12\\n13\\n14\\n15\\n16\\n17\\n18\\n19\\n20\\n21\\n22\\n22\\n28\\n25\\n26\\n27\\n28\\n29\\n30\\n31\\n32\\n33\\n34\\n35\\n36\\n37\\n38\\n39\\n40\\n41\\n42\\n43\\n44\\n8\\n46\\n47\\n48\\n49\\n50\\n51\\n52\\n53\\n54\\n55\\n56\\n57\\n58\\n59\\n60\\n61\\n62\\n63\\n64\\n65\\n66\\n67\\n68\\n69\\n70\\n71\\n24\\n73\\n74\\n75\\n76\\n77\\n78\\n79\\n80\\n81\\n82\\n83\\n137\\n85\\n86\\n87\\n88\\n89\\n90\\n91\\n97\\n93\\n94\\n95\\n96\\n97\\n98\\n99\\n100\\n\", \"7\\n2\\n2\\n10\\n23\\n2\\n4327\\n11000\\n\", \"1\\n30462481510440077\\n\", \"1\\n16660704739123405\\n\", \"100\\n1\\n2\\n3\\n4\\n5\\n6\\n7\\n8\\n14\\n10\\n11\\n12\\n13\\n14\\n15\\n16\\n17\\n18\\n19\\n20\\n21\\n22\\n22\\n28\\n25\\n26\\n27\\n28\\n29\\n30\\n31\\n32\\n33\\n34\\n35\\n36\\n37\\n38\\n39\\n40\\n41\\n42\\n43\\n44\\n8\\n46\\n20\\n48\\n49\\n50\\n51\\n52\\n66\\n54\\n55\\n56\\n57\\n58\\n59\\n60\\n61\\n62\\n63\\n64\\n65\\n66\\n67\\n68\\n69\\n70\\n71\\n24\\n73\\n74\\n75\\n76\\n77\\n78\\n79\\n80\\n81\\n82\\n83\\n137\\n85\\n86\\n87\\n88\\n89\\n90\\n91\\n97\\n93\\n94\\n95\\n96\\n97\\n98\\n99\\n100\\n\", \"100\\n1\\n2\\n3\\n4\\n5\\n6\\n7\\n8\\n14\\n10\\n11\\n12\\n13\\n14\\n15\\n16\\n17\\n18\\n19\\n20\\n21\\n22\\n22\\n28\\n25\\n26\\n27\\n28\\n29\\n30\\n31\\n32\\n33\\n34\\n35\\n36\\n37\\n38\\n39\\n40\\n41\\n42\\n43\\n44\\n8\\n46\\n20\\n48\\n49\\n50\\n51\\n52\\n66\\n54\\n55\\n56\\n57\\n58\\n59\\n60\\n61\\n62\\n63\\n64\\n65\\n66\\n67\\n68\\n69\\n70\\n71\\n24\\n73\\n74\\n75\\n76\\n77\\n78\\n79\\n104\\n81\\n82\\n83\\n137\\n85\\n86\\n87\\n88\\n89\\n90\\n91\\n97\\n93\\n94\\n95\\n96\\n97\\n98\\n99\\n100\\n\", \"7\\n2\\n2\\n11\\n23\\n2\\n4327\\n11100\\n\", \"1\\n586187597\\n\", \"100\\n1\\n2\\n3\\n4\\n5\\n6\\n7\\n8\\n14\\n10\\n11\\n12\\n13\\n14\\n15\\n16\\n17\\n18\\n19\\n20\\n21\\n31\\n22\\n28\\n25\\n26\\n27\\n28\\n29\\n30\\n31\\n32\\n33\\n34\\n35\\n36\\n37\\n38\\n39\\n40\\n41\\n42\\n43\\n44\\n8\\n46\\n20\\n48\\n49\\n50\\n51\\n52\\n66\\n54\\n55\\n56\\n57\\n58\\n59\\n60\\n61\\n62\\n63\\n64\\n65\\n66\\n67\\n68\\n69\\n70\\n71\\n24\\n73\\n74\\n75\\n76\\n77\\n78\\n79\\n104\\n81\\n82\\n83\\n137\\n85\\n86\\n87\\n88\\n89\\n90\\n91\\n97\\n93\\n94\\n95\\n96\\n97\\n98\\n99\\n100\\n\", \"7\\n2\\n2\\n19\\n23\\n2\\n4327\\n11100\\n\", \"1\\n7998811304217407\\n\", \"100\\n1\\n2\\n3\\n4\\n5\\n6\\n7\\n8\\n14\\n10\\n11\\n12\\n13\\n14\\n15\\n16\\n17\\n18\\n19\\n20\\n21\\n31\\n22\\n28\\n47\\n26\\n27\\n28\\n29\\n30\\n31\\n32\\n33\\n34\\n35\\n36\\n37\\n38\\n39\\n40\\n41\\n42\\n43\\n44\\n8\\n46\\n20\\n48\\n49\\n50\\n51\\n52\\n66\\n54\\n55\\n56\\n57\\n58\\n59\\n60\\n61\\n62\\n63\\n64\\n65\\n66\\n67\\n68\\n69\\n70\\n71\\n24\\n73\\n74\\n75\\n76\\n77\\n78\\n79\\n104\\n81\\n82\\n83\\n137\\n85\\n86\\n87\\n88\\n89\\n90\\n91\\n97\\n93\\n94\\n95\\n96\\n97\\n98\\n99\\n100\\n\", \"7\\n2\\n2\\n19\\n1\\n2\\n4327\\n11100\\n\", \"1\\n6125720912782488\\n\", \"1\\n100214312\\n\", \"100\\n1\\n2\\n3\\n4\\n5\\n6\\n7\\n8\\n14\\n10\\n11\\n12\\n13\\n14\\n15\\n16\\n13\\n18\\n19\\n20\\n21\\n31\\n22\\n28\\n47\\n26\\n27\\n28\\n29\\n30\\n31\\n32\\n33\\n34\\n35\\n36\\n37\\n38\\n39\\n40\\n41\\n42\\n43\\n44\\n8\\n46\\n20\\n48\\n49\\n50\\n51\\n52\\n66\\n54\\n55\\n56\\n57\\n58\\n59\\n60\\n61\\n62\\n63\\n64\\n65\\n66\\n67\\n68\\n69\\n70\\n71\\n24\\n73\\n74\\n75\\n76\\n77\\n78\\n79\\n104\\n81\\n82\\n83\\n137\\n85\\n86\\n87\\n88\\n89\\n90\\n91\\n97\\n93\\n94\\n95\\n96\\n97\\n98\\n99\\n100\\n\", \"7\\n4\\n2\\n19\\n1\\n2\\n4327\\n11100\\n\", \"100\\n1\\n2\\n3\\n4\\n5\\n6\\n7\\n8\\n14\\n10\\n11\\n12\\n13\\n14\\n15\\n16\\n13\\n18\\n19\\n20\\n21\\n31\\n22\\n28\\n47\\n26\\n27\\n28\\n29\\n30\\n31\\n32\\n33\\n34\\n35\\n36\\n37\\n38\\n39\\n40\\n41\\n42\\n43\\n44\\n8\\n46\\n20\\n48\\n49\\n50\\n51\\n52\\n66\\n54\\n55\\n56\\n57\\n58\\n59\\n60\\n61\\n62\\n63\\n64\\n65\\n66\\n67\\n68\\n69\\n70\\n71\\n24\\n73\\n74\\n75\\n76\\n77\\n78\\n79\\n104\\n81\\n82\\n47\\n137\\n85\\n86\\n87\\n88\\n89\\n90\\n91\\n97\\n93\\n94\\n95\\n96\\n97\\n98\\n99\\n100\\n\", \"100\\n1\\n2\\n3\\n4\\n5\\n6\\n7\\n8\\n14\\n10\\n11\\n12\\n13\\n14\\n15\\n16\\n13\\n18\\n19\\n20\\n21\\n31\\n22\\n28\\n47\\n26\\n27\\n28\\n29\\n30\\n31\\n32\\n33\\n34\\n35\\n36\\n37\\n38\\n39\\n40\\n41\\n42\\n43\\n44\\n8\\n46\\n20\\n48\\n49\\n50\\n51\\n52\\n66\\n54\\n55\\n56\\n57\\n58\\n59\\n60\\n61\\n62\\n63\\n64\\n65\\n66\\n67\\n68\\n69\\n70\\n71\\n24\\n73\\n74\\n75\\n76\\n77\\n78\\n79\\n104\\n81\\n82\\n47\\n137\\n85\\n86\\n87\\n88\\n22\\n90\\n91\\n97\\n93\\n94\\n95\\n96\\n97\\n98\\n99\\n100\\n\", \"7\\n4\\n4\\n19\\n1\\n3\\n4327\\n11100\\n\", \"100\\n1\\n2\\n3\\n4\\n5\\n6\\n7\\n8\\n14\\n10\\n11\\n12\\n13\\n14\\n15\\n16\\n13\\n18\\n19\\n20\\n21\\n31\\n22\\n28\\n47\\n26\\n27\\n28\\n29\\n30\\n31\\n32\\n33\\n34\\n35\\n36\\n37\\n38\\n39\\n40\\n41\\n42\\n43\\n44\\n8\\n46\\n20\\n48\\n49\\n50\\n51\\n52\\n66\\n54\\n55\\n56\\n57\\n58\\n59\\n60\\n61\\n62\\n63\\n64\\n65\\n66\\n67\\n68\\n69\\n70\\n71\\n24\\n73\\n74\\n75\\n76\\n77\\n78\\n79\\n104\\n81\\n82\\n47\\n137\\n85\\n86\\n87\\n88\\n22\\n90\\n91\\n97\\n93\\n94\\n95\\n96\\n97\\n98\\n46\\n100\\n\", \"7\\n4\\n4\\n28\\n1\\n3\\n4327\\n11100\\n\", \"100\\n1\\n2\\n3\\n4\\n5\\n6\\n7\\n8\\n14\\n10\\n11\\n12\\n13\\n14\\n15\\n16\\n13\\n18\\n19\\n20\\n21\\n31\\n22\\n28\\n47\\n26\\n27\\n28\\n29\\n30\\n14\\n32\\n33\\n34\\n35\\n36\\n37\\n38\\n39\\n40\\n41\\n42\\n43\\n44\\n8\\n46\\n20\\n48\\n49\\n50\\n51\\n52\\n66\\n54\\n55\\n56\\n57\\n58\\n59\\n60\\n61\\n62\\n63\\n64\\n65\\n66\\n67\\n68\\n69\\n70\\n71\\n24\\n73\\n74\\n75\\n76\\n77\\n78\\n79\\n104\\n81\\n82\\n47\\n137\\n85\\n86\\n87\\n88\\n22\\n90\\n91\\n97\\n93\\n94\\n95\\n96\\n97\\n98\\n46\\n100\\n\", \"1\\n931393092531784562\\n\", \"8\\n1\\n3\\n7\\n13\\n14\\n3620\\n10000\\n1000000000000000000\\n\", \"1\\n850073407904408290\\n\", \"100\\n1\\n8\\n4\\n6\\n5\\n4\\n4\\n6\\n8\\n3\\n9\\n5\\n7\\n8\\n8\\n5\\n9\\n6\\n9\\n4\\n5\\n6\\n4\\n4\\n7\\n1\\n2\\n2\\n5\\n7\\n1\\n5\\n10\\n9\\n10\\n9\\n2\\n1\\n2\\n3\\n2\\n6\\n9\\n2\\n9\\n5\\n7\\n7\\n2\\n6\\n9\\n5\\n1\\n7\\n8\\n3\\n7\\n9\\n3\\n1\\n7\\n1\\n2\\n4\\n7\\n2\\n7\\n1\\n1\\n10\\n8\\n5\\n7\\n7\\n10\\n8\\n1\\n7\\n5\\n10\\n7\\n6\\n6\\n6\\n7\\n4\\n9\\n3\\n4\\n9\\n10\\n5\\n1\\n2\\n6\\n3\\n3\\n8\\n10\\n9\\n\", \"8\\n1\\n3\\n7\\n13\\n14\\n3620\\n10000\\n1100000000000000000\\n\", \"1\\n218113389\\n\", \"100\\n1\\n2\\n3\\n4\\n5\\n6\\n7\\n8\\n14\\n10\\n11\\n12\\n13\\n14\\n15\\n16\\n17\\n18\\n19\\n20\\n21\\n22\\n22\\n24\\n25\\n26\\n27\\n28\\n29\\n30\\n31\\n32\\n33\\n34\\n35\\n36\\n37\\n38\\n39\\n40\\n41\\n42\\n43\\n44\\n45\\n46\\n47\\n48\\n49\\n50\\n51\\n52\\n53\\n54\\n55\\n56\\n57\\n58\\n59\\n60\\n61\\n62\\n63\\n64\\n65\\n66\\n67\\n68\\n69\\n70\\n71\\n72\\n73\\n74\\n75\\n76\\n77\\n78\\n79\\n80\\n81\\n82\\n83\\n137\\n85\\n86\\n87\\n88\\n89\\n90\\n91\\n97\\n93\\n94\\n95\\n96\\n97\\n98\\n99\\n100\\n\", \"7\\n2\\n2\\n10\\n13\\n7\\n3620\\n11000\\n\", \"1\\n273206121025892542\\n\", \"1\\n286582383\\n\", \"8\\n1\\n3\\n13\\n13\\n14\\n2081\\n10001\\n1100000000000000000\\n\", \"7\\n2\\n2\\n10\\n13\\n2\\n4327\\n11000\\n\", \"1\\n269157321\\n\", \"1\\n256370409\\n\", \"100\\n1\\n2\\n3\\n4\\n5\\n6\\n7\\n8\\n14\\n10\\n11\\n12\\n13\\n14\\n15\\n16\\n17\\n18\\n19\\n20\\n21\\n22\\n22\\n28\\n25\\n26\\n27\\n28\\n29\\n30\\n31\\n32\\n33\\n34\\n35\\n36\\n37\\n38\\n39\\n40\\n41\\n42\\n43\\n44\\n8\\n46\\n47\\n48\\n49\\n50\\n51\\n52\\n66\\n54\\n55\\n56\\n57\\n58\\n59\\n60\\n61\\n62\\n63\\n64\\n65\\n66\\n67\\n68\\n69\\n70\\n71\\n24\\n73\\n74\\n75\\n76\\n77\\n78\\n79\\n80\\n81\\n82\\n83\\n137\\n85\\n86\\n87\\n88\\n89\\n90\\n91\\n97\\n93\\n94\\n95\\n96\\n97\\n98\\n99\\n100\\n\", \"7\\n2\\n2\\n10\\n24\\n2\\n4327\\n11000\\n\", \"1\\n357784722\\n\", \"7\\n2\\n2\\n10\\n23\\n2\\n4327\\n11100\\n\", \"1\\n32426295562729903\\n\", \"1\\n456642039\\n\", \"1\\n26658457360408589\\n\", \"1\\n1066149996\\n\", \"1\\n7811953999234198\\n\", \"1\\n151880165\\n\", \"7\\n4\\n2\\n19\\n1\\n3\\n4327\\n11100\\n\", \"1\\n14215993222891853\\n\", \"1\\n199899292\\n\", \"1\\n14023318619635129\\n\", \"1\\n383372573\\n\", \"1\\n12673752953086258\\n\", \"1\\n116503335\\n\", \"7\\n1\\n2\\n6\\n13\\n14\\n3620\\n10000\\n\"], \"outputs\": [\"1\\n3\\n9\\n13\\n27\\n6561\\n19683\\n\", \"1\\n3\\n3\\n4\\n9\\n9\\n9\\n9\\n9\\n10\\n12\\n12\\n13\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n28\\n30\\n30\\n31\\n36\\n36\\n36\\n36\\n36\\n37\\n39\\n39\\n40\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n82\\n84\\n84\\n85\\n90\\n90\\n90\\n90\\n90\\n91\\n93\\n93\\n94\\n108\\n108\\n108\\n108\\n108\\n108\\n\", \"450283905890997363\\n\", \"1\\n9\\n4\\n9\\n9\\n4\\n4\\n9\\n9\\n3\\n9\\n9\\n9\\n9\\n9\\n9\\n9\\n9\\n9\\n4\\n9\\n9\\n4\\n4\\n9\\n1\\n3\\n3\\n9\\n9\\n1\\n9\\n10\\n9\\n10\\n9\\n3\\n1\\n3\\n3\\n3\\n9\\n9\\n3\\n9\\n9\\n9\\n9\\n3\\n9\\n9\\n9\\n1\\n9\\n9\\n3\\n9\\n9\\n3\\n1\\n9\\n1\\n3\\n4\\n9\\n3\\n9\\n1\\n1\\n10\\n9\\n9\\n9\\n9\\n10\\n9\\n1\\n9\\n9\\n10\\n9\\n9\\n9\\n9\\n9\\n4\\n9\\n3\\n4\\n9\\n10\\n9\\n1\\n3\\n9\\n9\\n3\\n9\\n10\\n9\\n\", \"387420490\\n\", \"1\\n3\\n9\\n13\\n27\\n6561\\n19683\\n1350851717672992089\\n\", \"1\\n3\\n3\\n4\\n9\\n9\\n9\\n9\\n9\\n10\\n12\\n12\\n13\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n28\\n30\\n30\\n31\\n36\\n36\\n36\\n36\\n36\\n37\\n39\\n39\\n40\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n82\\n84\\n84\\n85\\n90\\n90\\n90\\n90\\n90\\n91\\n93\\n93\\n94\\n108\\n108\\n108\\n108\\n108\\n108\\n\", \"1350851717672992089\\n\", \"1\\n9\\n4\\n9\\n9\\n4\\n4\\n9\\n9\\n3\\n9\\n9\\n9\\n9\\n9\\n9\\n9\\n9\\n9\\n4\\n9\\n9\\n4\\n4\\n9\\n1\\n3\\n3\\n9\\n9\\n1\\n9\\n10\\n9\\n10\\n9\\n3\\n1\\n3\\n3\\n3\\n9\\n9\\n3\\n9\\n9\\n9\\n9\\n3\\n9\\n9\\n9\\n1\\n9\\n9\\n3\\n9\\n9\\n3\\n1\\n9\\n1\\n3\\n4\\n9\\n3\\n9\\n1\\n1\\n10\\n9\\n9\\n9\\n9\\n10\\n9\\n1\\n9\\n9\\n10\\n9\\n9\\n9\\n9\\n9\\n4\\n9\\n3\\n4\\n9\\n10\\n9\\n1\\n3\\n9\\n9\\n3\\n9\\n10\\n9\\n\", \"516560652\\n\", \"1\\n3\\n9\\n13\\n27\\n6561\\n19683\\n1350851717672992089\\n\", \"1\\n3\\n3\\n4\\n9\\n9\\n9\\n9\\n27\\n10\\n12\\n12\\n13\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n28\\n30\\n30\\n31\\n36\\n36\\n36\\n36\\n36\\n37\\n39\\n39\\n40\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n82\\n84\\n84\\n85\\n90\\n90\\n90\\n90\\n90\\n91\\n93\\n93\\n94\\n108\\n108\\n108\\n108\\n108\\n108\\n\", \"1\\n3\\n10\\n13\\n27\\n6561\\n19683\\n\", \"1\\n9\\n4\\n9\\n9\\n4\\n4\\n9\\n9\\n3\\n9\\n9\\n9\\n9\\n9\\n9\\n9\\n9\\n9\\n4\\n9\\n9\\n4\\n4\\n9\\n1\\n3\\n3\\n9\\n9\\n1\\n9\\n10\\n9\\n10\\n9\\n3\\n1\\n3\\n3\\n3\\n9\\n9\\n3\\n9\\n9\\n9\\n9\\n3\\n9\\n9\\n9\\n1\\n9\\n9\\n3\\n9\\n9\\n3\\n1\\n9\\n1\\n3\\n4\\n9\\n3\\n9\\n1\\n1\\n10\\n9\\n9\\n9\\n9\\n10\\n9\\n1\\n9\\n9\\n10\\n9\\n9\\n9\\n9\\n9\\n4\\n9\\n3\\n4\\n9\\n10\\n9\\n1\\n3\\n9\\n3\\n3\\n9\\n10\\n9\\n\", \"133923132\\n\", \"1\\n3\\n3\\n4\\n9\\n9\\n9\\n9\\n27\\n10\\n12\\n12\\n13\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n28\\n30\\n30\\n31\\n36\\n36\\n36\\n36\\n36\\n37\\n39\\n39\\n40\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n82\\n84\\n243\\n85\\n90\\n90\\n90\\n90\\n90\\n91\\n93\\n93\\n94\\n108\\n108\\n108\\n108\\n108\\n108\\n\", \"1\\n3\\n10\\n13\\n9\\n6561\\n19683\\n\", \"387420489\\n\", \"1\\n3\\n3\\n4\\n9\\n9\\n9\\n9\\n27\\n10\\n12\\n12\\n13\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n28\\n30\\n30\\n31\\n36\\n36\\n36\\n36\\n36\\n37\\n39\\n39\\n40\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n82\\n84\\n243\\n85\\n90\\n90\\n90\\n90\\n90\\n91\\n108\\n93\\n94\\n108\\n108\\n108\\n108\\n108\\n108\\n\", \"3\\n3\\n10\\n13\\n9\\n6561\\n19683\\n\", \"200126180395998828\\n\", \"1\\n3\\n13\\n13\\n27\\n6561\\n19683\\n1350851717672992089\\n\", \"450283905890997363\\n\", \"172186884\\n\", \"1\\n3\\n13\\n13\\n27\\n2187\\n19683\\n1350851717672992089\\n\", \"1\\n3\\n3\\n4\\n9\\n9\\n9\\n9\\n27\\n10\\n12\\n12\\n13\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n28\\n30\\n30\\n31\\n36\\n36\\n36\\n36\\n36\\n37\\n39\\n39\\n40\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n27\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n82\\n84\\n243\\n85\\n90\\n90\\n90\\n90\\n90\\n91\\n108\\n93\\n94\\n108\\n108\\n108\\n108\\n108\\n108\\n\", \"3\\n3\\n10\\n13\\n3\\n6561\\n19683\\n\", \"1\\n3\\n3\\n4\\n9\\n9\\n9\\n9\\n27\\n10\\n12\\n12\\n13\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n28\\n30\\n30\\n31\\n36\\n36\\n36\\n36\\n36\\n37\\n39\\n39\\n40\\n81\\n81\\n81\\n81\\n9\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n27\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n82\\n84\\n243\\n85\\n90\\n90\\n90\\n90\\n90\\n91\\n108\\n93\\n94\\n108\\n108\\n108\\n108\\n108\\n108\\n\", \"18530201888518410\\n\", \"1\\n3\\n3\\n4\\n9\\n9\\n9\\n9\\n27\\n10\\n12\\n12\\n13\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n28\\n27\\n27\\n27\\n28\\n30\\n30\\n31\\n36\\n36\\n36\\n36\\n36\\n37\\n39\\n39\\n40\\n81\\n81\\n81\\n81\\n9\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n27\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n82\\n84\\n243\\n85\\n90\\n90\\n90\\n90\\n90\\n91\\n108\\n93\\n94\\n108\\n108\\n108\\n108\\n108\\n108\\n\", \"3\\n3\\n10\\n27\\n3\\n6561\\n19683\\n\", \"50031545098999707\\n\", \"16677181699666569\\n\", \"1\\n3\\n3\\n4\\n9\\n9\\n9\\n9\\n27\\n10\\n12\\n12\\n13\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n28\\n27\\n27\\n27\\n28\\n30\\n30\\n31\\n36\\n36\\n36\\n36\\n36\\n37\\n39\\n39\\n40\\n81\\n81\\n81\\n81\\n9\\n81\\n27\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n27\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n82\\n84\\n243\\n85\\n90\\n90\\n90\\n90\\n90\\n91\\n108\\n93\\n94\\n108\\n108\\n108\\n108\\n108\\n108\\n\", \"1\\n3\\n3\\n4\\n9\\n9\\n9\\n9\\n27\\n10\\n12\\n12\\n13\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n28\\n27\\n27\\n27\\n28\\n30\\n30\\n31\\n36\\n36\\n36\\n36\\n36\\n37\\n39\\n39\\n40\\n81\\n81\\n81\\n81\\n9\\n81\\n27\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n27\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n108\\n81\\n82\\n84\\n243\\n85\\n90\\n90\\n90\\n90\\n90\\n91\\n108\\n93\\n94\\n108\\n108\\n108\\n108\\n108\\n108\\n\", \"3\\n3\\n12\\n27\\n3\\n6561\\n19683\\n\", \"1162261467\\n\", \"1\\n3\\n3\\n4\\n9\\n9\\n9\\n9\\n27\\n10\\n12\\n12\\n13\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n31\\n27\\n28\\n27\\n27\\n27\\n28\\n30\\n30\\n31\\n36\\n36\\n36\\n36\\n36\\n37\\n39\\n39\\n40\\n81\\n81\\n81\\n81\\n9\\n81\\n27\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n27\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n108\\n81\\n82\\n84\\n243\\n85\\n90\\n90\\n90\\n90\\n90\\n91\\n108\\n93\\n94\\n108\\n108\\n108\\n108\\n108\\n108\\n\", \"3\\n3\\n27\\n27\\n3\\n6561\\n19683\\n\", \"8029754151691311\\n\", \"1\\n3\\n3\\n4\\n9\\n9\\n9\\n9\\n27\\n10\\n12\\n12\\n13\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n31\\n27\\n28\\n81\\n27\\n27\\n28\\n30\\n30\\n31\\n36\\n36\\n36\\n36\\n36\\n37\\n39\\n39\\n40\\n81\\n81\\n81\\n81\\n9\\n81\\n27\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n27\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n108\\n81\\n82\\n84\\n243\\n85\\n90\\n90\\n90\\n90\\n90\\n91\\n108\\n93\\n94\\n108\\n108\\n108\\n108\\n108\\n108\\n\", \"3\\n3\\n27\\n1\\n3\\n6561\\n19683\\n\", \"6176733962839470\\n\", \"129140163\\n\", \"1\\n3\\n3\\n4\\n9\\n9\\n9\\n9\\n27\\n10\\n12\\n12\\n13\\n27\\n27\\n27\\n13\\n27\\n27\\n27\\n27\\n31\\n27\\n28\\n81\\n27\\n27\\n28\\n30\\n30\\n31\\n36\\n36\\n36\\n36\\n36\\n37\\n39\\n39\\n40\\n81\\n81\\n81\\n81\\n9\\n81\\n27\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n27\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n108\\n81\\n82\\n84\\n243\\n85\\n90\\n90\\n90\\n90\\n90\\n91\\n108\\n93\\n94\\n108\\n108\\n108\\n108\\n108\\n108\\n\", \"4\\n3\\n27\\n1\\n3\\n6561\\n19683\\n\", \"1\\n3\\n3\\n4\\n9\\n9\\n9\\n9\\n27\\n10\\n12\\n12\\n13\\n27\\n27\\n27\\n13\\n27\\n27\\n27\\n27\\n31\\n27\\n28\\n81\\n27\\n27\\n28\\n30\\n30\\n31\\n36\\n36\\n36\\n36\\n36\\n37\\n39\\n39\\n40\\n81\\n81\\n81\\n81\\n9\\n81\\n27\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n27\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n108\\n81\\n82\\n81\\n243\\n85\\n90\\n90\\n90\\n90\\n90\\n91\\n108\\n93\\n94\\n108\\n108\\n108\\n108\\n108\\n108\\n\", \"1\\n3\\n3\\n4\\n9\\n9\\n9\\n9\\n27\\n10\\n12\\n12\\n13\\n27\\n27\\n27\\n13\\n27\\n27\\n27\\n27\\n31\\n27\\n28\\n81\\n27\\n27\\n28\\n30\\n30\\n31\\n36\\n36\\n36\\n36\\n36\\n37\\n39\\n39\\n40\\n81\\n81\\n81\\n81\\n9\\n81\\n27\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n27\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n108\\n81\\n82\\n81\\n243\\n85\\n90\\n90\\n90\\n27\\n90\\n91\\n108\\n93\\n94\\n108\\n108\\n108\\n108\\n108\\n108\\n\", \"4\\n4\\n27\\n1\\n3\\n6561\\n19683\\n\", \"1\\n3\\n3\\n4\\n9\\n9\\n9\\n9\\n27\\n10\\n12\\n12\\n13\\n27\\n27\\n27\\n13\\n27\\n27\\n27\\n27\\n31\\n27\\n28\\n81\\n27\\n27\\n28\\n30\\n30\\n31\\n36\\n36\\n36\\n36\\n36\\n37\\n39\\n39\\n40\\n81\\n81\\n81\\n81\\n9\\n81\\n27\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n27\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n108\\n81\\n82\\n81\\n243\\n85\\n90\\n90\\n90\\n27\\n90\\n91\\n108\\n93\\n94\\n108\\n108\\n108\\n108\\n81\\n108\\n\", \"4\\n4\\n28\\n1\\n3\\n6561\\n19683\\n\", \"1\\n3\\n3\\n4\\n9\\n9\\n9\\n9\\n27\\n10\\n12\\n12\\n13\\n27\\n27\\n27\\n13\\n27\\n27\\n27\\n27\\n31\\n27\\n28\\n81\\n27\\n27\\n28\\n30\\n30\\n27\\n36\\n36\\n36\\n36\\n36\\n37\\n39\\n39\\n40\\n81\\n81\\n81\\n81\\n9\\n81\\n27\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n27\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n108\\n81\\n82\\n81\\n243\\n85\\n90\\n90\\n90\\n27\\n90\\n91\\n108\\n93\\n94\\n108\\n108\\n108\\n108\\n81\\n108\\n\", \"1350851717672992089\\n\", \"1\\n3\\n9\\n13\\n27\\n6561\\n19683\\n1350851717672992089\\n\", \"1350851717672992089\\n\", \"1\\n9\\n4\\n9\\n9\\n4\\n4\\n9\\n9\\n3\\n9\\n9\\n9\\n9\\n9\\n9\\n9\\n9\\n9\\n4\\n9\\n9\\n4\\n4\\n9\\n1\\n3\\n3\\n9\\n9\\n1\\n9\\n10\\n9\\n10\\n9\\n3\\n1\\n3\\n3\\n3\\n9\\n9\\n3\\n9\\n9\\n9\\n9\\n3\\n9\\n9\\n9\\n1\\n9\\n9\\n3\\n9\\n9\\n3\\n1\\n9\\n1\\n3\\n4\\n9\\n3\\n9\\n1\\n1\\n10\\n9\\n9\\n9\\n9\\n10\\n9\\n1\\n9\\n9\\n10\\n9\\n9\\n9\\n9\\n9\\n4\\n9\\n3\\n4\\n9\\n10\\n9\\n1\\n3\\n9\\n3\\n3\\n9\\n10\\n9\\n\", \"1\\n3\\n9\\n13\\n27\\n6561\\n19683\\n1350851717672992089\\n\", \"387420489\\n\", \"1\\n3\\n3\\n4\\n9\\n9\\n9\\n9\\n27\\n10\\n12\\n12\\n13\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n28\\n30\\n30\\n31\\n36\\n36\\n36\\n36\\n36\\n37\\n39\\n39\\n40\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n82\\n84\\n243\\n85\\n90\\n90\\n90\\n90\\n90\\n91\\n108\\n93\\n94\\n108\\n108\\n108\\n108\\n108\\n108\\n\", \"3\\n3\\n10\\n13\\n9\\n6561\\n19683\\n\", \"450283905890997363\\n\", \"387420489\\n\", \"1\\n3\\n13\\n13\\n27\\n2187\\n19683\\n1350851717672992089\\n\", \"3\\n3\\n10\\n13\\n3\\n6561\\n19683\\n\", \"387420489\\n\", \"387420489\\n\", \"1\\n3\\n3\\n4\\n9\\n9\\n9\\n9\\n27\\n10\\n12\\n12\\n13\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n27\\n28\\n27\\n27\\n27\\n28\\n30\\n30\\n31\\n36\\n36\\n36\\n36\\n36\\n37\\n39\\n39\\n40\\n81\\n81\\n81\\n81\\n9\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n27\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n81\\n82\\n84\\n243\\n85\\n90\\n90\\n90\\n90\\n90\\n91\\n108\\n93\\n94\\n108\\n108\\n108\\n108\\n108\\n108\\n\", \"3\\n3\\n10\\n27\\n3\\n6561\\n19683\\n\", \"387420489\\n\", \"3\\n3\\n10\\n27\\n3\\n6561\\n19683\\n\", \"50031545098999707\\n\", \"516560652\\n\", \"50031545098999707\\n\", \"1162261467\\n\", \"8029754151691311\\n\", \"172186884\\n\", \"4\\n3\\n27\\n1\\n3\\n6561\\n19683\\n\", \"16677181699666569\\n\", \"387420489\\n\", \"16677181699666569\\n\", \"387420489\\n\", \"16677181699666569\\n\", \"129140163\\n\", \"1\\n3\\n9\\n13\\n27\\n6561\\n19683\\n\"]}", "source": "primeintellect"}
The only difference between easy and hard versions is the maximum value of $n$. You are given a positive integer number $n$. You really love good numbers so you want to find the smallest good number greater than or equal to $n$. The positive integer is called good if it can be represented as a sum of distinct powers of $3$ (i.e. no duplicates of powers of $3$ are allowed). For example: $30$ is a good number: $30 = 3^3 + 3^1$, $1$ is a good number: $1 = 3^0$, $12$ is a good number: $12 = 3^2 + 3^1$, but $2$ is not a good number: you can't represent it as a sum of distinct powers of $3$ ($2 = 3^0 + 3^0$), $19$ is not a good number: you can't represent it as a sum of distinct powers of $3$ (for example, the representations $19 = 3^2 + 3^2 + 3^0 = 3^2 + 3^1 + 3^1 + 3^1 + 3^0$ are invalid), $20$ is also not a good number: you can't represent it as a sum of distinct powers of $3$ (for example, the representation $20 = 3^2 + 3^2 + 3^0 + 3^0$ is invalid). Note, that there exist other representations of $19$ and $20$ as sums of powers of $3$ but none of them consists of distinct powers of $3$. For the given positive integer $n$ find such smallest $m$ ($n \le m$) that $m$ is a good number. You have to answer $q$ independent queries. -----Input----- The first line of the input contains one integer $q$ ($1 \le q \le 500$) — the number of queries. Then $q$ queries follow. The only line of the query contains one integer $n$ ($1 \le n \le 10^4$). -----Output----- For each query, print such smallest integer $m$ (where $n \le m$) that $m$ is a good number. -----Example----- Input 7 1 2 6 13 14 3620 10000 Output 1 3 9 13 27 6561 19683 Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [[\"coverage\"], [\"coverage coverage\"], [\"nothing\"], [\"double space \"], [\"covfefe\"]], \"outputs\": [[\"covfefe\"], [\"covfefe covfefe\"], [\"nothing covfefe\"], [\"double space covfefe\"], [\"covfefe covfefe\"]]}", "source": "primeintellect"}
# Covfefe Your are given a string. You must replace the word(s) `coverage` by `covfefe`, however, if you don't find the word `coverage` in the string, you must add `covfefe` at the end of the string with a leading space. For the languages where the string is not immutable (such as ruby), don't modify the given string, otherwise this will break the test cases. Write your solution by modifying this code: ```python def covfefe(s): ``` Your solution should implemented in the function "covfefe". The i Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [\"10\\njcfdh 1000000\\nchk 1000000\\nkga 1000000\\nbeh 1000000\\ngeg 1000000\\nhaj 1000000\\nagah 1000000\\ndhk 1000000\\nhj 1000000\\ndb 1000000\\n5\\n1000000 1000000 1000000 1000000 1000000\\ndb\\n\", \"5\\nteamc 8\\nteamd 7\\nteame 15\\nteama 3\\nteamb 21\\n3\\n1 2 3\\nteamb\\n\", \"20\\ng 1000000\\nibb 1000000\\nidj 1000000\\nkccg 1000000\\nbbe 1000000\\nhjf 1000000\\na 1000000\\nf 1000000\\nijj 1000000\\nakgf 1000000\\nkdkhj 1000000\\ne 1000000\\nh 1000000\\nhb 1000000\\nfaie 1000000\\nj 1000000\\ni 1000000\\nhgg 1000000\\nfi 1000000\\nicf 1000000\\n12\\n1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000\\na\\n\", \"10\\njcfdh 1000000\\nchk 1000000\\nkga 1000000\\nbeh 1000000\\ngeg 1000000\\nhaj 1000000\\nagah 1000000\\ndhk 1000000\\nhj 1000000\\ndb 1100000\\n5\\n1000000 1000000 1000000 1000000 1000000\\ndb\\n\", \"5\\nteamc 4\\nteamd 7\\nteame 15\\nteama 3\\nteamb 21\\n3\\n1 2 3\\nteamb\\n\", \"10\\njcfdh 1000000\\nchk 1000000\\nkga 1000000\\nbeh 1000000\\ngeg 1000000\\nhaj 1000000\\naagh 1000000\\ndhk 1000000\\nhj 1000000\\ndb 1000000\\n5\\n1000000 1000000 1000000 1000000 1000000\\ndb\\n\", \"20\\ng 1000000\\nibb 1000000\\nidj 1000000\\nkccg 1000000\\nbbe 1000000\\nhjf 1000000\\na 1000000\\nf 1000000\\niij 1000000\\nakgf 1000000\\nkdkhj 1000000\\ne 1000000\\nh 1000000\\nhb 1000000\\nfaie 1000000\\nj 1000000\\ni 1000000\\nhgg 1000000\\nfi 1000000\\nicf 1000000\\n12\\n1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000\\na\\n\", \"10\\njcfdh 1000000\\nchk 1000000\\nagk 1000000\\nbeh 1000000\\ngeg 1000000\\nhaj 1000000\\naagh 1000000\\ndhk 1000000\\nhj 1000000\\ndb 1000000\\n5\\n1000000 1000000 1000000 1000000 1000000\\ndb\\n\", \"10\\njcfdh 1000000\\nchk 1000000\\nkga 1000000\\nbeh 1000000\\ngeg 1000000\\nhja 1000000\\nagah 1000000\\ndhk 1000000\\njh 1000000\\ndb 0100000\\n5\\n1000100 1000000 1000000 1000000 1000000\\ndb\\n\", \"10\\njcfdh 1000000\\nchk 1000000\\nkga 1000000\\nbeh 1000000\\ngeg 1000000\\nhaj 1000000\\nagah 1000000\\ndhk 1000000\\nhj 1000000\\ndb 1100000\\n5\\n1000100 1000000 1000000 1000000 1000000\\ndb\\n\", \"5\\ntaemc 4\\nteamd 7\\nteame 15\\nteama 3\\nteamb 21\\n3\\n1 2 3\\nteamb\\n\", \"10\\njcfdh 1000000\\nchk 1000000\\nkga 1000000\\nbeh 1000000\\ngeg 1000000\\nhaj 1000000\\nagah 1000000\\ndhk 1000000\\nhj 1000000\\ndb 1100000\\n5\\n1000100 1000000 1000000 1001000 1000000\\ndb\\n\", \"5\\ntaemc 4\\nteamd 7\\nteame 15\\nteama 3\\nteamb 21\\n3\\n1 2 6\\nteamb\\n\", \"10\\njcfdh 1000000\\nchk 1000000\\nkga 1000000\\nbeh 1000000\\ngeg 1000000\\nhaj 1000000\\nagah 1000000\\ndhk 1000000\\nhj 1000000\\ndb 1100000\\n5\\n1000100 1000001 1000000 1001000 1000000\\ndb\\n\", \"5\\nteamc 8\\nteamd 7\\nteame 15\\nteama 2\\nteamb 21\\n3\\n1 2 3\\nteamb\\n\", \"10\\njcfdh 1000000\\nchk 1000000\\nkga 1000000\\nbeh 1000000\\ngeg 1000000\\nhaj 1000000\\nagah 1000000\\nehk 1000000\\nhj 1000000\\ndb 1100000\\n5\\n1000000 1000000 1000000 1000000 1000000\\ndb\\n\", \"5\\nteamc 4\\nueamd 7\\nteame 15\\nteama 3\\nteamb 21\\n3\\n1 2 3\\nteamb\\n\", \"10\\njcfdh 1000000\\nchk 1000000\\nkga 1000000\\nbeh 1000000\\ngeg 1000000\\nhaj 1000000\\nagah 1000000\\ndhk 1000000\\njh 1000000\\ndb 1100000\\n5\\n1000100 1000000 1000000 1000000 1000000\\ndb\\n\", \"5\\ntaemc 4\\nueamd 7\\nteame 15\\nteama 3\\nteamb 21\\n3\\n1 2 3\\nteamb\\n\", \"10\\njcfdh 1000100\\nchk 1000000\\nkga 1000000\\nbeh 1000000\\ngeg 1000000\\nhaj 1000000\\nagah 1000000\\ndhk 1000000\\nhj 1000000\\ndb 1100000\\n5\\n1000100 1000000 1000000 1001000 1000000\\ndb\\n\", \"5\\ntaemc 6\\nteamd 7\\nteame 15\\nteama 3\\nteamb 21\\n3\\n1 2 6\\nteamb\\n\", \"10\\njcfdh 1000000\\nchk 1001000\\nkga 1000000\\nbeh 1000000\\ngeg 1000000\\nhaj 1000000\\nagah 1000000\\ndhk 1000000\\nhj 1000000\\ndb 1100000\\n5\\n1000100 1000001 1000000 1001000 1000000\\ndb\\n\", \"10\\njcfdh 1000000\\nchk 1010000\\nkga 1000000\\nbeh 1000000\\ngeg 1000000\\nhaj 1000000\\nagah 1000000\\nehk 1000000\\nhj 1000000\\ndb 1100000\\n5\\n1000000 1000000 1000000 1000000 1000000\\ndb\\n\", \"5\\nteamc 4\\nueamd 7\\nteame 15\\nteama 3\\nteamb 21\\n3\\n1 1 3\\nteamb\\n\", \"10\\njcfdh 1000000\\nchk 1000000\\nkga 1000000\\nbeh 1000000\\ngeg 1000000\\nhja 1000000\\nagah 1000000\\ndhk 1000000\\njh 1000000\\ndb 1100000\\n5\\n1000100 1000000 1000000 1000000 1000000\\ndb\\n\", \"5\\ntaemc 4\\nueamd 7\\nteame 15\\nteama 3\\nteamb 21\\n3\\n1 2 1\\nteamb\\n\", \"10\\njcfdh 1000100\\nchk 1000000\\nkga 1000000\\nbeh 1000000\\ngeg 1000000\\nhaj 1000000\\nagah 1000000\\ndhk 1000000\\njh 1000000\\ndb 1100000\\n5\\n1000100 1000000 1000000 1001000 1000000\\ndb\\n\", \"5\\nuaemc 6\\nteamd 7\\nteame 15\\nteama 3\\nteamb 21\\n3\\n1 2 6\\nteamb\\n\", \"10\\njcfdh 1000000\\nchk 1001000\\nkga 1000000\\nbeh 1000000\\ngeg 1000000\\nhaj 1000000\\nagah 1000000\\ndhk 1000000\\nhj 1000000\\ndb 1100000\\n5\\n1000100 1000001 1000000 1001000 1001000\\ndb\\n\", \"10\\njcfdh 1000000\\nchk 1000000\\nagk 1000000\\nebh 1000000\\ngeg 1000000\\nhaj 1000000\\naagh 1000000\\ndhk 1000000\\nhj 1000000\\ndb 1000000\\n5\\n1000000 1000000 1000000 1000000 1000000\\ndb\\n\", \"10\\njcfdh 1000000\\nkhc 1010000\\nkga 1000000\\nbeh 1000000\\ngeg 1000000\\nhaj 1000000\\nagah 1000000\\nehk 1000000\\nhj 1000000\\ndb 1100000\\n5\\n1000000 1000000 1000000 1000000 1000000\\ndb\\n\", \"5\\nteamc 4\\nueamd 12\\nteame 15\\nteama 3\\nteamb 21\\n3\\n1 1 3\\nteamb\\n\", \"10\\njcfdh 1000000\\nchk 1001000\\nkga 1000000\\nbeh 1000000\\ngef 1000000\\nhaj 1000000\\nagah 1000000\\ndhk 1000000\\nhj 1000000\\ndb 1100000\\n5\\n1000100 1000001 1000000 1001000 1001000\\ndb\\n\", \"10\\njcfdh 1000000\\nchk 1000000\\nagk 1000000\\nebh 1001000\\ngeg 1000000\\nhaj 1000000\\naagh 1000000\\ndhk 1000000\\nhj 1000000\\ndb 1000000\\n5\\n1000000 1000000 1000000 1000000 1000000\\ndb\\n\", \"10\\nhdfcj 1000000\\nkhc 1010000\\nkga 1000000\\nbeh 1000000\\ngeg 1000000\\nhaj 1000000\\nagah 1000000\\nehk 1000000\\nhj 1000000\\ndb 1100000\\n5\\n1000000 1000000 1000000 1000000 1000000\\ndb\\n\", \"10\\njcfdh 1000000\\nchk 1000000\\nkga 1000000\\nbeh 1100000\\ngeg 1000000\\nhja 1000000\\nagah 1000000\\ndhk 1000000\\njh 1000000\\ndb 0100000\\n5\\n1000100 1000000 1000000 1000000 1000000\\ndb\\n\", \"10\\ndcfjh 1000000\\nchk 1000000\\nagk 1000000\\nebh 1001000\\ngeg 1000000\\nhaj 1000000\\naagh 1000000\\ndhk 1000000\\nhj 1000000\\ndb 1000000\\n5\\n1000000 1000000 1000000 1000000 1000000\\ndb\\n\", \"10\\njcfdh 1000000\\nchk 1000000\\nkga 1000000\\nbeh 1100000\\ngeg 1000000\\nhaj 1000000\\nagah 1000000\\ndhk 1000000\\njh 1000000\\ndb 0100000\\n5\\n1000100 1000000 1000000 1000000 1000000\\ndb\\n\", \"10\\ndcfjh 1000000\\nchk 1000000\\nagk 1000000\\nebh 1001000\\ngeg 1000000\\nhaj 1000000\\naagh 1000000\\ndhk 1000000\\nhj 1000000\\ndb 1000000\\n5\\n1000000 1000000 1000000 1000000 1001000\\ndb\\n\", \"10\\ndcfjh 1000000\\nchk 1000000\\nagk 1000000\\nebh 1001000\\ngeg 1000000\\nhaj 1000000\\naagh 1000000\\ndhk 1000000\\nhj 1000000\\ndb 1000000\\n5\\n1000000 1000000 1000000 1000000 1001100\\ndb\\n\", \"10\\ndcfjh 1000000\\nchk 1000000\\nkga 1000000\\nebh 1001000\\ngeg 1000000\\nhaj 1000000\\naagh 1000000\\ndhk 1000000\\nhj 1000000\\ndb 1000000\\n5\\n1000000 1000000 1000000 1000000 1001100\\ndb\\n\", \"10\\ndcfjh 1000000\\nchk 1000000\\nkga 1000000\\nebh 1001000\\ngeg 1000000\\nhaj 1000000\\naagi 1000000\\ndhk 1000000\\nhj 1000000\\ndb 1000000\\n5\\n1000000 1000000 1000000 1000000 1001100\\ndb\\n\", \"10\\ndcfjh 1000000\\nchk 1000000\\nkga 1000000\\nebh 1001000\\ngeg 1000000\\nhaj 1000000\\nagai 1000000\\ndhk 1000000\\nhj 1000000\\ndb 1000000\\n5\\n1000000 1000000 1000000 1000000 1001100\\ndb\\n\", \"10\\ndcfjh 1000000\\nchk 1000000\\nkga 1000000\\nebh 1001000\\ngeg 1000000\\nhaj 1000000\\nagai 1000000\\ndhk 1000000\\nhj 1000010\\ndb 1000000\\n5\\n1000000 1000000 1000000 1000000 1001100\\ndb\\n\", \"10\\njcfdh 1000000\\nchk 1000000\\nkga 1000000\\nbeh 1000000\\ngeg 1000000\\nhaj 1000000\\nagah 1000000\\ndhk 1000000\\nhj 1001000\\ndb 1000000\\n5\\n1000000 1000000 1000000 1000000 1000000\\ndb\\n\", \"5\\nteamc 8\\ntdamd 7\\nteame 15\\nteama 3\\nteamb 21\\n3\\n1 2 3\\nteamb\\n\", \"3\\nteama 10\\nteamb 20\\nteamc 40\\n2\\n10 20\\nteama\\n\", \"2\\nteama 10\\nteamb 10\\n2\\n10 10\\nteamb\\n\"], \"outputs\": [\"1 9\", \"1 1\", \"1 13\", \"1 6\\n\", \"1 1\\n\", \"1 9\\n\", \"1 13\\n\", \"1 10\\n\", \"5 10\\n\", \"1 6\\n\", \"1 1\\n\", \"1 6\\n\", \"1 1\\n\", \"1 6\\n\", \"1 1\\n\", \"1 6\\n\", \"1 1\\n\", \"1 6\\n\", \"1 1\\n\", \"1 6\\n\", \"1 1\\n\", \"1 6\\n\", \"1 6\\n\", \"1 1\\n\", \"1 6\\n\", \"1 1\\n\", \"1 6\\n\", \"1 1\\n\", \"1 6\\n\", \"1 9\\n\", \"1 6\\n\", \"1 1\\n\", \"1 6\\n\", \"1 10\\n\", \"1 6\\n\", \"5 10\\n\", \"1 10\\n\", \"5 10\\n\", \"1 10\\n\", \"1 10\\n\", \"1 9\\n\", \"1 9\\n\", \"1 9\\n\", \"1 10\\n\", \"1 10\\n\", \"1 1\\n\", \"2 3\", \"2 2\"]}", "source": "primeintellect"}
Vasya plays the Need For Brake. He plays because he was presented with a new computer wheel for birthday! Now he is sure that he will win the first place in the championship in his favourite racing computer game! n racers take part in the championship, which consists of a number of races. After each race racers are arranged from place first to n-th (no two racers share the same place) and first m places are awarded. Racer gains bi points for i-th awarded place, which are added to total points, obtained by him for previous races. It is known that current summary score of racer i is ai points. In the final standings of championship all the racers will be sorted in descending order of points. Racers with an equal amount of points are sorted by increasing of the name in lexicographical order. Unfortunately, the championship has come to an end, and there is only one race left. Vasya decided to find out what the highest and lowest place he can take up as a result of the championship. Input The first line contains number n (1 ≤ n ≤ 105) — number of racers. Each of the next n lines contains si and ai — nick of the racer (nonempty string, which consist of no more than 20 lowercase Latin letters) and the racer's points (0 ≤ ai ≤ 106). Racers are given in the arbitrary order. The next line contains the number m (0 ≤ m ≤ n). Then m nonnegative integer numbers bi follow. i-th number is equal to amount of points for the i-th awarded place (0 ≤ bi ≤ 106). The last line contains Vasya's racer nick. Output Output two numbers — the highest and the lowest place Vasya can take up as a result of the championship. Examples Input 3 teama 10 teamb 20 teamc 40 2 10 20 teama Output 2 3 Input 2 teama 10 teamb 10 2 10 10 teamb Output 2 2 Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [[30], [15], [9999], [35353], [100], [1000000243], [142042158218941532125212890], [2679388715912901287113185885289513476], [640614569414659959863091616350016384446719891887887380], [2579111107964987025047536361483312385374008248282655401675211033926782006920415224913494809688581314878892733564]], \"outputs\": [[\"30 is the fouriest (42) in base 7\"], [\"15 is the fouriest (14) in base 11\"], [\"9999 is the fouriest (304444) in base 5\"], [\"35353 is the fouriest (431401) in base 6\"], [\"100 is the fouriest (244) in base 6\"], [\"1000000243 is the fouriest (24x44) in base 149\"], [\"142042158218941532125212890 is the fouriest (14340031300334233041101030243023303030) in base 5\"], [\"2679388715912901287113185885289513476 is the fouriest (444444444444444444) in base 128\"], [\"640614569414659959863091616350016384446719891887887380 is the fouriest (44444444444444444444444444444444) in base 52\"], [\"2579111107964987025047536361483312385374008248282655401675211033926782006920415224913494809688581314878892733564 is the fouriest (4444444444444444444444444444444444444444444444) in base 290\"]]}", "source": "primeintellect"}
# Fourier transformations are hard. Fouriest transformations are harder. This Kata is based on the SMBC Comic on fourier transformations. A fourier transformation on a number is one that converts the number to a base in which it has more `4`s ( `10` in base `6` is `14`, which has `1` four as opposed to none, hence, fourier in base `6` ). A number's fouriest transformation converts it to the base in which it has the most `4`s. For example: `35353` is the fouriest in base `6`: `431401`. This kata requires you to create a method `fouriest` that takes a number and makes it the fouriest, telling us in which base this happened, as follows: ```python fouriest(number) -> "{number} is the fouriest ({fouriest_representation}) in base {base}" ``` ## Important notes * For this kata we don't care about digits greater than `9` ( only `0` to `9` ), so we will represent all digits greater than `9` as `'x'`: `10` in base `11` is `'x'`, `119` in base `20` is `'5x'`, `118` in base `20` is also `'5x'` * When a number has several fouriest representations, we want the one with the LOWEST base ```if:haskell,javascript * Numbers below `9` will not be tested ``` ```if:javascript * A `BigNumber` library has been provided; documentation is [here](https://mikemcl.github.io/bignumber.js/) ``` ## Examples ```python "30 is the fouriest (42) in base 7" "15 is the fouriest (14) in base 11" ``` Write your solution by modifying this code: ```python def fouriest(i): ``` Your solution should implemented in the function "fouriest". The i Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [[\"badpresent\", 3], [\"goodpresent\", 9], [\"crap\", 10], [\"bang\", 27], [\"dog\", 23]], \"outputs\": [[\"Take this back!\"], [\"pxxmy{n|nw}\"], [\"acpr\"], [\"300\"], [\"pass out from excitement 23 times\"]]}", "source": "primeintellect"}
Your colleagues have been good enough(?) to buy you a birthday gift. Even though it is your birthday and not theirs, they have decided to play pass the parcel with it so that everyone has an even chance of winning. There are multiple presents, and you will receive one, but not all are nice... One even explodes and covers you in soil... strange office. To make up for this one present is a dog! Happy days! (do not buy dogs as presents, and if you do, never wrap them). Depending on the number of passes in the game (y), and the present you unwrap (x), return as follows: x == goodpresent --> return x with num of passes added to each charCode (turn to charCode, add y to each, turn back) x == crap || x == empty --> return string sorted alphabetically x == bang --> return string turned to char codes, each code reduced by number of passes and summed to a single figure x == badpresent --> return 'Take this back!' x == dog, return 'pass out from excitement y times' (where y is the value given for y). Write your solution by modifying this code: ```python def present(x,y): ``` Your solution should implemented in the function "present". The i Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [\"3\\n6\\n3 4 5 1 1 2\\n10\\n3 2 9 5 2 9 4 14 7 10\\n8\\n14 5 13 19 17 10 18 12\", \"3\\n6\\n3 4 5 1 1 2\\n10\\n3 2 9 5 2 9 4 14 7 10\\n8\\n9 5 13 19 17 10 18 12\", \"3\\n6\\n3 4 5 1 1 2\\n10\\n3 2 9 5 2 9 4 14 7 10\\n8\\n9 5 13 19 23 10 18 12\", \"3\\n6\\n3 4 5 1 1 2\\n10\\n3 2 9 5 2 3 4 14 7 10\\n8\\n9 5 13 19 23 10 18 12\", \"3\\n6\\n3 4 5 1 1 2\\n10\\n3 2 5 5 2 3 4 14 7 3\\n8\\n9 5 13 19 23 10 18 12\", \"3\\n6\\n3 4 5 2 1 2\\n10\\n3 2 5 5 2 3 4 14 7 3\\n8\\n9 5 13 19 23 10 18 12\", \"3\\n6\\n2 4 5 2 1 2\\n10\\n3 2 5 5 2 3 4 14 7 3\\n8\\n9 5 13 19 23 10 18 12\", \"3\\n6\\n2 4 5 2 1 2\\n10\\n3 2 5 5 2 3 4 14 1 3\\n8\\n9 5 13 19 23 10 18 12\", \"3\\n6\\n2 4 5 0 1 2\\n10\\n3 2 5 5 2 3 4 14 1 3\\n8\\n9 5 13 19 23 10 18 12\", \"3\\n6\\n2 4 5 0 2 2\\n10\\n3 2 5 5 2 3 4 14 1 3\\n8\\n9 5 13 19 23 10 18 12\", \"3\\n6\\n2 4 5 0 2 3\\n10\\n3 2 5 5 2 3 4 14 1 3\\n8\\n9 5 13 19 23 10 18 12\", \"3\\n6\\n2 4 5 0 2 3\\n10\\n3 2 5 5 2 3 4 14 1 3\\n8\\n9 5 13 19 23 10 18 20\", \"3\\n6\\n2 4 5 0 2 3\\n10\\n3 2 5 5 2 3 4 14 1 2\\n8\\n9 5 13 19 23 10 18 20\", \"3\\n6\\n2 4 5 0 2 3\\n10\\n3 2 5 5 2 3 4 14 1 2\\n8\\n9 5 13 19 23 10 31 20\", \"3\\n6\\n2 4 5 0 2 3\\n10\\n3 2 5 5 0 3 4 14 1 2\\n8\\n9 5 13 19 23 10 31 20\", \"3\\n6\\n0 4 5 0 2 3\\n10\\n3 2 5 5 0 3 4 14 1 2\\n8\\n9 5 13 19 23 10 31 20\", \"3\\n6\\n3 4 5 1 1 2\\n10\\n3 2 9 5 0 9 4 14 7 10\\n8\\n9 5 13 19 23 10 18 12\", \"3\\n6\\n3 4 5 1 1 2\\n10\\n3 2 9 5 2 3 4 14 7 10\\n8\\n9 5 13 19 23 10 18 5\", \"3\\n6\\n3 4 5 1 1 2\\n10\\n3 2 5 5 2 3 4 14 7 10\\n8\\n9 5 13 19 23 10 18 8\", \"3\\n6\\n3 4 5 1 1 2\\n10\\n3 2 5 5 3 3 4 14 7 3\\n8\\n9 5 13 19 23 10 18 12\", \"3\\n6\\n2 4 5 2 1 2\\n2\\n3 2 5 5 2 3 4 14 7 3\\n8\\n9 5 13 19 23 10 18 12\", \"3\\n6\\n2 2 5 2 1 2\\n10\\n3 2 5 5 2 3 4 14 1 3\\n8\\n9 5 13 19 23 10 18 12\", \"3\\n6\\n2 4 5 0 1 2\\n10\\n3 2 5 5 2 3 4 14 1 3\\n8\\n9 9 13 19 23 10 18 12\", \"3\\n6\\n2 4 5 0 2 2\\n10\\n3 2 5 5 1 3 4 14 1 3\\n8\\n9 5 13 19 23 10 18 12\", \"3\\n6\\n2 4 5 0 2 3\\n10\\n3 2 5 5 0 3 4 14 1 2\\n7\\n9 5 13 19 23 10 31 20\", \"3\\n6\\n3 4 5 1 1 3\\n10\\n3 2 9 5 0 9 4 14 7 10\\n8\\n9 5 13 19 23 10 18 12\", \"3\\n6\\n3 4 5 1 1 2\\n10\\n3 2 5 5 2 3 8 14 7 10\\n8\\n9 5 13 19 23 10 18 8\", \"3\\n5\\n3 4 5 1 1 2\\n10\\n3 2 5 5 3 3 4 14 7 3\\n8\\n9 5 13 19 23 10 18 12\", \"3\\n6\\n2 4 5 0 1 2\\n10\\n0 2 5 5 2 3 4 14 1 3\\n8\\n9 9 13 19 23 10 18 12\", \"3\\n2\\n2 4 5 0 2 2\\n10\\n3 2 5 5 1 3 4 14 1 3\\n8\\n9 5 13 19 23 10 18 12\", \"3\\n6\\n2 5 5 0 2 3\\n10\\n3 2 5 5 2 0 4 14 1 2\\n8\\n9 5 13 19 23 10 18 20\", \"3\\n6\\n2 4 5 0 2 3\\n10\\n3 2 5 5 2 3 4 25 1 2\\n8\\n9 5 13 19 28 10 31 20\", \"3\\n6\\n0 4 5 0 2 3\\n10\\n3 2 5 5 0 3 4 14 1 2\\n8\\n7 5 4 19 23 10 31 20\", \"3\\n6\\n3 4 5 1 1 3\\n10\\n3 2 9 5 0 9 4 14 7 10\\n8\\n9 5 13 19 39 10 18 12\", \"3\\n6\\n5 4 5 2 1 2\\n10\\n3 2 9 5 2 3 4 14 7 10\\n8\\n9 5 13 19 23 10 18 5\", \"3\\n6\\n3 4 5 1 1 2\\n10\\n3 0 5 5 2 3 8 14 7 10\\n8\\n9 5 13 19 23 10 18 8\", \"3\\n5\\n3 4 5 1 1 2\\n10\\n3 2 5 5 3 3 4 14 7 3\\n8\\n9 5 13 19 23 10 18 10\", \"3\\n6\\n2 4 5 2 2 2\\n2\\n3 2 5 5 2 3 4 14 7 6\\n8\\n9 5 13 19 23 10 18 12\", \"3\\n2\\n2 4 5 0 2 2\\n10\\n3 2 5 5 1 3 4 14 1 3\\n8\\n9 5 13 26 23 10 18 12\", \"3\\n6\\n2 4 5 0 2 3\\n10\\n5 2 5 5 2 3 2 14 1 3\\n8\\n9 5 13 20 23 10 18 12\", \"3\\n4\\n2 4 5 0 2 3\\n10\\n3 2 5 5 2 3 8 14 1 3\\n8\\n9 5 13 31 23 10 18 20\", \"3\\n6\\n2 4 5 0 2 3\\n10\\n3 2 5 5 2 3 4 25 1 2\\n1\\n9 5 13 19 28 10 31 20\", \"3\\n6\\n3 4 5 1 1 2\\n10\\n3 2 9 5 0 9 4 14 7 10\\n8\\n9 5 13 19 39 10 18 12\", \"3\\n6\\n5 4 5 2 1 2\\n10\\n3 2 9 5 2 3 4 3 7 10\\n8\\n9 5 13 19 23 10 18 5\", \"3\\n6\\n3 3 5 2 1 2\\n10\\n3 2 5 6 2 3 4 14 7 3\\n8\\n9 5 22 19 23 10 18 12\", \"3\\n6\\n4 4 5 2 2 2\\n2\\n3 2 5 5 2 3 4 14 7 6\\n8\\n9 5 13 19 23 10 18 12\", \"3\\n5\\n2 2 5 2 2 2\\n10\\n5 2 5 5 2 3 4 14 1 3\\n8\\n9 5 13 19 23 10 18 12\", \"3\\n6\\n2 4 5 0 1 2\\n10\\n0 2 5 9 2 3 4 14 1 3\\n8\\n9 9 13 19 23 8 18 12\", \"3\\n2\\n2 4 5 0 2 2\\n10\\n3 2 5 5 1 0 4 14 1 3\\n8\\n9 5 13 26 23 10 18 12\", \"3\\n6\\n2 4 5 0 2 3\\n10\\n5 2 5 5 2 3 2 14 1 3\\n8\\n9 2 13 20 23 10 18 12\", \"3\\n4\\n2 4 5 0 2 3\\n10\\n3 2 5 5 2 3 8 14 1 3\\n8\\n9 5 13 31 23 10 26 20\", \"3\\n6\\n0 4 1 0 2 3\\n10\\n3 2 5 5 0 3 4 14 1 2\\n8\\n7 5 4 19 2 10 31 20\", \"3\\n6\\n3 4 5 1 1 2\\n10\\n3 2 9 5 0 9 4 14 7 10\\n8\\n9 5 13 19 39 13 18 12\", \"3\\n5\\n3 4 5 1 1 2\\n10\\n3 2 5 5 3 3 4 14 7 5\\n8\\n17 5 13 19 23 10 18 10\", \"3\\n6\\n3 3 5 2 1 2\\n10\\n3 2 5 6 2 3 4 14 14 3\\n8\\n9 5 22 19 23 10 18 12\", \"3\\n5\\n2 2 0 2 2 2\\n10\\n5 2 5 5 2 3 4 14 1 3\\n8\\n9 5 13 19 23 10 18 12\", \"3\\n6\\n2 4 5 0 1 4\\n10\\n0 2 5 9 2 3 4 14 1 3\\n8\\n9 9 13 19 23 8 18 12\", \"3\\n2\\n2 4 5 0 2 2\\n10\\n3 2 5 5 1 0 4 27 1 3\\n8\\n9 5 13 26 23 10 18 12\", \"3\\n6\\n2 4 5 0 2 3\\n10\\n5 2 5 5 2 3 2 14 1 3\\n8\\n9 4 13 20 23 10 18 12\", \"3\\n6\\n0 4 1 0 2 3\\n10\\n3 2 5 5 0 3 4 14 1 2\\n8\\n7 5 4 19 3 10 31 20\", \"3\\n6\\n3 4 5 1 1 2\\n10\\n3 2 9 5 0 9 4 14 7 10\\n8\\n9 5 12 19 39 13 18 12\", \"3\\n6\\n5 4 5 2 1 2\\n10\\n3 2 7 5 1 3 4 3 7 10\\n8\\n9 5 13 19 23 10 18 5\", \"3\\n5\\n5 4 5 1 1 2\\n10\\n3 2 5 5 3 3 4 14 7 5\\n8\\n17 5 13 19 23 10 18 10\", \"3\\n6\\n6 4 5 2 2 2\\n2\\n3 2 5 5 2 3 4 14 7 6\\n8\\n9 5 13 19 44 10 18 12\", \"3\\n5\\n2 2 0 2 2 2\\n10\\n5 2 5 5 2 3 4 14 1 3\\n2\\n9 5 13 19 23 10 18 12\", \"3\\n6\\n2 4 5 -1 2 3\\n10\\n5 2 5 5 2 3 2 14 1 3\\n8\\n9 4 13 20 23 10 18 12\", \"3\\n6\\n2 1 5 0 2 3\\n10\\n3 2 5 5 0 3 4 25 1 2\\n1\\n9 5 13 19 24 10 31 20\", \"3\\n6\\n0 4 1 0 2 3\\n10\\n3 2 5 5 0 3 4 14 1 2\\n8\\n7 5 0 19 3 10 31 20\", \"3\\n6\\n3 4 5 1 1 2\\n10\\n3 2 9 5 0 9 4 14 7 10\\n8\\n9 5 12 19 8 13 18 12\", \"3\\n6\\n5 4 5 2 0 2\\n10\\n3 2 7 5 1 3 4 3 7 10\\n8\\n9 5 13 19 23 10 18 5\", \"3\\n6\\n6 4 5 2 2 2\\n2\\n3 2 5 5 2 3 4 14 7 6\\n8\\n9 3 13 19 44 10 18 12\", \"3\\n6\\n2 1 5 0 0 3\\n10\\n3 2 5 5 0 3 4 25 1 2\\n1\\n9 5 13 19 24 10 31 20\", \"3\\n6\\n0 4 1 0 2 3\\n10\\n3 2 0 5 0 3 4 14 1 2\\n8\\n7 5 0 19 3 10 31 20\", \"3\\n6\\n3 4 5 1 1 2\\n10\\n3 2 9 5 0 9 4 14 7 4\\n8\\n9 5 12 19 8 13 18 12\", \"3\\n6\\n5 4 5 2 0 2\\n10\\n3 2 7 5 1 3 4 3 7 11\\n8\\n9 5 13 19 23 10 18 5\", \"3\\n6\\n3 3 5 2 1 2\\n10\\n3 2 5 6 2 3 4 14 13 3\\n8\\n11 5 22 19 29 10 18 12\", \"3\\n6\\n6 4 5 2 2 2\\n2\\n3 2 5 5 2 3 4 14 7 6\\n8\\n9 3 1 19 44 10 18 12\", \"3\\n5\\n2 2 0 2 2 3\\n10\\n5 2 5 5 2 3 4 18 1 3\\n2\\n9 5 13 19 23 10 18 12\", \"3\\n5\\n8 4 5 1 1 2\\n10\\n3 2 5 5 3 3 4 14 7 5\\n8\\n17 5 13 19 37 10 18 10\", \"3\\n6\\n6 4 0 2 2 2\\n2\\n3 2 5 5 2 3 4 14 7 6\\n8\\n9 3 1 19 44 10 18 12\", \"3\\n6\\n0 4 1 0 2 3\\n10\\n3 2 0 5 0 3 4 14 1 2\\n8\\n7 9 1 19 3 10 31 20\", \"3\\n6\\n5 4 3 2 0 2\\n10\\n3 2 7 5 2 3 4 3 7 11\\n8\\n9 5 13 19 23 10 18 5\", \"3\\n5\\n8 4 5 1 1 2\\n10\\n3 2 5 5 4 3 4 14 7 5\\n8\\n17 5 13 19 37 10 18 10\", \"3\\n5\\n2 2 0 2 2 3\\n10\\n5 2 5 5 2 3 0 18 1 3\\n2\\n9 5 13 19 5 10 18 12\", \"3\\n6\\n4 4 5 0 1 2\\n10\\n0 2 5 6 2 3 5 14 1 3\\n8\\n9 9 13 38 23 8 18 12\", \"3\\n6\\n0 4 1 0 2 3\\n10\\n3 2 0 5 0 3 4 26 1 2\\n8\\n7 9 1 19 3 10 31 20\", \"3\\n6\\n3 4 4 1 1 2\\n10\\n3 2 10 5 0 9 4 14 7 4\\n8\\n5 5 12 19 8 13 18 12\", \"3\\n6\\n5 4 3 2 0 2\\n10\\n3 2 7 5 2 3 4 5 7 11\\n8\\n9 5 13 19 23 10 18 5\", \"3\\n6\\n3 3 5 2 1 2\\n10\\n3 2 5 6 2 3 4 14 6 3\\n8\\n17 5 22 19 29 10 18 12\", \"3\\n6\\n4 4 5 0 1 2\\n10\\n0 2 5 6 0 3 5 14 1 3\\n8\\n9 9 13 38 23 8 18 12\", \"3\\n6\\n0 4 1 0 2 3\\n10\\n3 2 0 5 0 0 4 26 1 2\\n8\\n7 9 1 19 3 10 31 20\", \"3\\n2\\n3 4 4 1 1 2\\n10\\n3 2 10 5 0 9 4 14 7 4\\n8\\n5 5 12 19 8 13 18 12\", \"3\\n6\\n3 3 5 2 1 2\\n10\\n3 2 5 6 2 3 4 14 6 3\\n8\\n17 5 22 19 29 13 18 12\", \"3\\n6\\n6 4 0 2 2 2\\n2\\n3 2 3 5 2 3 4 14 13 6\\n8\\n9 3 1 19 44 10 18 20\", \"3\\n6\\n0 4 1 0 2 4\\n10\\n3 2 0 5 0 0 4 26 1 2\\n8\\n7 9 1 19 3 10 31 20\", \"3\\n2\\n3 4 4 1 1 2\\n10\\n3 2 10 5 0 9 4 14 4 4\\n8\\n5 5 12 19 8 13 18 12\", \"3\\n6\\n3 3 5 4 1 2\\n10\\n3 2 5 6 2 3 4 14 6 3\\n8\\n17 5 22 19 29 13 18 12\", \"3\\n6\\n6 4 0 3 2 2\\n2\\n3 2 3 5 2 3 4 14 13 6\\n8\\n9 3 1 19 44 10 18 20\", \"3\\n6\\n4 4 5 0 1 2\\n10\\n0 2 5 6 0 3 5 14 1 3\\n8\\n9 9 8 25 23 8 18 12\", \"3\\n6\\n0 4 1 0 2 4\\n10\\n3 2 0 5 0 1 4 26 1 2\\n8\\n7 9 1 19 3 10 31 20\", \"3\\n2\\n3 4 4 1 1 2\\n10\\n3 0 10 5 0 9 4 14 4 4\\n8\\n5 5 12 19 8 13 18 12\", \"3\\n6\\n3 4 5 1 1 2\\n10\\n3 2 9 5 2 9 4 14 7 10\\n8\\n14 5 13 19 17 10 18 12\"], \"outputs\": [\"3 1 1 2\\n5 2 2 4 7 10 \\n4 5 10 12 18\", \"3 1 1 2\\n5 2 2 4 7 10\\n4 5 10 12 18\\n\", \"3 1 1 2\\n5 2 2 4 7 10\\n4 5 10 12 23\\n\", \"3 1 1 2\\n6 2 2 3 4 7 10\\n4 5 10 12 23\\n\", \"3 1 1 2\\n5 2 2 3 3 7\\n4 5 10 12 23\\n\", \"3 1 2 5\\n5 2 2 3 3 7\\n4 5 10 12 23\\n\", \"3 1 2 2\\n5 2 2 3 3 7\\n4 5 10 12 23\\n\", \"3 1 2 2\\n5 1 2 3 3 14\\n4 5 10 12 23\\n\", \"3 0 1 2\\n5 1 2 3 3 14\\n4 5 10 12 23\\n\", \"3 0 2 2\\n5 1 2 3 3 14\\n4 5 10 12 23\\n\", \"3 0 2 3\\n5 1 2 3 3 14\\n4 5 10 12 23\\n\", \"3 0 2 3\\n5 1 2 3 3 14\\n4 5 10 18 20\\n\", \"3 0 2 3\\n5 1 2 2 4 14\\n4 5 10 18 20\\n\", \"3 0 2 3\\n5 1 2 2 4 14\\n5 5 10 19 20 31\\n\", \"3 0 2 3\\n4 0 1 2 14\\n5 5 10 19 20 31\\n\", \"4 0 0 2 3\\n4 0 1 2 14\\n5 5 10 19 20 31\\n\", \"3 1 1 2\\n4 0 4 7 10\\n4 5 10 12 23\\n\", \"3 1 1 2\\n6 2 2 3 4 7 10\\n4 5 5 18 23\\n\", \"3 1 1 2\\n6 2 2 3 4 7 10\\n4 5 8 18 23\\n\", \"3 1 1 2\\n5 2 3 3 3 7\\n4 5 10 12 23\\n\", \"3 1 2 2\\n1 2\\n4 5 10 12 23\\n\", \"4 1 2 2 2\\n5 1 2 3 3 14\\n4 5 10 12 23\\n\", \"3 0 1 2\\n5 1 2 3 3 14\\n5 9 9 10 12 23\\n\", \"3 0 2 2\\n4 1 1 3 14\\n4 5 10 12 23\\n\", \"3 0 2 3\\n4 0 1 2 14\\n5 5 10 19 23 31\\n\", \"3 1 1 3\\n4 0 4 7 10\\n4 5 10 12 23\\n\", \"3 1 1 2\\n5 2 2 3 7 10\\n4 5 8 18 23\\n\", \"3 1 1 5\\n5 2 3 3 3 7\\n4 5 10 12 23\\n\", \"3 0 1 2\\n6 0 1 2 3 3 14\\n5 9 9 10 12 23\\n\", \"2 2 4\\n4 1 1 3 14\\n4 5 10 12 23\\n\", \"3 0 2 3\\n4 0 1 2 14\\n4 5 10 18 20\\n\", \"3 0 2 3\\n5 1 2 2 4 25\\n5 5 10 19 20 31\\n\", \"4 0 0 2 3\\n4 0 1 2 14\\n4 4 10 20 31\\n\", \"3 1 1 3\\n4 0 4 7 10\\n4 5 10 12 39\\n\", \"2 1 2\\n6 2 2 3 4 7 10\\n4 5 5 18 23\\n\", \"3 1 1 2\\n5 0 2 3 7 10\\n4 5 8 18 23\\n\", \"3 1 1 5\\n5 2 3 3 3 7\\n4 5 10 10 23\\n\", \"4 2 2 2 2\\n1 2\\n4 5 10 12 23\\n\", \"2 2 4\\n4 1 1 3 14\\n3 5 10 12\\n\", \"3 0 2 3\\n4 1 2 2 3\\n4 5 10 12 23\\n\", \"3 0 4 5\\n5 1 2 3 3 14\\n4 5 10 18 20\\n\", \"3 0 2 3\\n5 1 2 2 4 25\\n1 9\\n\", \"3 1 1 2\\n4 0 4 7 10\\n4 5 10 12 39\\n\", \"2 1 2\\n6 2 2 3 3 7 10\\n4 5 5 18 23\\n\", \"3 1 2 5\\n5 2 2 3 3 7\\n3 5 10 12\\n\", \"3 2 2 2\\n1 2\\n4 5 10 12 23\\n\", \"4 2 2 2 2\\n5 1 2 3 3 14\\n4 5 10 12 23\\n\", \"3 0 1 2\\n6 0 1 2 3 3 14\\n5 8 9 12 18 23\\n\", \"2 2 4\\n4 0 1 3 14\\n3 5 10 12\\n\", \"3 0 2 3\\n4 1 2 2 3\\n4 2 10 12 23\\n\", \"3 0 4 5\\n5 1 2 3 3 14\\n4 5 10 20 26\\n\", \"4 0 0 2 3\\n4 0 1 2 14\\n3 2 10 20\\n\", \"3 1 1 2\\n4 0 4 7 10\\n4 5 12 13 18\\n\", \"3 1 1 5\\n5 2 3 3 4 5\\n4 5 10 10 23\\n\", \"3 1 2 5\\n6 2 2 3 3 14 14\\n3 5 10 12\\n\", \"4 0 2 2 2\\n5 1 2 3 3 14\\n4 5 10 12 23\\n\", \"3 0 1 4\\n6 0 1 2 3 3 14\\n5 8 9 12 18 23\\n\", \"2 2 4\\n4 0 1 3 27\\n3 5 10 12\\n\", \"3 0 2 3\\n4 1 2 2 3\\n4 4 10 12 23\\n\", \"4 0 0 2 3\\n4 0 1 2 14\\n3 3 10 20\\n\", \"3 1 1 2\\n4 0 4 7 10\\n4 5 12 12 18\\n\", \"2 1 2\\n5 1 3 3 7 10\\n4 5 5 18 23\\n\", \"2 1 1\\n5 2 3 3 4 5\\n4 5 10 10 23\\n\", \"3 2 2 2\\n1 2\\n4 5 10 12 44\\n\", \"4 0 2 2 2\\n5 1 2 3 3 14\\n1 5\\n\", \"3 -1 2 3\\n4 1 2 2 3\\n4 4 10 12 23\\n\", \"3 0 2 3\\n4 0 1 2 25\\n1 9\\n\", \"4 0 0 2 3\\n4 0 1 2 14\\n4 0 3 10 20\\n\", \"3 1 1 2\\n4 0 4 7 10\\n4 5 8 12 18\\n\", \"2 0 2\\n5 1 3 3 7 10\\n4 5 5 18 23\\n\", \"3 2 2 2\\n1 2\\n4 3 10 12 44\\n\", \"3 0 0 3\\n4 0 1 2 25\\n1 9\\n\", \"4 0 0 2 3\\n5 0 0 1 2 14\\n4 0 3 10 20\\n\", \"3 1 1 2\\n4 0 4 4 14\\n4 5 8 12 18\\n\", \"2 0 2\\n5 1 3 3 7 11\\n4 5 5 18 23\\n\", \"3 1 2 5\\n5 2 2 3 3 13\\n3 5 10 12\\n\", \"3 2 2 2\\n1 2\\n3 1 10 12\\n\", \"4 0 2 2 2\\n5 1 2 3 3 18\\n1 5\\n\", \"2 1 1\\n5 2 3 3 4 5\\n4 5 10 10 37\\n\", \"4 0 2 2 2\\n1 2\\n3 1 10 12\\n\", \"4 0 0 2 3\\n5 0 0 1 2 14\\n4 1 3 10 20\\n\", \"2 0 2\\n6 2 2 3 3 7 11\\n4 5 5 18 23\\n\", \"2 1 1\\n4 2 3 4 5\\n4 5 10 10 37\\n\", \"4 0 2 2 2\\n4 0 1 3 3\\n1 5\\n\", \"3 0 1 2\\n6 0 1 2 3 3 14\\n4 8 9 12 18\\n\", \"4 0 0 2 3\\n5 0 0 1 2 26\\n4 1 3 10 20\\n\", \"3 1 1 2\\n4 0 4 4 14\\n5 5 5 8 12 18\\n\", \"2 0 2\\n7 2 2 3 4 5 7 11\\n4 5 5 18 23\\n\", \"3 1 2 5\\n5 2 2 3 3 6\\n3 5 10 12\\n\", \"3 0 1 2\\n5 0 0 1 3 14\\n4 8 9 12 18\\n\", \"4 0 0 2 3\\n5 0 0 0 1 2\\n4 1 3 10 20\\n\", \"2 3 4\\n4 0 4 4 14\\n5 5 5 8 12 18\\n\", \"3 1 2 5\\n5 2 2 3 3 6\\n3 5 12 18\\n\", \"4 0 2 2 2\\n1 2\\n4 1 10 18 20\\n\", \"4 0 0 2 4\\n5 0 0 0 1 2\\n4 1 3 10 20\\n\", \"2 3 4\\n4 0 4 4 4\\n5 5 5 8 12 18\\n\", \"3 1 2 4\\n5 2 2 3 3 6\\n3 5 12 18\\n\", \"3 0 2 2\\n1 2\\n4 1 10 18 20\\n\", \"3 0 1 2\\n5 0 0 1 3 14\\n3 8 8 12\\n\", \"4 0 0 2 4\\n5 0 0 1 1 2\\n4 1 3 10 20\\n\", \"2 3 4\\n5 0 0 4 4 4\\n5 5 5 8 12 18\\n\", \"3 1 1 2\\n5 2 2 4 7 10\\n4 5 10 12 18\\n\"]}", "source": "primeintellect"}
Read problems statements in Mandarin Chinese and Russian as well. As every other little boy, Mike has a favorite toy to play with. Mike's favorite toy is a set of N disks. The boy likes to compose his disks in stacks, but there's one very important rule: the disks in a single stack must be ordered by their radiuses in a strictly increasing order such that the top-most disk will have the smallest radius. For example, a stack of disks with radii (5, 2, 1) is valid, while a stack of disks with radii (3, 4, 1) is not. Little Mike has recently come up with the following algorithm after the order of disks are given: First, Mike initiates an empty set of disk stacks. Then, Mike processes the disks in the chosen order using the following pattern: If there is at least one stack such that Mike can put the current disk on the top of the stack without making it invalid, then he chooses the stack with the smallest top disk radius strictly greater than the radius of the current disk, and puts the current disk on top of that stack. Otherwise, Mike makes a new stack containing only the current disk. For example, let's assume that the order of the disk radii is (3, 4, 5, 1, 1, 2). Here's how the set of the top stack disks will appear during the algorithm's run: In the beginning of the algorithm, the set of disk stacks is empty. After processing the first disk, the set of top stack disks is {3}. We cannot put the second disk on the only stack that we have after processing the first disk, so we make a new stack. After processing the second disk, the set of top stack disks is {3, 4}. We cannot put the third disk on any of the available stacks, so we make a new stack. After processing the third disk, the set of top stack disks is {3, 4, 5}. The fourth disk has radius 1, so it can be easily put on any of the available stacks. According to the algorithm, we choose the stack with the top disk radius equal to 3. After processing the fourth disk, the set of top stack disks is {1, 4, 5}. The fifth disk has radius 1, so there are two stacks we can put it on. According to the algorithm, we choose the stack with the top disk radius equal to 4. After processing the fifth disk, the set of top stack disks is {1, 1, 5}. The sixth disk has radius 2, so there is only one stack we can put it on. The final set of top stack disks is {1, 1, 2}. Mike is really excited about his new algorithm, but he has so many disks that it seems impossible to simulate the algorithm manually. You are given an array A of N integers denoting the radii of Mike's disks. The disks are already ordered by Mike. Your task is to find the set of the stack top disk radii after the algorithm is done. ------ Input ------ The first line of the input contains an integer T denoting the number of test cases. The description of T test cases follows. The first line of a test description contains a single integer N. The second line of the description contains N integers denoting A_{1}, ... , A_{N}. ------ Output ------ For each test case, output a single line. The line should start with a positive integer S denoting the number of stacks after the algorithm is done. This should be followed by S integers on the same line denoting the stacks' top disk radii in non-decreasing order. If there are multiple correct answers, you are allowed to output any of them. ------ Constraints ------ $1 ≤ T ≤ 10$ $1 ≤ N ≤ 10^{5}$ $1 ≤ A_{i} ≤ 10^{9}$ ----- Sample Input 1 ------ 3 6 3 4 5 1 1 2 10 3 2 9 5 2 9 4 14 7 10 8 14 5 13 19 17 10 18 12 ----- Sample Output 1 ------ 3 1 1 2 5 2 2 4 7 10 4 5 10 12 18 ----- explanation 1 ------ Test case $1$: This case is already explained in the problem statement. Test case $2$: After processing the first disk, the set of top stack disks are $[3]$. The second disk can be placed on the first stack. Thus, top stack disks are $[2]$. The next $3$ disks can be stacked together. Thus, the top stack disks are $[2, 2]$. The next two disks can be stacked together to get $[2, 2, 4]$. The next two disks can be stacked together to get $[2, 2, 4, 7]$. The last disk can be put on top of the fifth stack. The final stack top are $[2, 2, 4, 7, 10]$. Thus, $5$ stacks are needed. Test case $3$: After processing the first disk, the set of top stack disks are $[14]$. The second disk can be placed on the first stack. Thus, top stack disks are $[5]$. The next disk can be placed on second stack to get $[5, 13]$. The next $2$ disks can be stacked together. Thus, the top stack disks are $[5, 13, 17]$. The next disk can be placed on second stack to get $[5, 10, 17]$. The next disk can be placed on fourth stack to get $[5, 10, 17, 18]$. The last disk can be put on top of the third stack. The final stack top are $[5, 10, 12, 18]$. Thus, $4$ stacks are needed. Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [\"10\\n1 1 1 2 1 1 1 2 2 2\\n\", \"1\\n2\\n\", \"10\\n1 1 1 1 2 2 2 2 2 2\\n\", \"5\\n2 1 1 1 1\\n\", \"4\\n1 1 1 1\\n\", \"5\\n1 2 2 2 2\\n\", \"214\\n1 2 2 1 1 1 2 2 2 2 1 1 1 2 2 2 2 2 2 1 2 1 1 2 2 1 1 2 2 2 2 1 2 2 2 1 1 2 2 2 1 1 2 2 1 2 2 2 1 1 2 1 1 2 1 1 1 2 2 2 2 1 2 2 2 1 2 1 2 1 1 2 2 1 1 2 1 2 2 2 2 2 2 2 1 2 1 2 2 1 2 2 2 1 2 2 1 2 2 1 2 2 2 2 1 2 2 2 1 1 2 2 2 2 2 2 1 2 2 2 2 1 1 1 2 2 2 1 2 1 2 1 1 2 1 1 1 2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 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\n\", \"2 1 2 1 1 1 1 1 1\\n\", \"2 1 2 1 1\\n\"]}", "source": "primeintellect"}
We're giving away nice huge bags containing number tiles! A bag we want to present to you contains n tiles. Each of them has a single number written on it — either 1 or 2. However, there is one condition you must fulfill in order to receive the prize. You will need to put all the tiles from the bag in a sequence, in any order you wish. We will then compute the sums of all prefixes in the sequence, and then count how many of these sums are prime numbers. If you want to keep the prize, you will need to maximize the number of primes you get. Can you win the prize? Hurry up, the bags are waiting! Input The first line of the input contains a single integer n (1 ≤ n ≤ 200 000) — the number of number tiles in the bag. The following line contains n space-separated integers a_1, a_2, ..., a_n (a_i ∈ \{1, 2\}) — the values written on the tiles. Output Output a permutation b_1, b_2, ..., b_n of the input sequence (a_1, a_2, ..., a_n) maximizing the number of the prefix sums being prime numbers. If there are multiple optimal permutations, output any. Examples Input 5 1 2 1 2 1 Output 1 1 1 2 2 Input 9 1 1 2 1 1 1 2 1 1 Output 1 1 1 2 1 1 1 2 1 Note The first solution produces the prefix sums 1, \mathbf{\color{blue}{2}}, \mathbf{\color{blue}{3}}, \mathbf{\color{blue}{5}}, \mathbf{\color{blue}{7}} (four primes constructed), while the prefix sums in the second solution are 1, \mathbf{\color{blue}{2}}, \mathbf{\color{blue}{3}}, \mathbf{\color{blue}{5}}, 6, \mathbf{\color{blue}{7}}, 8, 10, \mathbf{\color{blue}{11}} (five primes). Primes are marked bold and blue. In each of these cases, the number of produced primes is maximum possible. Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [\"76.820252 66.709341\\n61.392328 82.684207\\n44.267775 -2.378694\\n\", \"6.949504 69.606390\\n26.139268 72.136945\\n24.032442 57.407195\\n\", \"36.856072 121.845502\\n46.453956 109.898647\\n-30.047767 77.590282\\n\", \"-7.347450 36.971423\\n84.498728 89.423536\\n75.469963 98.022482\\n\", \"88.653021 18.024220\\n51.942488 -2.527850\\n76.164701 24.553012\\n\", \"1.514204 81.400629\\n32.168797 100.161401\\n7.778734 46.010993\\n\", \"12.272903 101.825792\\n-51.240438 -12.708472\\n-29.729299 77.882032\\n\", \"-46.482632 -31.161247\\n19.689679 -70.646972\\n-17.902656 -58.455808\\n\", \"-18.643272 56.008305\\n9.107608 -22.094058\\n-6.456146 70.308320\\n\", \"18.716839 40.852752\\n66.147248 -4.083161\\n111.083161 43.347248\\n\", \"122.381894 -48.763263\\n163.634346 -22.427845\\n26.099674 73.681862\\n\", \"119.209229 133.905087\\n132.001535 22.179509\\n96.096673 0.539763\\n\", \"55.957968 -72.765994\\n39.787413 -75.942282\\n24.837014 128.144762\\n\", \"34.236058 108.163949\\n28.639345 104.566515\\n25.610069 86.002927\\n\", \"103.967164 63.475916\\n86.466163 59.341930\\n69.260229 73.258917\\n\", \"80.181999 -38.076894\\n23.381778 122.535736\\n47.118815 140.734014\\n\", \"77.145533 85.041789\\n67.452820 52.513188\\n80.503843 85.000149\\n\", \"139.847022 19.153937\\n104.096879 75.379874\\n49.164271 46.404632\\n\", \"93.583067 132.858352\\n63.834975 19.353720\\n33.677824 102.529376\\n\", \"17.288379 68.223317\\n48.776683 71.688379\\n23.170559 106.572762\\n\", \"104.636703 49.583778\\n85.940583 95.426299\\n69.375168 93.234795\\n\", \"25.428124 39.407248\\n17.868098 39.785933\\n11.028461 43.028890\\n\", \"31.312532 151.532355\\n182.646053 56.534075\\n15.953947 127.065925\\n\", \"-56.880888 172.997993\\n81.126977 42.144034\\n-51.413417 17.057807\\n\", \"109.515505 37.575315\\n5.377080 101.729711\\n17.501630 103.324931\\n\", \"51.679280 56.072393\\n-35.819256 73.390532\\n-10.661374 129.756454\\n\", \"35.661751 27.283571\\n96.513550 51.518022\\n97.605986 131.258287\\n\", \"165.094169 94.574129\\n46.867578 147.178855\\n174.685774 62.705213\\n\", \"20.965151 74.716562\\n167.264364 81.864800\\n5.931644 48.813212\\n\", \"28.420253 0.619862\\n10.966628 21.724132\\n14.618862 10.754642\\n\", \"28.718442 36.116251\\n36.734593 35.617015\\n76.193973 99.136077\\n\", \"84.409605 38.496141\\n77.788313 39.553807\\n75.248391 59.413884\\n\", \"-16.356805 109.310423\\n124.529388 25.066276\\n-37.892043 80.604904\\n\", \"129.400249 -44.695226\\n122.278798 -53.696996\\n44.828427 -83.507917\\n\", \"-13.242302 -45.014124\\n-33.825369 51.083964\\n84.512928 -55.134407\\n\", \"40.562163 -47.610606\\n10.073051 -54.490068\\n54.625875 -40.685797\\n\", \"0.376916 17.054676\\n100.187614 85.602831\\n1.425829 132.750915\\n\", \"46.172435 -22.819705\\n17.485134 -1.663888\\n101.027565 111.619705\\n\", \"-21.925928 -24.623076\\n-33.673619 -11.677794\\n4.692348 52.266292\\n\", \"146.604506 -3.502359\\n24.935572 44.589981\\n106.160918 -51.162271\\n\", \"97.326813 61.492460\\n100.982131 57.717635\\n68.385216 22.538372\\n\", \"105.530943 80.920069\\n40.206723 125.323331\\n40.502256 -85.455877\\n\", \"72.873708 -59.083734\\n110.911118 -6.206576\\n-44.292395 13.106202\\n\", \"-20.003518 -4.671086\\n93.588632 6.362759\\n-24.748109 24.792124\\n\", \"115.715093 141.583620\\n136.158119 -23.780834\\n173.673212 64.802787\\n\", \"49.320630 48.119616\\n65.888396 93.514980\\n27.342377 97.600590\\n\", \"71.756151 7.532275\\n-48.634784 100.159986\\n91.778633 158.107739\\n\", \"42.147045 64.165917\\n70.260284 4.962470\\n10.532991 76.277713\\n\", \"80.895061 94.491414\\n42.361631 65.191687\\n77.556800 76.694829\\n\", \"0.000000 0.000000\\n1.000000 1.000000\\n0.000000 1.000000\\n\"], \"outputs\": [\"6503.447626933695\\n\", \"372.09307031987635\\n\", \"5339.3557882968025\\n\", \"8977.833484970313\\n\", \"1452.528513089955\\n\", \"3149.431051257893\\n\", \"24908.67502617584\\n\", \"23949.55216407467\\n\", \"9009.251429090584\\n\", \"4268.879975050851\\n\", \"22182.518984357506\\n\", \"16459.528310930757\\n\", \"32799.66695953821\\n\", \"780.9342627768211\\n\", \"1621.9669769277139\\n\", \"28242.175121024655\\n\", \"1034.7083664592533\\n\", \"7083.2627202884305\\n\", \"10866.493779478897\\n\", \"1505.2799595846766\\n\", \"2632.6875331736164\\n\", \"1152.2133094781955\\n\", \"25712.80489679047\\n\", \"29051.568195010594\\n\", \"25142.855908815025\\n\", \"7441.865442995507\\n\", \"13324.780827104052\\n\", \"32087.470955635552\\n\", \"30115.262801422195\\n\", \"1760.1399761299842\\n\", \"6271.489414840133\\n\", \"438.85759293951406\\n\", \"22719.363428226687\\n\", \"26227.478504758346\\n\", \"16617.239984651296\\n\", \"31224.346506350343\\n\", \"13947.477130657318\\n\", \"16483.23326494948\\n\", \"5669.994350227445\\n\", \"13799.610313821031\\n\", \"1840.5994520719753\\n\", \"36574.646037624385\\n\", \"19244.42729087099\\n\", \"11191.04486039333\\n\", \"24043.740341410277\\n\", \"2437.508955378253\\n\", \"9991.278791809824\\n\", \"14261.922426266443\\n\", \"2386.017904947473\\n\", \"1.0\\n\"]}", "source": "primeintellect"}
Nowadays all circuses in Berland have a round arena with diameter 13 meters, but in the past things were different. In Ancient Berland arenas in circuses were shaped as a regular (equiangular) polygon, the size and the number of angles could vary from one circus to another. In each corner of the arena there was a special pillar, and the rope strung between the pillars marked the arena edges. Recently the scientists from Berland have discovered the remains of the ancient circus arena. They found only three pillars, the others were destroyed by the time. You are given the coordinates of these three pillars. Find out what is the smallest area that the arena could have. Input The input file consists of three lines, each of them contains a pair of numbers –– coordinates of the pillar. Any coordinate doesn't exceed 1000 by absolute value, and is given with at most six digits after decimal point. Output Output the smallest possible area of the ancient arena. This number should be accurate to at least 6 digits after the decimal point. It's guaranteed that the number of angles in the optimal polygon is not larger than 100. Examples Input 0.000000 0.000000 1.000000 1.000000 0.000000 1.000000 Output 1.00000000 Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [\"13\\n\", \"396\\n\", \"998\\n\", \"23333\\n\", \"8\\n\", \"49997\\n\", \"33\\n\", \"5\\n\", \"831\\n\", \"3939\\n\", \"10492\\n\", \"12\\n\", \"30000\\n\", \"20\\n\", \"1000\\n\", \"17\\n\", \"11\\n\", \"10001\\n\", \"49999\\n\", \"10000\\n\", \"14\\n\", \"99\\n\", \"1317\\n\", \"418\\n\", \"985\\n\", \"144\\n\", \"40404\\n\", \"50000\\n\", \"233\\n\", \"5000\\n\", \"9\\n\", \"35000\\n\", \"25252\\n\", \"10\\n\", \"2017\\n\", \"8081\\n\", \"16\\n\", \"39\\n\", \"19\\n\", \"89\\n\", \"39393\\n\", \"6\\n\", \"18\\n\", \"431\\n\", \"45000\\n\", \"20178\\n\", \"172\\n\", \"483\\n\", \"38050\\n\", \"22\\n\", \"1426\\n\", \"4567\\n\", \"18956\\n\", \"16619\\n\", \"32\\n\", \"1010\\n\", \"34\\n\", \"23\\n\", \"10101\\n\", \"11001\\n\", \"21\\n\", \"65\\n\", \"1067\\n\", \"147\\n\", \"263\\n\", \"40836\\n\", \"261\\n\", \"7403\\n\", \"30\\n\", \"41730\\n\", \"29\\n\", \"1574\\n\", \"10732\\n\", \"27\\n\", \"50\\n\", \"35\\n\", \"100\\n\", \"39301\\n\", \"670\\n\", \"35246\\n\", \"43\\n\", \"38\\n\", \"116\\n\", \"41\\n\", \"30242\\n\", \"26\\n\", \"245\\n\", \"2830\\n\", \"37386\\n\", \"11759\\n\", \"46\\n\", \"0010\\n\", \"56\\n\", \"71\\n\", \"00101\\n\", \"4\\n\", \"15\\n\", \"3\\n\", \"7\\n\"], \"outputs\": [\"436904\\n\", \"994574954\\n\", \"452930999\\n\", \"259575428\\n\", \"2988\\n\", \"645043850\\n\", \"823529776\\n\", \"240\\n\", \"418821250\\n\", \"582943734\\n\", \"914991759\\n\", \"174280\\n\", \"583465411\\n\", \"488230244\\n\", \"945359814\\n\", \"24631232\\n\", \"50248\\n\", \"552705744\\n\", \"791828238\\n\", \"938538566\\n\", \"1140888\\n\", \"620067986\\n\", \"414025\\n\", \"57956054\\n\", \"574051668\\n\", \"395837543\\n\", \"618777849\\n\", \"475800099\\n\", \"422271260\\n\", \"148029988\\n\", \"6720\\n\", \"520751787\\n\", \"306102706\\n\", \"26200\\n\", \"222633425\\n\", \"473740780\\n\", \"8348748\\n\", \"302870971\\n\", \"174658944\\n\", \"530141864\\n\", \"929692433\\n\", \"204\\n\", \"64575924\\n\", \"767293469\\n\", \"672059275\\n\", \"207394683\\n\", \"5132966\\n\", \"480523237\\n\", \"20502270\\n\", \"583167773\\n\", \"282544386\\n\", \"151629140\\n\", \"625431166\\n\", \"904251244\\n\", \"59207630\\n\", \"129935752\\n\", \"886871858\\n\", \"599201163\\n\", \"335701728\\n\", \"742424011\\n\", \"282739095\\n\", \"9602112\\n\", \"108458151\\n\", \"668791506\\n\", \"32596934\\n\", \"123373113\\n\", \"232830517\\n\", \"337718760\\n\", \"282515603\\n\", \"240381699\\n\", \"620410921\\n\", \"323670404\\n\", \"735920002\\n\", \"744170002\\n\", \"666518327\\n\", \"80677633\\n\", \"12093833\\n\", \"169916647\\n\", \"970588846\\n\", \"500975235\\n\", \"217455182\\n\", \"659807497\\n\", \"320838587\\n\", \"264211711\\n\", \"234022892\\n\", \"118436480\\n\", \"276077986\\n\", \"933404301\\n\", \"191128496\\n\", \"98577688\\n\", \"658691665\\n\", \"26200\\n\", \"77438780\\n\", \"557378761\\n\", \"822351402\\n\", \"4\\n\", \"3436404\\n\", \"24\\n\", \"1316\\n\"]}", "source": "primeintellect"}
The Floral Clock has been standing by the side of Mirror Lake for years. Though unable to keep time, it reminds people of the passage of time and the good old days. On the rim of the Floral Clock are 2n flowers, numbered from 1 to 2n clockwise, each of which has a colour among all n possible ones. For each colour, there are exactly two flowers with it, the distance between which either is less than or equal to 2, or equals n. Additionally, if flowers u and v are of the same colour, then flowers opposite to u and opposite to v should be of the same colour as well — symmetry is beautiful! Formally, the distance between two flowers is 1 plus the number of flowers on the minor arc (or semicircle) between them. Below is a possible arrangement with n = 6 that cover all possibilities. <image> The beauty of an arrangement is defined to be the product of the lengths of flower segments separated by all opposite flowers of the same colour. In other words, in order to compute the beauty, we remove from the circle all flowers that have the same colour as flowers opposite to them. Then, the beauty is the product of lengths of all remaining segments. Note that we include segments of length 0 in this product. If there are no flowers that have the same colour as flower opposite to them, the beauty equals 0. For instance, the beauty of the above arrangement equals 1 × 3 × 1 × 3 = 9 — the segments are {2}, {4, 5, 6}, {8} and {10, 11, 12}. While keeping the constraints satisfied, there may be lots of different arrangements. Find out the sum of beauty over all possible arrangements, modulo 998 244 353. Two arrangements are considered different, if a pair (u, v) (1 ≤ u, v ≤ 2n) exists such that flowers u and v are of the same colour in one of them, but not in the other. Input The first and only line of input contains a lonely positive integer n (3 ≤ n ≤ 50 000) — the number of colours present on the Floral Clock. Output Output one integer — the sum of beauty over all possible arrangements of flowers, modulo 998 244 353. Examples Input 3 Output 24 Input 4 Output 4 Input 7 Output 1316 Input 15 Output 3436404 Note With n = 3, the following six arrangements each have a beauty of 2 × 2 = 4. <image> While many others, such as the left one in the figure below, have a beauty of 0. The right one is invalid, since it's asymmetric. <image> Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [[\"1,2,3,4,5\"], [\"21,12,23,34,45\"], [\"-1,-2,3,-4,-5\"], [\"1,2,3,,,4,,5,,,\"], [\",,,,,1,2,3,,,4,,5,,,\"], [\"\"], [\",,,,,,,,\"]], \"outputs\": [[[1, 2, 3, 4, 5]], [[21, 12, 23, 34, 45]], [[-1, -2, 3, -4, -5]], [[1, 2, 3, 4, 5]], [[1, 2, 3, 4, 5]], [[]], [[]]]}", "source": "primeintellect"}
Given a string containing a list of integers separated by commas, write the function string_to_int_list(s) that takes said string and returns a new list containing all integers present in the string, preserving the order. For example, give the string "-1,2,3,4,5", the function string_to_int_list() should return [-1,2,3,4,5] Please note that there can be one or more consecutive commas whithout numbers, like so: "-1,-2,,,,,,3,4,5,,6" Write your solution by modifying this code: ```python def string_to_int_list(s): ``` Your solution should implemented in the function "string_to_int_list". The i Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [\"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 3 5\\n838 5 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 5\\n3\\n0 0 5\\n7 3 6\\n16 0 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 5\\n17 28 8\\n27 25 3\\n30 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 3 5\\n838 5 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 5\\n3\\n0 0 5\\n7 3 6\\n16 0 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 5\\n17 28 8\\n27 25 3\\n31 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 3 5\\n838 5 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 5\\n3\\n0 0 9\\n7 3 6\\n16 0 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 5\\n17 28 8\\n27 25 3\\n30 18 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 3 5\\n838 5 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 5\\n3\\n0 0 5\\n7 3 6\\n16 1 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 5\\n17 28 8\\n27 25 3\\n30 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 3 5\\n838 5 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 5\\n3\\n0 0 5\\n7 3 6\\n16 0 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 7\\n17 28 8\\n27 25 3\\n31 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 3 5\\n838 5 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 5\\n3\\n0 0 9\\n7 3 6\\n16 0 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n-1 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 5\\n17 28 8\\n27 25 3\\n30 18 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 3 5\\n838 7 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 5\\n3\\n0 0 5\\n7 3 6\\n16 0 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 7\\n17 28 8\\n27 25 3\\n31 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 3 5\\n838 7 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 5\\n3\\n0 0 5\\n7 3 6\\n16 0 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n16 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 7\\n17 28 8\\n27 25 3\\n31 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 1 5\\n838 7 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 5\\n3\\n0 0 5\\n7 3 6\\n16 0 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n16 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 7\\n17 28 8\\n27 25 3\\n31 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 1 5\\n838 7 5\\n845 7 3\\n849 10 4\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 5\\n3\\n0 0 5\\n7 3 6\\n16 0 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n16 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 7\\n17 28 8\\n27 25 3\\n31 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 1 5\\n838 7 5\\n845 7 3\\n849 10 4\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 5\\n3\\n0 0 5\\n7 5 6\\n16 0 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n16 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 7\\n17 28 8\\n27 25 3\\n31 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 1 5\\n838 7 5\\n845 9 3\\n849 10 4\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 5\\n3\\n0 0 5\\n7 5 6\\n16 0 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n16 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 7\\n17 28 8\\n27 25 3\\n31 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 3 5\\n838 5 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 4\\n3\\n0 0 5\\n7 3 6\\n16 0 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 5\\n17 28 8\\n27 25 3\\n31 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 3 5\\n838 5 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 5\\n3\\n0 0 9\\n7 3 6\\n16 0 5\\n9\\n0 3 5\\n8 0 8\\n19 4 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 5\\n17 28 8\\n27 25 3\\n30 18 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 3 5\\n838 9 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 5\\n3\\n0 0 5\\n7 3 6\\n16 1 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 5\\n17 28 8\\n27 25 3\\n30 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 6\\n832 1 5\\n838 7 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 5\\n3\\n0 0 5\\n7 3 6\\n16 0 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n16 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 7\\n17 28 8\\n27 25 3\\n31 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 1 5\\n838 7 5\\n845 9 3\\n849 10 4\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 5\\n3\\n0 0 5\\n7 5 6\\n16 0 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n16 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n-1 16 5\\n0 24 5\\n3 32 5\\n10 32 7\\n17 28 8\\n27 25 3\\n31 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 3 5\\n838 5 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 5\\n3\\n0 1 6\\n7 3 6\\n16 1 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 7\\n10 32 5\\n17 28 8\\n27 25 3\\n30 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 3 5\\n838 5 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 3\\n3\\n0 0 6\\n8 0 5\\n8 8 5\\n3\\n0 0 9\\n7 3 6\\n16 0 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n-1 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 5\\n17 28 8\\n27 25 3\\n30 18 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 1 6\\n838 7 5\\n845 9 3\\n849 10 4\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 5\\n3\\n0 0 5\\n7 5 6\\n16 0 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n16 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 7\\n17 28 8\\n27 25 3\\n31 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 3 5\\n838 5 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 5\\n3\\n0 0 9\\n7 3 6\\n16 0 5\\n9\\n0 3 5\\n8 0 8\\n19 4 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 1 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 5\\n17 28 8\\n27 25 3\\n30 18 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 3 5\\n838 9 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 3\\n3\\n1 0 5\\n8 0 5\\n8 8 5\\n3\\n0 0 5\\n7 3 6\\n16 1 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 5\\n17 28 8\\n27 25 3\\n30 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 6\\n832 1 5\\n838 7 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 15 3\\n3\\n0 0 5\\n8 0 5\\n8 8 5\\n3\\n0 0 5\\n7 3 6\\n16 0 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n16 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 7\\n17 28 8\\n27 25 3\\n31 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 3 5\\n838 5 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 5\\n3\\n0 0 5\\n7 3 6\\n16 0 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n23 14 6\\n23 21 8\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n1 32 5\\n10 32 5\\n17 28 8\\n27 25 3\\n30 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 0 4\\n826 1 4\\n832 3 5\\n838 5 5\\n845 7 3\\n849 10 3\\n853 15 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 5\\n3\\n0 0 6\\n7 3 6\\n16 1 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 5\\n17 28 8\\n27 25 3\\n30 28 5\\n0\", \"10\\n802 0 11\\n814 0 4\\n820 1 4\\n826 1 4\\n832 3 5\\n838 5 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 3\\n3\\n-1 0 5\\n8 0 5\\n8 8 4\\n3\\n0 0 5\\n7 3 6\\n16 0 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 5\\n17 28 8\\n27 25 3\\n31 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 3 5\\n838 5 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 5\\n3\\n0 0 5\\n7 3 6\\n16 0 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 5\\n17 28 8\\n27 25 3\\n30 31 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 3 5\\n838 5 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 5\\n3\\n0 0 5\\n7 3 6\\n16 0 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 29 5\\n10 32 5\\n17 28 8\\n27 25 3\\n30 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 0 4\\n832 3 5\\n838 5 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 5\\n3\\n0 0 5\\n7 3 6\\n16 1 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 5\\n17 28 8\\n27 25 3\\n30 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 3 5\\n838 5 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 5\\n3\\n0 0 5\\n7 3 6\\n16 0 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n23 14 6\\n23 21 6\\n26 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 7\\n17 28 8\\n27 25 3\\n31 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 3 5\\n838 5 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 5\\n3\\n0 0 9\\n7 3 6\\n16 0 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n-1 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 6\\n3 32 5\\n10 32 5\\n17 28 8\\n27 25 3\\n30 18 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 3 5\\n838 5 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 3\\n3\\n0 0 6\\n7 3 6\\n16 1 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 5\\n17 28 8\\n27 25 3\\n30 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 1 5\\n838 7 5\\n845 7 3\\n849 10 4\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 5\\n3\\n0 0 5\\n7 3 6\\n16 0 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n16 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 12 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 7\\n17 28 8\\n27 25 3\\n31 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 1 5\\n838 7 5\\n845 7 3\\n849 10 4\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 1 5\\n8 8 5\\n3\\n0 0 5\\n7 5 6\\n16 0 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n16 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 7\\n17 28 8\\n27 25 3\\n31 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 1 5\\n838 7 5\\n845 9 3\\n849 10 4\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 5\\n0\\n0 0 5\\n7 5 6\\n16 0 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n16 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 7\\n17 28 8\\n27 25 3\\n31 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 3 5\\n838 5 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 -1 5\\n8 8 4\\n3\\n0 0 5\\n7 3 6\\n16 0 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 5\\n17 28 8\\n27 25 3\\n31 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 3 5\\n838 9 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 5\\n3\\n0 0 5\\n7 3 6\\n16 1 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n-1 24 5\\n3 32 5\\n10 32 5\\n17 28 8\\n27 25 3\\n30 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 5\\n826 1 4\\n832 3 5\\n838 5 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 5\\n3\\n0 1 6\\n7 3 6\\n16 1 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 7\\n10 32 5\\n17 28 8\\n27 25 3\\n30 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 0 4\\n826 1 4\\n832 3 5\\n838 5 5\\n845 7 3\\n849 10 3\\n853 15 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 5\\n3\\n0 0 6\\n7 3 6\\n16 1 5\\n9\\n0 0 5\\n8 0 8\\n19 2 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 5\\n17 28 8\\n27 25 3\\n30 28 5\\n0\", \"10\\n802 0 11\\n814 0 4\\n820 1 4\\n826 1 4\\n832 3 5\\n838 5 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 3\\n3\\n-1 0 5\\n8 0 5\\n8 8 4\\n3\\n0 0 5\\n7 3 6\\n16 0 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n0\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 5\\n17 28 8\\n27 25 3\\n31 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 3 5\\n838 5 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 5\\n3\\n0 0 5\\n7 3 6\\n16 0 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n23 14 10\\n23 21 6\\n26 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 7\\n17 28 8\\n27 25 3\\n31 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 3 5\\n838 5 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 5\\n3\\n0 0 9\\n7 3 6\\n16 0 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n-1 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 6\\n3 32 5\\n10 32 5\\n17 28 8\\n27 25 4\\n30 18 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 1 5\\n838 7 5\\n845 9 3\\n849 10 4\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n12 8 5\\n0\\n0 0 5\\n7 5 6\\n16 0 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n16 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 7\\n17 28 8\\n27 25 3\\n31 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 3 5\\n838 5 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 -1 5\\n8 8 4\\n3\\n0 0 5\\n7 3 6\\n16 0 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 1 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 5\\n17 28 8\\n27 25 3\\n31 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 3 5\\n838 9 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 5\\n3\\n0 0 5\\n7 3 6\\n16 1 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 7\\n0 16 5\\n-1 24 5\\n3 32 5\\n10 32 5\\n17 28 8\\n27 25 3\\n30 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 0 4\\n826 1 4\\n832 3 5\\n838 5 5\\n845 7 3\\n849 10 3\\n853 15 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 2 5\\n3\\n0 0 6\\n7 3 6\\n16 1 5\\n9\\n0 0 5\\n8 0 8\\n19 2 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 5\\n17 28 8\\n27 25 3\\n30 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 3 5\\n838 5 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 5\\n3\\n0 0 5\\n7 3 6\\n16 0 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n23 14 10\\n23 21 6\\n26 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n4 32 5\\n10 32 7\\n17 28 8\\n27 25 3\\n31 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 3 5\\n838 5 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 3\\n3\\n0 1 5\\n8 0 5\\n8 8 5\\n3\\n0 0 9\\n7 3 6\\n16 0 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n-1 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 6\\n3 32 5\\n10 32 5\\n17 28 8\\n27 25 4\\n30 18 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 3 5\\n838 5 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 -1 5\\n8 8 4\\n3\\n1 0 5\\n7 3 6\\n16 0 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 1 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 5\\n17 28 8\\n27 25 3\\n31 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 0 4\\n826 1 4\\n832 3 5\\n838 5 5\\n845 7 3\\n849 10 3\\n853 15 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 2 5\\n3\\n0 0 6\\n7 3 6\\n16 1 5\\n9\\n0 0 5\\n8 0 8\\n19 2 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n7 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 5\\n17 28 8\\n27 25 3\\n30 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 3 5\\n838 5 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 5\\n3\\n0 0 5\\n7 3 6\\n16 0 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n23 14 10\\n23 21 6\\n26 28 6\\n19 40 8\\n8 42 8\\n-1 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n4 32 5\\n10 32 7\\n17 28 8\\n27 25 3\\n31 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 0 4\\n826 1 4\\n832 3 5\\n838 5 5\\n845 7 3\\n849 10 3\\n853 15 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 2 5\\n3\\n0 0 6\\n7 3 6\\n16 1 5\\n9\\n0 0 5\\n7 0 8\\n19 2 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n7 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 5\\n17 28 8\\n27 25 3\\n30 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 3 5\\n838 5 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 2\\n3\\n0 1 5\\n8 0 5\\n8 8 5\\n3\\n0 0 12\\n7 3 6\\n16 0 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n-1 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 5\\n17 28 8\\n27 25 4\\n30 18 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 3 5\\n838 5 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 2\\n3\\n0 1 5\\n8 0 5\\n8 8 5\\n3\\n0 0 12\\n7 3 6\\n16 0 5\\n9\\n0 1 5\\n8 0 8\\n19 2 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n-1 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 5\\n17 28 8\\n27 25 4\\n30 18 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 3 5\\n838 5 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 2\\n3\\n0 1 5\\n8 1 5\\n8 8 5\\n3\\n0 0 12\\n7 3 6\\n16 0 5\\n9\\n0 1 5\\n8 0 8\\n19 2 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n-1 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 5\\n17 28 8\\n27 25 4\\n30 18 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 3 5\\n838 5 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 5\\n3\\n0 0 5\\n7 3 6\\n16 0 5\\n9\\n0 3 5\\n6 0 8\\n19 2 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 5\\n17 28 8\\n27 25 3\\n30 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 3 5\\n838 5 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 5\\n3\\n0 0 5\\n7 3 6\\n16 1 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 4\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 5\\n17 28 8\\n27 25 3\\n30 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 3 5\\n838 5 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 5\\n3\\n0 0 6\\n7 3 6\\n16 1 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 4\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 5\\n17 28 8\\n27 25 3\\n30 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 3 5\\n838 7 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 5\\n3\\n0 -1 5\\n7 3 6\\n16 0 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n16 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 7\\n17 28 8\\n27 25 3\\n31 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 1 5\\n838 7 5\\n845 7 3\\n849 10 4\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 5\\n3\\n0 0 5\\n7 3 6\\n16 0 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n16 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n1 16 5\\n0 24 5\\n3 32 5\\n10 32 7\\n17 28 8\\n27 25 3\\n31 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 1 5\\n838 7 5\\n845 9 3\\n849 10 4\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 5\\n3\\n0 0 5\\n7 5 6\\n16 0 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n16 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 15 5\\n0 24 5\\n3 32 5\\n10 32 7\\n17 28 8\\n27 25 3\\n31 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 3 5\\n838 5 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 5\\n3\\n0 1 6\\n7 3 6\\n16 1 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 29 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 5\\n17 28 8\\n27 25 3\\n30 28 5\\n0\", \"10\\n802 0 11\\n814 0 4\\n820 1 4\\n826 1 4\\n832 3 5\\n838 5 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 4\\n3\\n0 0 5\\n7 3 6\\n16 0 5\\n9\\n0 3 5\\n8 0 8\\n18 2 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 5\\n17 28 8\\n27 25 3\\n31 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 0 4\\n826 1 4\\n832 3 5\\n838 5 5\\n845 7 3\\n849 10 3\\n853 15 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 5\\n3\\n0 0 6\\n7 3 6\\n16 1 5\\n9\\n1 3 5\\n8 0 8\\n19 2 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 5\\n17 28 8\\n27 25 3\\n30 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 3 5\\n838 5 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 3\\n3\\n0 0 4\\n8 0 5\\n8 8 5\\n3\\n0 0 5\\n7 3 6\\n16 0 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 5\\n17 28 8\\n27 25 3\\n30 31 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 3 5\\n838 6 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 5\\n3\\n0 0 5\\n7 3 6\\n16 0 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 29 5\\n10 32 5\\n17 28 8\\n27 25 3\\n30 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 3 5\\n838 5 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 3\\n3\\n0 0 6\\n7 3 6\\n16 1 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 18 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 5\\n17 28 8\\n27 25 3\\n30 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 3 5\\n838 9 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 5\\n3\\n0 0 5\\n7 3 6\\n16 1 5\\n9\\n0 3 5\\n8 0 8\\n19 2 11\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n-1 24 5\\n3 32 5\\n10 32 5\\n17 28 8\\n27 25 3\\n30 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 3 5\\n838 9 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 5\\n3\\n0 0 5\\n7 3 6\\n16 1 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 7\\n0 16 5\\n-1 24 5\\n3 32 5\\n10 36 5\\n17 28 8\\n27 25 3\\n30 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 0 4\\n826 1 4\\n832 3 5\\n838 5 5\\n845 7 3\\n849 10 3\\n853 15 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 2 5\\n3\\n0 0 6\\n7 3 6\\n16 1 5\\n9\\n0 0 5\\n8 0 8\\n19 4 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 5\\n17 28 8\\n27 25 3\\n30 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 6\\n832 3 5\\n838 5 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 -1 5\\n8 8 4\\n3\\n1 0 5\\n7 3 6\\n16 0 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 1 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 5\\n17 28 8\\n27 25 3\\n31 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 3 5\\n838 9 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 5\\n3\\n-1 0 5\\n7 3 6\\n16 1 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 8\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 7\\n0 16 5\\n-1 24 5\\n3 32 5\\n10 32 5\\n17 28 8\\n27 25 3\\n30 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 3 5\\n838 5 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 5\\n3\\n0 0 5\\n7 3 6\\n16 0 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n23 14 10\\n23 21 6\\n26 28 6\\n19 40 8\\n8 42 8\\n-1 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n9 16 5\\n0 16 5\\n0 24 5\\n4 32 5\\n10 32 7\\n17 28 8\\n27 25 3\\n31 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 0 4\\n826 1 4\\n832 3 5\\n838 5 5\\n845 7 3\\n849 10 3\\n853 15 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 2 5\\n3\\n0 0 6\\n7 3 6\\n16 1 5\\n9\\n0 0 5\\n7 0 8\\n19 2 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n7 16 5\\n0 16 5\\n-1 24 5\\n3 32 5\\n10 32 5\\n17 28 8\\n27 25 3\\n30 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 8\\n826 1 4\\n832 3 5\\n838 5 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 2\\n3\\n0 1 5\\n8 0 5\\n8 8 5\\n3\\n0 0 12\\n7 3 6\\n16 0 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n-1 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 5\\n17 28 8\\n27 25 4\\n30 18 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 3 5\\n838 5 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 2\\n3\\n0 1 5\\n8 1 5\\n8 8 5\\n3\\n0 0 12\\n7 3 6\\n16 0 5\\n9\\n0 1 5\\n8 0 8\\n19 2 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n-1 0 5\\n8 0 8\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 5\\n17 28 8\\n27 25 4\\n30 18 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 1 5\\n838 7 5\\n845 7 3\\n849 10 4\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 5\\n3\\n0 0 5\\n7 3 6\\n16 0 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n16 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 11\\n8 16 5\\n1 16 5\\n0 24 5\\n3 32 5\\n10 32 7\\n17 28 8\\n27 25 3\\n31 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 5 5\\n838 5 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 4\\n3\\n0 0 5\\n7 3 6\\n16 0 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 -1 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 5\\n17 28 8\\n27 25 3\\n31 28 5\\n0\", \"10\\n802 0 11\\n814 0 4\\n820 1 4\\n826 1 4\\n832 3 5\\n838 5 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 3\\n3\\n0 -1 5\\n8 0 5\\n8 8 4\\n3\\n0 0 5\\n7 3 6\\n16 0 5\\n9\\n0 3 5\\n8 0 8\\n18 2 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 5\\n17 28 8\\n27 25 3\\n31 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 3 5\\n838 9 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 5\\n3\\n0 0 5\\n7 3 6\\n16 1 5\\n9\\n-1 3 5\\n8 0 8\\n19 2 11\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n-1 24 5\\n3 32 5\\n10 32 5\\n17 28 8\\n27 25 3\\n30 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 6\\n832 3 5\\n838 5 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 -1 5\\n8 8 4\\n3\\n1 0 5\\n7 3 6\\n16 0 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n17 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 1 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 5\\n17 28 8\\n27 25 3\\n31 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 0 4\\n826 1 4\\n832 3 8\\n838 5 5\\n845 7 3\\n849 10 3\\n853 15 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 2 5\\n3\\n0 0 6\\n7 3 6\\n16 1 5\\n9\\n0 0 5\\n8 0 8\\n19 2 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n7 16 5\\n0 16 5\\n1 24 5\\n3 32 5\\n10 32 5\\n17 28 8\\n27 25 3\\n30 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 1 5\\n838 7 5\\n845 9 3\\n849 10 4\\n853 14 4\\n857 18 3\\n3\\n-1 0 5\\n8 0 5\\n12 8 5\\n0\\n0 0 5\\n7 10 6\\n16 0 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n16 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 8\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 45 7\\n17 28 8\\n27 25 3\\n31 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 8\\n826 1 4\\n832 3 5\\n838 5 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 2\\n3\\n0 1 5\\n8 0 5\\n8 8 5\\n3\\n0 0 12\\n7 3 6\\n16 0 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n23 14 5\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n-1 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 5\\n17 28 8\\n27 25 4\\n30 18 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 3 5\\n838 5 5\\n845 7 3\\n849 10 5\\n853 14 4\\n857 18 2\\n3\\n0 1 5\\n8 1 5\\n8 8 5\\n3\\n0 0 12\\n7 3 6\\n16 0 5\\n9\\n0 1 5\\n8 0 8\\n19 2 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n-1 0 5\\n8 0 8\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 5\\n17 28 8\\n27 25 4\\n30 18 5\\n0\", \"10\\n802 0 11\\n814 0 4\\n820 1 4\\n826 1 4\\n832 3 5\\n838 5 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 3\\n3\\n0 -1 5\\n8 0 5\\n8 8 4\\n3\\n0 0 5\\n7 3 6\\n16 0 5\\n9\\n0 3 5\\n8 0 8\\n18 2 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 15 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 5\\n17 28 8\\n27 25 3\\n31 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 0 4\\n826 1 4\\n832 3 8\\n838 5 5\\n845 7 3\\n849 10 3\\n853 15 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 2 5\\n3\\n0 0 6\\n7 3 6\\n16 1 5\\n9\\n0 0 5\\n9 0 8\\n19 2 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n7 16 5\\n0 16 5\\n1 24 5\\n3 32 5\\n10 32 5\\n17 28 8\\n27 25 3\\n30 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 0 5\\n838 7 5\\n845 9 3\\n849 10 4\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 5\\n0\\n0 0 5\\n7 5 6\\n16 0 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n16 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 10\\n0 39 5\\n3\\n0 0 7\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 10\\n17 28 8\\n27 25 3\\n31 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 3 5\\n838 5 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 5\\n3\\n0 0 9\\n7 3 6\\n16 0 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n0 32 5\\n10 32 5\\n17 28 8\\n27 25 3\\n30 18 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 3 5\\n838 5 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n13 8 5\\n3\\n0 0 5\\n7 3 6\\n16 1 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 5\\n17 28 8\\n27 25 3\\n30 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 3 5\\n838 5 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 3\\n3\\n0 1 5\\n8 0 5\\n8 8 5\\n3\\n0 0 9\\n7 3 6\\n16 0 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n-1 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 5\\n17 28 8\\n27 25 3\\n30 18 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 3 5\\n838 7 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 5\\n3\\n1 0 5\\n7 3 6\\n16 0 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 7\\n17 28 8\\n27 25 3\\n31 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 1 5\\n838 7 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 5\\n3\\n0 0 5\\n7 3 6\\n16 0 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n17 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 7\\n17 28 8\\n27 25 3\\n31 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 1 5\\n838 7 5\\n845 8 3\\n849 10 4\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 5\\n3\\n0 0 5\\n7 3 6\\n16 0 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n16 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 7\\n17 28 8\\n27 25 3\\n31 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 5\\n832 1 5\\n838 7 5\\n845 9 3\\n849 10 4\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 5\\n3\\n0 0 5\\n7 5 6\\n16 0 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n16 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 7\\n17 28 8\\n27 25 3\\n31 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 3 5\\n838 5 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 4\\n3\\n0 0 5\\n7 3 6\\n16 0 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n1 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 5\\n17 28 8\\n27 25 3\\n31 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 3 5\\n838 5 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 5\\n3\\n0 1 6\\n7 3 6\\n16 1 5\\n9\\n-1 3 5\\n8 0 8\\n19 2 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 7\\n10 32 5\\n17 28 8\\n27 25 3\\n30 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 1 6\\n838 7 5\\n845 9 3\\n849 10 4\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 5\\n3\\n0 0 5\\n7 5 6\\n16 0 5\\n9\\n0 3 5\\n8 0 8\\n10 2 8\\n16 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 7\\n17 28 8\\n27 25 3\\n31 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 3 5\\n838 5 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 5\\n3\\n0 0 5\\n7 3 6\\n16 0 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 4\\n10 32 5\\n17 28 8\\n27 25 3\\n30 31 5\\n0\", \"10\\n802 -1 10\\n814 0 4\\n820 1 4\\n826 0 4\\n832 3 5\\n838 5 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 5\\n3\\n0 0 5\\n7 3 6\\n16 1 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 5\\n17 28 8\\n27 25 3\\n30 28 5\\n0\", \"10\\n802 0 10\\n814 0 4\\n820 1 4\\n826 1 4\\n832 3 5\\n838 5 5\\n845 7 3\\n849 10 3\\n853 14 4\\n857 18 3\\n3\\n0 0 5\\n8 0 5\\n8 8 5\\n3\\n0 0 5\\n7 3 6\\n16 0 5\\n9\\n0 3 5\\n8 0 8\\n19 2 8\\n23 14 6\\n23 21 6\\n23 28 6\\n19 40 8\\n8 42 8\\n0 39 5\\n11\\n0 0 5\\n8 0 5\\n18 8 10\\n8 16 5\\n0 16 5\\n0 24 5\\n3 32 5\\n10 32 5\\n17 28 8\\n27 25 3\\n30 18 5\\n0\"], \"outputs\": [\"58.953437\\n11.414214\\n16.000000\\n61.874812\\n60.027817\\n\", \"58.953437\\n11.414214\\n16.000000\\n61.874812\\n61.017457\\n\", \"58.953437\\n11.414214\\n16.000000\\n61.874812\\n63.195179\\n\", \"58.953437\\n11.414214\\n16.031220\\n61.874812\\n60.027817\\n\", \"58.953437\\n11.414214\\n16.000000\\n61.874812\\n60.681248\\n\", \"58.953437\\n11.414214\\n16.000000\\n61.874812\\n64.074377\\n\", \"58.835876\\n11.414214\\n16.000000\\n61.874812\\n60.681248\\n\", \"58.835876\\n11.414214\\n16.000000\\n59.457061\\n60.681248\\n\", \"58.894288\\n11.414214\\n16.000000\\n59.457061\\n60.681248\\n\", \"58.737915\\n11.414214\\n16.000000\\n59.457061\\n60.681248\\n\", \"58.737915\\n11.414214\\n16.044976\\n59.457061\\n60.681248\\n\", \"58.523500\\n11.414214\\n16.044976\\n59.457061\\n60.681248\\n\", \"58.953437\\n11.502385\\n16.000000\\n61.874812\\n61.017457\\n\", \"58.953437\\n11.414214\\n16.000000\\n59.943920\\n63.195179\\n\", \"58.835261\\n11.414214\\n16.031220\\n61.874812\\n60.027817\\n\", \"58.847876\\n11.414214\\n16.000000\\n59.457061\\n60.681248\\n\", \"58.523500\\n11.414214\\n16.044976\\n59.457061\\n61.137943\\n\", \"58.953437\\n11.414214\\n16.000000\\n61.874812\\n57.751931\\n\", \"58.953437\\n11.403142\\n16.000000\\n61.874812\\n64.074377\\n\", \"58.393774\\n11.414214\\n16.044976\\n59.457061\\n60.681248\\n\", \"58.953437\\n11.414214\\n16.000000\\n59.943920\\n62.728173\\n\", \"58.835261\\n10.656854\\n16.031220\\n61.874812\\n60.027817\\n\", \"57.299019\\n11.414214\\n16.000000\\n59.457061\\n60.681248\\n\", \"58.953437\\n11.414214\\n16.000000\\n61.874812\\n61.770593\\n\", \"58.986625\\n11.414214\\n16.031220\\n61.874812\\n60.027817\\n\", \"58.953437\\n12.421121\\n16.000000\\n61.874812\\n61.017457\\n\", \"58.953437\\n11.414214\\n16.000000\\n61.874812\\n61.249151\\n\", \"58.953437\\n11.414214\\n16.000000\\n61.874812\\n57.684784\\n\", \"59.006196\\n11.414214\\n16.031220\\n61.874812\\n60.027817\\n\", \"58.953437\\n11.414214\\n16.000000\\n66.081209\\n60.681248\\n\", \"58.953437\\n11.414214\\n16.000000\\n61.874812\\n63.094994\\n\", \"58.953437\\n12.433981\\n16.031220\\n61.874812\\n60.027817\\n\", \"58.737915\\n11.414214\\n16.000000\\n59.457061\\n60.136547\\n\", \"58.737915\\n11.317217\\n16.044976\\n59.457061\\n60.681248\\n\", \"58.523500\\n11.414214\\n\", \"58.953437\\n12.944272\\n16.000000\\n61.874812\\n61.017457\\n\", \"58.835261\\n11.414214\\n16.031220\\n61.874812\\n61.030895\\n\", \"58.945137\\n11.414214\\n16.000000\\n61.874812\\n57.751931\\n\", \"58.986625\\n11.414214\\n16.031220\\n63.009764\\n60.027817\\n\", \"58.953437\\n12.421121\\n16.000000\\n61.874812\\n\", \"58.953437\\n11.414214\\n16.000000\\n64.287268\\n60.681248\\n\", \"58.953437\\n11.414214\\n16.000000\\n61.874812\\n62.426596\\n\", \"58.523500\\n14.433981\\n\", \"58.953437\\n12.944272\\n16.000000\\n61.874812\\n60.550451\\n\", \"58.835261\\n11.414214\\n16.031220\\n61.874812\\n60.585844\\n\", \"58.986625\\n8.246211\\n16.031220\\n63.009764\\n60.027817\\n\", \"58.953437\\n11.414214\\n16.000000\\n64.287268\\n60.507368\\n\", \"58.953437\\n10.848421\\n16.000000\\n61.874812\\n62.426596\\n\", \"58.953437\\n12.944272\\n15.000000\\n61.874812\\n60.550451\\n\", \"58.986625\\n8.246211\\n16.031220\\n63.009764\\n60.100036\\n\", \"58.953437\\n11.414214\\n16.000000\\n65.251041\\n60.507368\\n\", \"58.986625\\n8.246211\\n16.031220\\n63.023075\\n60.100036\\n\", \"58.953437\\n10.848421\\n16.000000\\n61.874812\\n63.405979\\n\", \"58.953437\\n10.848421\\n16.000000\\n62.568989\\n63.405979\\n\", \"58.953437\\n10.656854\\n16.000000\\n62.568989\\n63.405979\\n\", \"58.953437\\n11.414214\\n16.000000\\n62.109487\\n60.027817\\n\", \"58.953437\\n11.414214\\n16.031220\\n61.874812\\n60.990730\\n\", \"58.953437\\n11.414214\\n16.031220\\n63.513538\\n60.027817\\n\", \"58.835876\\n11.414214\\n16.031220\\n59.457061\\n60.681248\\n\", \"58.737915\\n11.414214\\n16.000000\\n59.457061\\n60.373559\\n\", \"58.523500\\n11.414214\\n16.044976\\n59.457061\\n61.363634\\n\", \"58.953437\\n11.414214\\n16.000000\\n62.097348\\n60.027817\\n\", \"58.953437\\n11.502385\\n16.000000\\n61.785821\\n61.017457\\n\", \"58.986625\\n11.414214\\n16.031220\\n60.917880\\n60.027817\\n\", \"58.953437\\n11.502385\\n16.000000\\n61.874812\\n61.249151\\n\", \"58.859528\\n11.414214\\n16.000000\\n61.874812\\n57.684784\\n\", \"58.953437\\n12.433981\\n16.031220\\n61.874812\\n61.148003\\n\", \"58.835261\\n11.414214\\n16.031220\\n58.995744\\n61.030895\\n\", \"58.835261\\n11.414214\\n16.031220\\n61.874812\\n62.472962\\n\", \"58.986625\\n8.246211\\n16.031220\\n61.242695\\n60.027817\\n\", \"58.943642\\n12.944272\\n15.000000\\n61.874812\\n60.550451\\n\", \"58.835261\\n11.414214\\n17.029386\\n61.874812\\n60.585844\\n\", \"58.953437\\n11.414214\\n16.000000\\n65.251041\\n60.509333\\n\", \"58.986625\\n8.246211\\n16.031220\\n63.023075\\n61.107796\\n\", \"58.945137\\n10.848421\\n16.000000\\n61.874812\\n63.405979\\n\", \"58.953437\\n10.656854\\n16.000000\\n62.568989\\n61.759979\\n\", \"58.737915\\n11.414214\\n16.000000\\n59.457061\\n59.045263\\n\", \"58.953437\\n11.502385\\n16.000000\\n61.874812\\n61.958147\\n\", \"58.953437\\n12.148550\\n16.000000\\n61.785821\\n61.017457\\n\", \"58.835261\\n11.414214\\n16.031220\\n59.899059\\n61.030895\\n\", \"58.943642\\n12.944272\\n15.000000\\n59.552860\\n60.550451\\n\", \"58.986625\\n8.246211\\n16.031220\\n63.009764\\n59.385090\\n\", \"58.523500\\n15.310886\\n\", \"58.945137\\n10.848421\\n16.000000\\n63.372365\\n63.405979\\n\", \"58.908030\\n10.656854\\n16.000000\\n62.568989\\n61.759979\\n\", \"58.953437\\n12.148550\\n16.000000\\n61.785821\\n60.763613\\n\", \"58.986625\\n8.246211\\n16.031220\\n63.009088\\n59.385090\\n\", \"58.838847\\n11.414214\\n\", \"58.953437\\n11.414214\\n16.000000\\n61.874812\\n68.140092\\n\", \"58.953437\\n15.319887\\n16.031220\\n61.874812\\n60.027817\\n\", \"58.953437\\n10.848421\\n16.000000\\n61.874812\\n64.074377\\n\", \"58.835876\\n11.414214\\n15.000000\\n61.874812\\n60.681248\\n\", \"58.894288\\n11.414214\\n16.000000\\n59.552860\\n60.681248\\n\", \"58.581697\\n11.414214\\n16.000000\\n59.457061\\n60.681248\\n\", \"58.477938\\n11.414214\\n16.044976\\n59.457061\\n60.681248\\n\", \"58.953437\\n11.502385\\n16.000000\\n60.917880\\n61.017457\\n\", \"58.953437\\n11.414214\\n16.000000\\n62.837784\\n57.751931\\n\", \"58.393774\\n11.414214\\n16.044976\\n57.140559\\n60.681248\\n\", \"58.953437\\n11.414214\\n16.000000\\n61.874812\\n63.009183\\n\", \"59.170173\\n11.414214\\n16.031220\\n61.874812\\n60.027817\\n\", \"58.953437\\n11.414214\\n16.0\\n61.874812\\n63.195179\"]}", "source": "primeintellect"}
There is a chain consisting of multiple circles on a plane. The first (last) circle of the chain only intersects with the next (previous) circle, and each intermediate circle intersects only with the two neighboring circles. Your task is to find the shortest path that satisfies the following conditions. * The path connects the centers of the first circle and the last circle. * The path is confined in the chain, that is, all the points on the path are located within or on at least one of the circles. Figure E-1 shows an example of such a chain and the corresponding shortest path. <image> Figure E-1: An example chain and the corresponding shortest path Input The input consists of multiple datasets. Each dataset represents the shape of a chain in the following format. > n > x1 y1 r1 > x2 y2 r2 > ... > xn yn rn > The first line of a dataset contains an integer n (3 ≤ n ≤ 100) representing the number of the circles. Each of the following n lines contains three integers separated by a single space. (xi, yi) and ri represent the center position and the radius of the i-th circle Ci. You can assume that 0 ≤ xi ≤ 1000, 0 ≤ yi ≤ 1000, and 1 ≤ ri ≤ 25. You can assume that Ci and Ci+1 (1 ≤ i ≤ n−1) intersect at two separate points. When j ≥ i+2, Ci and Cj are apart and either of them does not contain the other. In addition, you can assume that any circle does not contain the center of any other circle. The end of the input is indicated by a line containing a zero. Figure E-1 corresponds to the first dataset of Sample Input below. Figure E-2 shows the shortest paths for the subsequent datasets of Sample Input. <image> Figure E-2: Example chains and the corresponding shortest paths Output For each dataset, output a single line containing the length of the shortest chain-confined path between the centers of the first circle and the last circle. The value should not have an error greater than 0.001. No extra characters should appear in the output. Sample Input 10 802 0 10 814 0 4 820 1 4 826 1 4 832 3 5 838 5 5 845 7 3 849 10 3 853 14 4 857 18 3 3 0 0 5 8 0 5 8 8 5 3 0 0 5 7 3 6 16 0 5 9 0 3 5 8 0 8 19 2 8 23 14 6 23 21 6 23 28 6 19 40 8 8 42 8 0 39 5 11 0 0 5 8 0 5 18 8 10 8 16 5 0 16 5 0 24 5 3 32 5 10 32 5 17 28 8 27 25 3 30 18 5 0 Output for the Sample Input 58.953437 11.414214 16.0 61.874812 63.195179 Example Input 10 802 0 10 814 0 4 820 1 4 826 1 4 832 3 5 838 5 5 845 7 3 849 10 3 853 14 4 857 18 3 3 0 0 5 8 0 5 8 8 5 3 0 0 5 7 3 6 16 0 5 9 0 3 5 8 0 8 19 2 8 23 14 6 23 21 6 23 28 6 19 40 8 8 42 8 0 39 5 11 0 0 5 8 0 5 18 8 10 8 16 5 0 16 5 0 24 5 3 32 5 10 32 5 17 28 8 27 25 3 30 18 5 0 Output 58.953437 11.414214 16.0 61.874812 63.195179 Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [\"3 1\\n0\", \"6 2\\n1\\n6\", \"6 2\\n2\\n6\", \"3 0\\n0\", \"3 0\\n-1\", \"6 2\\n4\\n6\", \"6 2\\n5\\n6\", \"6 1\\n5\\n6\", \"6 1\\n3\\n6\", \"6 1\\n3\\n0\", \"7 1\\n3\\n0\", \"7 1\\n3\\n1\", \"7 1\\n5\\n1\", \"7 1\\n5\\n0\", \"7 2\\n5\\n0\", \"5 1\\n1\", \"6 2\\n0\\n5\", \"4 2\\n1\\n4\", \"6 2\\n1\\n9\", \"3 2\\n4\\n6\", \"7 2\\n5\\n6\", \"6 1\\n10\\n6\", \"6 1\\n1\\n6\", \"6 2\\n3\\n0\", \"7 1\\n6\\n0\", \"9 1\\n3\\n1\", \"10 1\\n3\\n1\", \"9 1\\n5\\n0\", \"8 1\\n1\", \"9 2\\n0\\n5\", \"4 2\\n1\\n6\", \"6 2\\n2\\n9\", \"3 2\\n5\\n6\", \"7 2\\n7\\n6\", \"6 2\\n10\\n6\", \"6 1\\n0\\n6\", \"7 1\\n6\\n-1\", \"11 1\\n3\\n1\", \"9 1\\n4\\n0\", \"7 2\\n1\\n6\", \"6 2\\n3\\n9\", \"3 2\\n1\\n6\", \"7 2\\n8\\n6\", \"6 2\\n10\\n3\", \"6 1\\n0\\n1\", \"7 1\\n6\\n-2\", \"11 1\\n2\\n1\", \"17 1\\n4\\n0\", \"7 1\\n1\\n6\", \"8 2\\n3\\n9\", \"3 2\\n1\\n3\", \"9 2\\n8\\n6\", \"7 1\\n0\\n1\", \"7 1\\n0\\n-2\", \"11 1\\n4\\n1\", \"2 1\\n1\\n6\", \"8 2\\n6\\n9\", \"3 2\\n2\\n3\", \"9 2\\n8\\n4\", \"7 1\\n0\\n0\", \"11 2\\n4\\n1\", \"3 1\\n1\\n6\", \"8 2\\n6\\n7\", \"3 2\\n3\\n3\", \"9 2\\n7\\n4\", \"5 1\\n0\\n0\", \"11 2\\n4\\n0\", \"3 1\\n0\\n6\", \"3 2\\n5\\n3\", \"9 2\\n7\\n2\", \"3 2\\n2\\n6\", \"9 2\\n7\\n1\", \"3 1\\n2\\n6\", \"3 1\\n2\", \"12 2\\n2\\n5\", \"4 2\\n4\\n4\", \"6 2\\n1\\n4\", \"6 0\\n0\", \"6 2\\n0\\n9\", \"6 2\\n1\\n11\", \"6 2\\n9\\n6\", \"6 2\\n7\\n6\", \"2 1\\n3\\n6\", \"6 1\\n1\\n0\", \"7 1\\n1\\n1\", \"14 1\\n5\\n0\", \"7 2\\n3\\n0\", \"5 1\\n0\", \"4 1\\n1\\n4\", \"2 2\\n0\\n9\", \"2 2\\n4\\n6\", \"5 2\\n5\\n6\", \"1 1\\n1\\n6\", \"1 2\\n3\\n0\", \"4 1\\n6\\n0\", \"13 1\\n3\\n1\", \"10 1\\n3\\n0\", \"9 1\\n10\\n0\", \"9 2\\n0\\n9\", \"3 2\\n9\\n3\", \"3 1\\n1\", \"6 2\\n2\\n5\", \"4 2\\n2\\n4\"], \"outputs\": [\"No\\n\", \"Yes\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"No\\n\", \"Yes\\n\", \"Yes\\n\", \"No\\n\", \"No\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"No\\n\", \"Yes\\n\", \"No\\n\", \"Yes\\n\", \"No\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"No\\n\", \"No\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"No\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"No\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"No\\n\", \"No\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"No\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"No\\n\", \"Yes\\n\", \"No\\n\", \"Yes\\n\", \"No\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"No\\n\", \"Yes\\n\", \"No\\n\", \"No\\n\", \"Yes\\n\", \"No\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"No\\n\", \"Yes\\n\", \"Yes\\n\", \"No\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"No\\n\", \"Yes\\n\", \"Yes\\n\", \"Yes\\n\", \"No\\n\", \"No\\n\", \"Yes\", \"Yes\", \"No\"]}", "source": "primeintellect"}
You are a secret agent from the Intelligence Center of Peacemaking Committee. You've just sneaked into a secret laboratory of an evil company, Automated Crime Machines. Your mission is to get a confidential document kept in the laboratory. To reach the document, you need to unlock the door to the safe where it is kept. You have to unlock the door in a correct way and with a great care; otherwise an alarm would ring and you would be caught by the secret police. The lock has a circular dial with N lights around it and a hand pointing to one of them. The lock also has M buttons to control the hand. Each button has a number Li printed on it. Initially, all the lights around the dial are turned off. When the i-th button is pressed, the hand revolves clockwise by Li lights, and the pointed light is turned on. You are allowed to press the buttons exactly N times. The lock opens only when you make all the lights turned on. <image> For example, in the case with N = 6, M = 2, L1 = 2 and L2 = 5, you can unlock the door by pressing buttons 2, 2, 2, 5, 2 and 2 in this order. There are a number of doors in the laboratory, and some of them don’t seem to be unlockable. Figure out which lock can be opened, given the values N, M, and Li's. Input The input starts with a line containing two integers, which represent N and M respectively. M lines follow, each of which contains an integer representing Li. It is guaranteed that 1 ≤ N ≤ 109, 1 ≤ M ≤ 105, and 1 ≤ Li ≤ N for each i = 1, 2, ... N. Output Output a line with "Yes" (without quotes) if the lock can be opened, and "No" otherwise. Examples Input 6 2 2 5 Output Yes Input 3 1 1 Output Yes Input 4 2 2 4 Output No Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0.5
{"tests": "{\"inputs\": [\"2\\n3 3\\n3 1 2\\n3 2 1\\n7 2\\n2 1 7 3 4 5 6\\n3 1\\n\", \"2\\n3 3\\n3 1 2\\n3 2 1\\n7 2\\n4 1 7 3 4 5 6\\n3 1\\n\", \"2\\n3 3\\n3 1 2\\n3 2 1\\n7 2\\n2 1 7 3 4 5 6\\n6 1\\n\", \"2\\n3 3\\n3 1 2\\n3 2 1\\n7 2\\n2 1 7 3 4 5 6\\n4 1\\n\", \"2\\n3 3\\n3 1 2\\n3 2 1\\n7 2\\n2 1 7 3 5 7 6\\n2 1\\n\", \"2\\n3 3\\n3 1 2\\n3 2 1\\n7 2\\n2 1 7 3 5 5 6\\n1 2\\n\", \"2\\n3 3\\n3 1 2\\n3 2 1\\n7 2\\n4 1 7 3 2 5 4\\n5 1\\n\", \"2\\n3 3\\n3 1 2\\n3 2 1\\n7 2\\n4 1 7 3 5 5 6\\n3 1\\n\", \"2\\n3 3\\n3 1 2\\n3 2 1\\n7 2\\n4 1 7 3 2 5 6\\n3 1\\n\", \"2\\n3 3\\n3 1 2\\n3 2 1\\n7 2\\n5 1 7 3 2 5 6\\n3 1\\n\", \"2\\n3 3\\n3 1 2\\n3 2 1\\n7 2\\n4 1 7 3 2 2 6\\n3 1\\n\", \"2\\n3 3\\n3 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3 1 2\\n3 2 1\\n7 2\\n5 1 7 3 4 2 6\\n3 1\\n\", \"2\\n3 3\\n3 1 2\\n3 2 1\\n7 2\\n2 1 7 3 5 5 6\\n2 1\\n\", \"2\\n3 3\\n3 1 2\\n3 2 1\\n7 2\\n2 1 7 3 4 5 5\\n4 1\\n\", \"2\\n3 3\\n3 1 2\\n3 2 1\\n7 2\\n5 1 7 3 4 4 6\\n3 1\\n\", \"2\\n3 3\\n3 1 2\\n3 2 1\\n7 2\\n6 1 7 3 4 4 6\\n3 1\\n\", \"2\\n3 3\\n3 1 2\\n3 2 1\\n7 2\\n2 1 6 3 2 5 6\\n3 1\\n\", \"2\\n3 3\\n3 1 2\\n3 2 1\\n7 2\\n2 1 5 3 4 7 6\\n3 2\\n\", \"2\\n3 3\\n3 1 2\\n3 2 1\\n7 2\\n2 1 6 3 5 2 6\\n3 1\\n\", \"2\\n3 3\\n3 1 2\\n3 2 1\\n7 2\\n2 1 7 3 4 5 6\\n3 1\\n\"], \"outputs\": [\"5\\n8\\n\", \"5\\n8\\n\", \"5\\n14\\n\", \"5\\n10\\n\", \"5\\n2\\n\", \"5\\n4\\n\", \"5\\n12\\n\", \"5\\n8\\n\", \"5\\n8\\n\", \"5\\n8\\n\", \"5\\n8\\n\", \"5\\n8\\n\", \"5\\n8\\n\", \"5\\n8\\n\", \"5\\n8\\n\", \"5\\n8\\n\", \"5\\n8\\n\", \"5\\n8\\n\", \"5\\n8\\n\", \"5\\n8\\n\", \"5\\n8\\n\", \"5\\n8\\n\", \"5\\n8\\n\", \"5\\n8\\n\", \"5\\n8\\n\", \"5\\n8\\n\", \"5\\n8\\n\", \"5\\n8\\n\", \"5\\n8\\n\", \"5\\n8\\n\", \"5\\n8\\n\", \"5\\n8\\n\", \"5\\n8\\n\", \"5\\n8\\n\", \"5\\n8\\n\", \"5\\n14\\n\", \"5\\n8\\n\", \"5\\n8\\n\", \"5\\n8\\n\", \"5\\n8\\n\", \"5\\n8\\n\", \"5\\n8\\n\", \"5\\n8\\n\", \"5\\n8\\n\", \"5\\n14\\n\", \"5\\n2\\n\", \"5\\n8\\n\", \"5\\n8\\n\", \"5\\n8\\n\", \"5\\n8\\n\", \"5\\n8\\n\", \"5\\n8\\n\", \"5\\n8\\n\", \"5\\n14\\n\", \"5\\n8\\n\", \"5\\n8\\n\", \"5\\n8\\n\", \"5\\n2\\n\", \"5\\n8\\n\", \"5\\n8\\n\", \"5\\n8\\n\", \"5\\n8\\n\", \"5\\n8\\n\", \"5\\n8\\n\", \"5\\n8\\n\", \"5\\n2\\n\", \"5\\n10\\n\", \"5\\n8\\n\", \"5\\n8\\n\", \"5\\n8\\n\", \"5\\n8\\n\", \"5\\n8\\n\", \"5\\n8\\n\"]}", "source": "primeintellect"}
Santa has to send presents to the kids. He has a large stack of $n$ presents, numbered from $1$ to $n$; the topmost present has number $a_1$, the next present is $a_2$, and so on; the bottom present has number $a_n$. All numbers are distinct. Santa has a list of $m$ distinct presents he has to send: $b_1$, $b_2$, ..., $b_m$. He will send them in the order they appear in the list. To send a present, Santa has to find it in the stack by removing all presents above it, taking this present and returning all removed presents on top of the stack. So, if there are $k$ presents above the present Santa wants to send, it takes him $2k + 1$ seconds to do it. Fortunately, Santa can speed the whole process up — when he returns the presents to the stack, he may reorder them as he wishes (only those which were above the present he wanted to take; the presents below cannot be affected in any way). What is the minimum time required to send all of the presents, provided that Santa knows the whole list of presents he has to send and reorders the presents optimally? Santa cannot change the order of presents or interact with the stack of presents in any other way. Your program has to answer $t$ different test cases. -----Input----- The first line contains one integer $t$ ($1 \le t \le 100$) — the number of test cases. Then the test cases follow, each represented by three lines. The first line contains two integers $n$ and $m$ ($1 \le m \le n \le 10^5$) — the number of presents in the stack and the number of presents Santa wants to send, respectively. The second line contains $n$ integers $a_1$, $a_2$, ..., $a_n$ ($1 \le a_i \le n$, all $a_i$ are unique) — the order of presents in the stack. The third line contains $m$ integers $b_1$, $b_2$, ..., $b_m$ ($1 \le b_i \le n$, all $b_i$ are unique) — the ordered list of presents Santa has to send. The sum of $n$ over all test cases does not exceed $10^5$. -----Output----- For each test case print one integer — the minimum number of seconds which Santa has to spend sending presents, if he reorders the presents optimally each time he returns them into the stack. -----Example----- Input 2 3 3 3 1 2 3 2 1 7 2 2 1 7 3 4 5 6 3 1 Output 5 8 Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [[[1, 2, 3, 4, 5]], [[1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4, 5, 4, 3, 2, 1]], [[1, 5, 2, 3, 1, 5, 2, 3, 1]], [[1, 5, 4, 8, 7, 11, 10, 14, 13]], [[0, 1]], [[4, 5, 6, 8, 3, 4, 5, 6, 8, 3, 4, 5, 6, 8, 3, 4]], [[4, 5, 3, -2, -1, 0, -2, -7, -6]], [[4, 5, 6, 5, 3, 2, 3, 4, 5, 6, 5, 3, 2, 3, 4, 5, 6, 5, 3, 2, 3, 4]], [[-67, -66, -64, -61, -57, -52, -46, -39, -31, -22, -12, -2, 7, 15, 22, 28, 33, 37, 40, 42, 43]], [[4, 5, 7, 6, 4, 2, 3, 5, 4, 2, 3, 5, 4, 2, 0, 1, 3, 2, 0, 1, 3, 2, 0, -2, -1, 1, 0, -2]]], \"outputs\": [[[1]], [[1, 1, 1, 1, -1, -1, -1, -1]], [[4, -3, 1, -2]], [[4, -1]], [[1]], [[1, 1, 2, -5, 1]], [[1, -2, -5, 1]], [[1, 1, -1, -2, -1, 1, 1]], [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]], [[1, 2, -1, -2, -2, 1, 2, -1, -2]]]}", "source": "primeintellect"}
In this kata, your task is to identify the pattern underlying a sequence of numbers. For example, if the sequence is [1, 2, 3, 4, 5], then the pattern is [1], since each number in the sequence is equal to the number preceding it, plus 1. See the test cases for more examples. A few more rules : pattern may contain negative numbers. sequence will always be made of a whole number of repetitions of the pattern. Your answer must correspond to the shortest form of the pattern, e.g. if the pattern is [1], then [1, 1, 1, 1] will not be considered a correct answer. Write your solution by modifying this code: ```python def find_pattern(seq): ``` Your solution should implemented in the function "find_pattern". The i Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [[12, 0, \"am\"], [12, 1, \"am\"], [12, 2, \"am\"], [12, 3, \"am\"], [12, 4, \"am\"], [12, 5, \"am\"], [12, 6, \"am\"], [12, 7, \"am\"], [12, 8, \"am\"], [12, 9, \"am\"], [12, 10, \"am\"], [12, 11, \"am\"], [12, 12, \"am\"], [12, 13, \"am\"], [12, 14, \"am\"], [12, 15, \"am\"], [12, 16, \"am\"], [12, 17, \"am\"], [12, 18, \"am\"], [12, 19, \"am\"], [12, 20, \"am\"], [12, 21, \"am\"], [12, 22, \"am\"], [12, 23, \"am\"], [12, 24, \"am\"], [12, 25, \"am\"], [12, 26, \"am\"], [12, 27, \"am\"], [12, 28, \"am\"], [12, 29, \"am\"], [12, 30, \"am\"], [12, 31, \"am\"], [12, 32, \"am\"], [12, 33, \"am\"], [12, 34, \"am\"], [12, 35, \"am\"], [12, 36, \"am\"], [12, 37, \"am\"], [12, 38, \"am\"], [12, 39, \"am\"], [12, 40, \"am\"], [12, 41, \"am\"], [12, 42, \"am\"], [12, 43, \"am\"], [12, 44, \"am\"], [12, 45, \"am\"], [12, 46, \"am\"], [12, 47, \"am\"], [12, 48, \"am\"], [12, 49, \"am\"], [12, 50, \"am\"], [12, 51, \"am\"], [12, 52, \"am\"], [12, 53, \"am\"], [12, 54, \"am\"], [12, 55, \"am\"], [12, 56, \"am\"], [12, 57, \"am\"], [12, 58, \"am\"], [12, 59, \"am\"], [1, 0, \"am\"], [1, 1, \"am\"], [1, 2, \"am\"], [1, 3, \"am\"], [1, 4, \"am\"], [1, 5, \"am\"], [1, 6, \"am\"], [1, 7, \"am\"], [1, 8, \"am\"], [1, 9, \"am\"], [1, 10, \"am\"], [1, 11, \"am\"], [1, 12, \"am\"], [1, 13, \"am\"], [1, 14, \"am\"], [1, 15, \"am\"], [1, 16, \"am\"], [1, 17, \"am\"], [1, 18, \"am\"], [1, 19, \"am\"], [1, 20, \"am\"], [1, 21, \"am\"], [1, 22, \"am\"], [1, 23, \"am\"], [1, 24, \"am\"], [1, 25, \"am\"], [1, 26, \"am\"], [1, 27, \"am\"], [1, 28, \"am\"], [1, 29, \"am\"], [1, 30, \"am\"], [1, 31, \"am\"], [1, 32, \"am\"], [1, 33, \"am\"], [1, 34, \"am\"], [1, 35, \"am\"], [1, 36, \"am\"], [1, 37, \"am\"], [1, 38, \"am\"], [1, 39, \"am\"], [1, 40, \"am\"], [1, 41, \"am\"], [1, 42, \"am\"], [1, 43, \"am\"], [1, 44, \"am\"], [1, 45, \"am\"], [1, 46, \"am\"], [1, 47, \"am\"], [1, 48, \"am\"], [1, 49, \"am\"], [1, 50, \"am\"], [1, 51, \"am\"], [1, 52, \"am\"], [1, 53, \"am\"], [1, 54, \"am\"], [1, 55, \"am\"], [1, 56, \"am\"], [1, 57, \"am\"], [1, 58, \"am\"], [1, 59, \"am\"], [2, 0, \"am\"], [2, 1, \"am\"], [2, 2, \"am\"], [2, 3, \"am\"], [2, 4, \"am\"], [2, 5, \"am\"], [2, 6, \"am\"], [2, 7, \"am\"], [2, 8, \"am\"], [2, 9, \"am\"], [2, 10, \"am\"], [2, 11, \"am\"], [2, 12, \"am\"], [2, 13, \"am\"], [2, 14, \"am\"], [2, 15, \"am\"], [2, 16, \"am\"], [2, 17, \"am\"], [2, 18, \"am\"], [2, 19, \"am\"], [2, 20, \"am\"], [2, 21, \"am\"], [2, 22, \"am\"], [2, 23, \"am\"], [2, 24, \"am\"], [2, 25, \"am\"], [2, 26, \"am\"], [2, 27, \"am\"], [2, 28, \"am\"], [2, 29, \"am\"], [2, 30, \"am\"], [2, 31, \"am\"], [2, 32, \"am\"], [2, 33, \"am\"], [2, 34, \"am\"], [2, 35, \"am\"], [2, 36, \"am\"], [2, 37, \"am\"], [2, 38, \"am\"], [2, 39, \"am\"], [2, 40, \"am\"], [2, 41, \"am\"], [2, 42, \"am\"], [2, 43, \"am\"], [2, 44, \"am\"], [2, 45, \"am\"], [2, 46, \"am\"], [2, 47, \"am\"], [2, 48, \"am\"], [2, 49, \"am\"], [2, 50, \"am\"], [2, 51, \"am\"], [2, 52, \"am\"], [2, 53, \"am\"], [2, 54, \"am\"], [2, 55, \"am\"], [2, 56, \"am\"], [2, 57, \"am\"], [2, 58, \"am\"], [2, 59, \"am\"], [3, 0, \"am\"], [3, 1, \"am\"], [3, 2, \"am\"], [3, 3, \"am\"], [3, 4, \"am\"], [3, 5, \"am\"], [3, 6, \"am\"], [3, 7, \"am\"], [3, 8, \"am\"], [3, 9, \"am\"], [3, 10, \"am\"], [3, 11, \"am\"], [3, 12, \"am\"], [3, 13, \"am\"], [3, 14, \"am\"], [3, 15, \"am\"], [3, 16, \"am\"], [3, 17, \"am\"], [3, 18, \"am\"], [3, 19, \"am\"], [3, 20, \"am\"], [3, 21, \"am\"], [3, 22, \"am\"], [3, 23, \"am\"], [3, 24, \"am\"], [3, 25, \"am\"], [3, 26, \"am\"], [3, 27, \"am\"], [3, 28, \"am\"], [3, 29, \"am\"], [3, 30, \"am\"], [3, 31, \"am\"], [3, 32, \"am\"], [3, 33, \"am\"], [3, 34, \"am\"], [3, 35, \"am\"], [3, 36, \"am\"], [3, 37, \"am\"], [3, 38, \"am\"], [3, 39, \"am\"], [3, 40, \"am\"], [3, 41, \"am\"], [3, 42, \"am\"], [3, 43, \"am\"], [3, 44, \"am\"], [3, 45, \"am\"], [3, 46, \"am\"], [3, 47, \"am\"], [3, 48, \"am\"], [3, 49, \"am\"], [3, 50, \"am\"], [3, 51, \"am\"], [3, 52, \"am\"], [3, 53, \"am\"], [3, 54, \"am\"], [3, 55, \"am\"], [3, 56, \"am\"], [3, 57, \"am\"], [3, 58, \"am\"], [3, 59, \"am\"], [4, 0, \"am\"], [4, 1, \"am\"], [4, 2, \"am\"], [4, 3, \"am\"], [4, 4, \"am\"], [4, 5, \"am\"], [4, 6, \"am\"], [4, 7, \"am\"], [4, 8, \"am\"], [4, 9, \"am\"], [4, 10, \"am\"], [4, 11, \"am\"], [4, 12, \"am\"], [4, 13, \"am\"], [4, 14, \"am\"], [4, 15, \"am\"], [4, 16, \"am\"], [4, 17, \"am\"], [4, 18, \"am\"], [4, 19, \"am\"], [4, 20, \"am\"], [4, 21, \"am\"], [4, 22, \"am\"], [4, 23, \"am\"], [4, 24, \"am\"], [4, 25, \"am\"], [4, 26, \"am\"], [4, 27, \"am\"], [4, 28, \"am\"], [4, 29, \"am\"], [4, 30, \"am\"], [4, 31, \"am\"], [4, 32, \"am\"], [4, 33, \"am\"], [4, 34, \"am\"], [4, 35, \"am\"], [4, 36, \"am\"], [4, 37, \"am\"], [4, 38, \"am\"], [4, 39, \"am\"], [4, 40, \"am\"], [4, 41, \"am\"], [4, 42, \"am\"], [4, 43, \"am\"], [4, 44, \"am\"], [4, 45, \"am\"], [4, 46, \"am\"], [4, 47, \"am\"], [4, 48, \"am\"], [4, 49, \"am\"], [4, 50, \"am\"], [4, 51, \"am\"], [4, 52, \"am\"], [4, 53, \"am\"], [4, 54, \"am\"], [4, 55, \"am\"], [4, 56, \"am\"], [4, 57, \"am\"], [4, 58, \"am\"], [4, 59, \"am\"], [5, 0, \"am\"], [5, 1, \"am\"], [5, 2, \"am\"], [5, 3, \"am\"], [5, 4, \"am\"], [5, 5, \"am\"], [5, 6, \"am\"], [5, 7, \"am\"], [5, 8, \"am\"], [5, 9, \"am\"], [5, 10, \"am\"], [5, 11, \"am\"], [5, 12, \"am\"], [5, 13, \"am\"], [5, 14, \"am\"], [5, 15, \"am\"], [5, 16, \"am\"], [5, 17, \"am\"], [5, 18, \"am\"], [5, 19, \"am\"], [5, 20, \"am\"], [5, 21, \"am\"], [5, 22, \"am\"], [5, 23, \"am\"], [5, 24, \"am\"], [5, 25, \"am\"], [5, 26, \"am\"], [5, 27, \"am\"], [5, 28, \"am\"], [5, 29, \"am\"], [5, 30, \"am\"], [5, 31, \"am\"], [5, 32, \"am\"], [5, 33, \"am\"], [5, 34, \"am\"], [5, 35, \"am\"], [5, 36, \"am\"], [5, 37, \"am\"], [5, 38, \"am\"], [5, 39, \"am\"], [5, 40, \"am\"], [5, 41, \"am\"], [5, 42, \"am\"], [5, 43, \"am\"], [5, 44, \"am\"], [5, 45, \"am\"], [5, 46, \"am\"], [5, 47, \"am\"], [5, 48, \"am\"], [5, 49, \"am\"], [5, 50, \"am\"], [5, 51, \"am\"], [5, 52, \"am\"], [5, 53, \"am\"], [5, 54, \"am\"], [5, 55, \"am\"], [5, 56, \"am\"], [5, 57, \"am\"], [5, 58, \"am\"], [5, 59, \"am\"], [6, 0, \"am\"], [6, 1, \"am\"], [6, 2, \"am\"], [6, 3, \"am\"], [6, 4, \"am\"], [6, 5, \"am\"], [6, 6, \"am\"], [6, 7, \"am\"], [6, 8, \"am\"], [6, 9, \"am\"], [6, 10, \"am\"], [6, 11, \"am\"], [6, 12, \"am\"], [6, 13, \"am\"], [6, 14, \"am\"], [6, 15, \"am\"], [6, 16, \"am\"], [6, 17, \"am\"], [6, 18, \"am\"], [6, 19, \"am\"], [6, 20, \"am\"], [6, 21, \"am\"], [6, 22, \"am\"], [6, 23, \"am\"], [6, 24, \"am\"], [6, 25, \"am\"], [6, 26, \"am\"], [6, 27, \"am\"], [6, 28, \"am\"], [6, 29, \"am\"], [6, 30, \"am\"], [6, 31, \"am\"], [6, 32, \"am\"], [6, 33, \"am\"], [6, 34, \"am\"], [6, 35, \"am\"], [6, 36, \"am\"], [6, 37, \"am\"], [6, 38, \"am\"], [6, 39, \"am\"], [6, 40, \"am\"], [6, 41, \"am\"], [6, 42, \"am\"], [6, 43, \"am\"], [6, 44, \"am\"], [6, 45, \"am\"], [6, 46, \"am\"], [6, 47, \"am\"], [6, 48, \"am\"], [6, 49, \"am\"], [6, 50, \"am\"], [6, 51, \"am\"], [6, 52, \"am\"], [6, 53, \"am\"], [6, 54, \"am\"], [6, 55, \"am\"], [6, 56, \"am\"], [6, 57, \"am\"], [6, 58, \"am\"], [6, 59, \"am\"], [7, 0, \"am\"], [7, 1, \"am\"], [7, 2, \"am\"], [7, 3, \"am\"], [7, 4, \"am\"], [7, 5, \"am\"], [7, 6, \"am\"], [7, 7, \"am\"], [7, 8, \"am\"], [7, 9, \"am\"], [7, 10, \"am\"], [7, 11, \"am\"], [7, 12, \"am\"], [7, 13, \"am\"], [7, 14, \"am\"], [7, 15, \"am\"], [7, 16, \"am\"], [7, 17, \"am\"], [7, 18, \"am\"], [7, 19, \"am\"], [7, 20, \"am\"], [7, 21, \"am\"], [7, 22, \"am\"], [7, 23, \"am\"], [7, 24, \"am\"], [7, 25, \"am\"], [7, 26, \"am\"], [7, 27, \"am\"], [7, 28, \"am\"], [7, 29, \"am\"], [7, 30, \"am\"], [7, 31, \"am\"], [7, 32, \"am\"], [7, 33, \"am\"], [7, 34, \"am\"], [7, 35, \"am\"], [7, 36, \"am\"], [7, 37, \"am\"], [7, 38, \"am\"], [7, 39, \"am\"], [7, 40, \"am\"], [7, 41, \"am\"], [7, 42, \"am\"], [7, 43, \"am\"], [7, 44, \"am\"], [7, 45, \"am\"], [7, 46, \"am\"], [7, 47, \"am\"], [7, 48, \"am\"], [7, 49, \"am\"], [7, 50, \"am\"], [7, 51, \"am\"], [7, 52, \"am\"], [7, 53, \"am\"], [7, 54, \"am\"], [7, 55, \"am\"], [7, 56, \"am\"], [7, 57, \"am\"], [7, 58, \"am\"], [7, 59, \"am\"], [8, 0, \"am\"], [8, 1, \"am\"], [8, 2, \"am\"], [8, 3, \"am\"], [8, 4, \"am\"], [8, 5, \"am\"], [8, 6, \"am\"], [8, 7, \"am\"], [8, 8, \"am\"], [8, 9, \"am\"], [8, 10, \"am\"], [8, 11, \"am\"], [8, 12, \"am\"], [8, 13, \"am\"], [8, 14, \"am\"], [8, 15, \"am\"], [8, 16, \"am\"], [8, 17, \"am\"], [8, 18, \"am\"], [8, 19, \"am\"], [8, 20, \"am\"], [8, 21, \"am\"], [8, 22, \"am\"], [8, 23, \"am\"], [8, 24, \"am\"], [8, 25, \"am\"], [8, 26, \"am\"], [8, 27, \"am\"], [8, 28, \"am\"], [8, 29, \"am\"], [8, 30, \"am\"], [8, 31, \"am\"], [8, 32, \"am\"], [8, 33, \"am\"], [8, 34, \"am\"], [8, 35, \"am\"], [8, 36, \"am\"], [8, 37, \"am\"], [8, 38, \"am\"], [8, 39, \"am\"], [8, 40, \"am\"], [8, 41, \"am\"], [8, 42, \"am\"], [8, 43, \"am\"], [8, 44, \"am\"], [8, 45, \"am\"], [8, 46, \"am\"], [8, 47, \"am\"], [8, 48, \"am\"], [8, 49, \"am\"], [8, 50, \"am\"], [8, 51, \"am\"], [8, 52, \"am\"], [8, 53, \"am\"], [8, 54, \"am\"], [8, 55, \"am\"], [8, 56, \"am\"], [8, 57, \"am\"], [8, 58, \"am\"], [8, 59, \"am\"], [9, 0, \"am\"], [9, 1, \"am\"], [9, 2, \"am\"], [9, 3, \"am\"], [9, 4, \"am\"], [9, 5, \"am\"], [9, 6, \"am\"], [9, 7, \"am\"], [9, 8, \"am\"], [9, 9, \"am\"], [9, 10, \"am\"], [9, 11, \"am\"], [9, 12, \"am\"], [9, 13, \"am\"], [9, 14, \"am\"], [9, 15, \"am\"], [9, 16, \"am\"], [9, 17, \"am\"], [9, 18, \"am\"], [9, 19, \"am\"], [9, 20, \"am\"], [9, 21, \"am\"], [9, 22, \"am\"], [9, 23, \"am\"], [9, 24, \"am\"], [9, 25, \"am\"], [9, 26, \"am\"], [9, 27, \"am\"], [9, 28, \"am\"], [9, 29, \"am\"], [9, 30, \"am\"], [9, 31, \"am\"], [9, 32, \"am\"], [9, 33, \"am\"], [9, 34, \"am\"], [9, 35, \"am\"], [9, 36, \"am\"], [9, 37, \"am\"], [9, 38, \"am\"], [9, 39, \"am\"], [9, 40, \"am\"], [9, 41, \"am\"], [9, 42, \"am\"], [9, 43, \"am\"], [9, 44, \"am\"], [9, 45, \"am\"], [9, 46, \"am\"], [9, 47, \"am\"], [9, 48, \"am\"], [9, 49, \"am\"], [9, 50, \"am\"], [9, 51, \"am\"], [9, 52, \"am\"], [9, 53, \"am\"], [9, 54, \"am\"], [9, 55, \"am\"], [9, 56, \"am\"], [9, 57, \"am\"], [9, 58, \"am\"], [9, 59, \"am\"], [10, 0, \"am\"], [10, 1, \"am\"], [10, 2, \"am\"], [10, 3, \"am\"], [10, 4, \"am\"], [10, 5, \"am\"], [10, 6, \"am\"], [10, 7, \"am\"], [10, 8, \"am\"], [10, 9, \"am\"], [10, 10, \"am\"], [10, 11, \"am\"], [10, 12, \"am\"], [10, 13, \"am\"], [10, 14, \"am\"], [10, 15, \"am\"], [10, 16, \"am\"], [10, 17, \"am\"], [10, 18, \"am\"], [10, 19, \"am\"], [10, 20, \"am\"], [10, 21, \"am\"], [10, 22, \"am\"], [10, 23, \"am\"], [10, 24, \"am\"], [10, 25, \"am\"], [10, 26, \"am\"], [10, 27, \"am\"], [10, 28, \"am\"], [10, 29, \"am\"], [10, 30, \"am\"], [10, 31, \"am\"], [10, 32, \"am\"], [10, 33, \"am\"], [10, 34, \"am\"], [10, 35, \"am\"], [10, 36, \"am\"], [10, 37, \"am\"], [10, 38, \"am\"], [10, 39, \"am\"], [10, 40, \"am\"], [10, 41, \"am\"], [10, 42, \"am\"], [10, 43, \"am\"], [10, 44, \"am\"], [10, 45, \"am\"], [10, 46, \"am\"], [10, 47, \"am\"], [10, 48, \"am\"], [10, 49, \"am\"], [10, 50, \"am\"], [10, 51, \"am\"], [10, 52, \"am\"], [10, 53, \"am\"], [10, 54, \"am\"], [10, 55, \"am\"], [10, 56, \"am\"], [10, 57, \"am\"], [10, 58, \"am\"], [10, 59, \"am\"], [11, 0, \"am\"], [11, 1, \"am\"], [11, 2, \"am\"], [11, 3, \"am\"], [11, 4, \"am\"], [11, 5, \"am\"], [11, 6, \"am\"], [11, 7, \"am\"], [11, 8, \"am\"], [11, 9, \"am\"], [11, 10, \"am\"], [11, 11, \"am\"], [11, 12, \"am\"], [11, 13, \"am\"], [11, 14, \"am\"], [11, 15, \"am\"], [11, 16, \"am\"], [11, 17, \"am\"], [11, 18, \"am\"], [11, 19, \"am\"], [11, 20, \"am\"], [11, 21, \"am\"], [11, 22, \"am\"], [11, 23, \"am\"], [11, 24, \"am\"], [11, 25, \"am\"], [11, 26, \"am\"], [11, 27, \"am\"], [11, 28, \"am\"], [11, 29, \"am\"], [11, 30, \"am\"], [11, 31, \"am\"], [11, 32, \"am\"], [11, 33, \"am\"], [11, 34, \"am\"], [11, 35, \"am\"], [11, 36, \"am\"], [11, 37, \"am\"], [11, 38, \"am\"], [11, 39, \"am\"], [11, 40, \"am\"], [11, 41, \"am\"], [11, 42, \"am\"], [11, 43, \"am\"], [11, 44, \"am\"], [11, 45, \"am\"], [11, 46, \"am\"], [11, 47, \"am\"], [11, 48, \"am\"], [11, 49, \"am\"], [11, 50, \"am\"], [11, 51, \"am\"], [11, 52, \"am\"], [11, 53, \"am\"], [11, 54, \"am\"], [11, 55, \"am\"], [11, 56, \"am\"], [11, 57, \"am\"], [11, 58, \"am\"], [11, 59, \"am\"], [12, 0, \"pm\"], [12, 1, \"pm\"], [12, 2, \"pm\"], [12, 3, \"pm\"], [12, 4, \"pm\"], [12, 5, \"pm\"], [12, 6, \"pm\"], [12, 7, \"pm\"], [12, 8, \"pm\"], [12, 9, \"pm\"], [12, 10, \"pm\"], [12, 11, \"pm\"], [12, 12, \"pm\"], [12, 13, \"pm\"], [12, 14, \"pm\"], [12, 15, \"pm\"], [12, 16, \"pm\"], [12, 17, \"pm\"], [12, 18, \"pm\"], [12, 19, \"pm\"], [12, 20, \"pm\"], [12, 21, \"pm\"], [12, 22, \"pm\"], [12, 23, \"pm\"], [12, 24, \"pm\"], [12, 25, \"pm\"], [12, 26, \"pm\"], [12, 27, \"pm\"], [12, 28, \"pm\"], [12, 29, \"pm\"], [12, 30, \"pm\"], [12, 31, \"pm\"], [12, 32, \"pm\"], [12, 33, \"pm\"], [12, 34, \"pm\"], [12, 35, \"pm\"], [12, 36, \"pm\"], [12, 37, \"pm\"], [12, 38, \"pm\"], [12, 39, \"pm\"], [12, 40, \"pm\"], [12, 41, \"pm\"], [12, 42, \"pm\"], [12, 43, \"pm\"], [12, 44, \"pm\"], [12, 45, \"pm\"], [12, 46, \"pm\"], [12, 47, \"pm\"], [12, 48, \"pm\"], [12, 49, \"pm\"], [12, 50, \"pm\"], [12, 51, \"pm\"], [12, 52, \"pm\"], [12, 53, \"pm\"], [12, 54, \"pm\"], [12, 55, \"pm\"], [12, 56, \"pm\"], [12, 57, \"pm\"], [12, 58, \"pm\"], [12, 59, \"pm\"], [1, 0, \"pm\"], [1, 1, \"pm\"], [1, 2, \"pm\"], [1, 3, \"pm\"], [1, 4, \"pm\"], [1, 5, \"pm\"], [1, 6, \"pm\"], [1, 7, \"pm\"], [1, 8, \"pm\"], [1, 9, \"pm\"], [1, 10, \"pm\"], [1, 11, \"pm\"], [1, 12, \"pm\"], [1, 13, \"pm\"], [1, 14, \"pm\"], [1, 15, \"pm\"], [1, 16, \"pm\"], [1, 17, \"pm\"], [1, 18, \"pm\"], [1, 19, \"pm\"], [1, 20, \"pm\"], [1, 21, \"pm\"], [1, 22, \"pm\"], [1, 23, \"pm\"], [1, 24, \"pm\"], [1, 25, \"pm\"], [1, 26, \"pm\"], [1, 27, \"pm\"], [1, 28, \"pm\"], [1, 29, \"pm\"], [1, 30, \"pm\"], [1, 31, \"pm\"], [1, 32, \"pm\"], [1, 33, \"pm\"], [1, 34, \"pm\"], [1, 35, \"pm\"], [1, 36, \"pm\"], [1, 37, \"pm\"], [1, 38, \"pm\"], [1, 39, \"pm\"], [1, 40, \"pm\"], [1, 41, \"pm\"], [1, 42, \"pm\"], [1, 43, \"pm\"], [1, 44, \"pm\"], [1, 45, \"pm\"], [1, 46, \"pm\"], [1, 47, \"pm\"], [1, 48, \"pm\"], [1, 49, \"pm\"], [1, 50, \"pm\"], [1, 51, \"pm\"], [1, 52, \"pm\"], [1, 53, \"pm\"], [1, 54, \"pm\"], [1, 55, \"pm\"], [1, 56, \"pm\"], [1, 57, \"pm\"], [1, 58, \"pm\"], [1, 59, \"pm\"], [2, 0, \"pm\"], [2, 1, \"pm\"], [2, 2, \"pm\"], [2, 3, \"pm\"], [2, 4, \"pm\"], [2, 5, \"pm\"], [2, 6, \"pm\"], [2, 7, \"pm\"], [2, 8, \"pm\"], [2, 9, \"pm\"], [2, 10, \"pm\"], [2, 11, \"pm\"], [2, 12, \"pm\"], [2, 13, \"pm\"], [2, 14, \"pm\"], [2, 15, \"pm\"], [2, 16, \"pm\"], [2, 17, \"pm\"], [2, 18, \"pm\"], [2, 19, \"pm\"], [2, 20, \"pm\"], [2, 21, \"pm\"], [2, 22, \"pm\"], [2, 23, \"pm\"], [2, 24, \"pm\"], [2, 25, \"pm\"], [2, 26, \"pm\"], [2, 27, \"pm\"], [2, 28, \"pm\"], [2, 29, \"pm\"], [2, 30, \"pm\"], [2, 31, \"pm\"], [2, 32, \"pm\"], [2, 33, \"pm\"], [2, 34, \"pm\"], [2, 35, \"pm\"], [2, 36, \"pm\"], [2, 37, \"pm\"], [2, 38, \"pm\"], [2, 39, \"pm\"], [2, 40, \"pm\"], [2, 41, \"pm\"], [2, 42, \"pm\"], [2, 43, \"pm\"], [2, 44, \"pm\"], [2, 45, \"pm\"], [2, 46, \"pm\"], [2, 47, \"pm\"], [2, 48, \"pm\"], [2, 49, \"pm\"], [2, 50, \"pm\"], [2, 51, \"pm\"], [2, 52, \"pm\"], [2, 53, \"pm\"], [2, 54, \"pm\"], [2, 55, \"pm\"], [2, 56, \"pm\"], [2, 57, \"pm\"], [2, 58, \"pm\"], [2, 59, \"pm\"], [3, 0, \"pm\"], [3, 1, \"pm\"], [3, 2, \"pm\"], [3, 3, \"pm\"], [3, 4, \"pm\"], [3, 5, \"pm\"], [3, 6, \"pm\"], [3, 7, \"pm\"], [3, 8, \"pm\"], [3, 9, \"pm\"], [3, 10, \"pm\"], [3, 11, \"pm\"], [3, 12, \"pm\"], [3, 13, \"pm\"], [3, 14, \"pm\"], [3, 15, \"pm\"], [3, 16, \"pm\"], [3, 17, \"pm\"], [3, 18, \"pm\"], [3, 19, \"pm\"], [3, 20, \"pm\"], [3, 21, \"pm\"], [3, 22, \"pm\"], [3, 23, \"pm\"], [3, 24, \"pm\"], [3, 25, \"pm\"], [3, 26, \"pm\"], [3, 27, \"pm\"], [3, 28, \"pm\"], [3, 29, \"pm\"], [3, 30, \"pm\"], [3, 31, \"pm\"], [3, 32, \"pm\"], [3, 33, \"pm\"], [3, 34, \"pm\"], [3, 35, \"pm\"], [3, 36, \"pm\"], [3, 37, \"pm\"], [3, 38, \"pm\"], [3, 39, \"pm\"], [3, 40, \"pm\"], [3, 41, \"pm\"], [3, 42, \"pm\"], [3, 43, \"pm\"], [3, 44, \"pm\"], [3, 45, \"pm\"], [3, 46, \"pm\"], [3, 47, \"pm\"], [3, 48, \"pm\"], [3, 49, \"pm\"], [3, 50, \"pm\"], [3, 51, \"pm\"], [3, 52, \"pm\"], [3, 53, \"pm\"], [3, 54, \"pm\"], [3, 55, \"pm\"], [3, 56, \"pm\"], [3, 57, \"pm\"], [3, 58, \"pm\"], [3, 59, \"pm\"], [4, 0, \"pm\"], [4, 1, \"pm\"], [4, 2, \"pm\"], [4, 3, \"pm\"], [4, 4, \"pm\"], [4, 5, \"pm\"], [4, 6, \"pm\"], [4, 7, \"pm\"], [4, 8, \"pm\"], [4, 9, \"pm\"], [4, 10, \"pm\"], [4, 11, \"pm\"], [4, 12, \"pm\"], [4, 13, \"pm\"], [4, 14, \"pm\"], [4, 15, \"pm\"], [4, 16, \"pm\"], [4, 17, \"pm\"], [4, 18, \"pm\"], [4, 19, \"pm\"], [4, 20, \"pm\"], [4, 21, \"pm\"], [4, 22, \"pm\"], [4, 23, \"pm\"], [4, 24, \"pm\"], [4, 25, \"pm\"], [4, 26, \"pm\"], [4, 27, \"pm\"], [4, 28, \"pm\"], [4, 29, \"pm\"], [4, 30, \"pm\"], [4, 31, \"pm\"], [4, 32, \"pm\"], [4, 33, \"pm\"], [4, 34, \"pm\"], [4, 35, \"pm\"], [4, 36, \"pm\"], [4, 37, \"pm\"], [4, 38, \"pm\"], [4, 39, \"pm\"], [4, 40, \"pm\"], [4, 41, \"pm\"], [4, 42, \"pm\"], [4, 43, \"pm\"], [4, 44, \"pm\"], [4, 45, \"pm\"], [4, 46, \"pm\"], [4, 47, \"pm\"], [4, 48, \"pm\"], [4, 49, \"pm\"], [4, 50, \"pm\"], [4, 51, \"pm\"], [4, 52, \"pm\"], [4, 53, \"pm\"], [4, 54, \"pm\"], [4, 55, \"pm\"], [4, 56, \"pm\"], [4, 57, \"pm\"], [4, 58, \"pm\"], [4, 59, \"pm\"], [5, 0, \"pm\"], [5, 1, \"pm\"], [5, 2, \"pm\"], [5, 3, \"pm\"], [5, 4, \"pm\"], [5, 5, \"pm\"], [5, 6, \"pm\"], [5, 7, \"pm\"], [5, 8, \"pm\"], [5, 9, \"pm\"], [5, 10, \"pm\"], [5, 11, \"pm\"], [5, 12, \"pm\"], [5, 13, \"pm\"], [5, 14, \"pm\"], [5, 15, \"pm\"], [5, 16, \"pm\"], [5, 17, \"pm\"], [5, 18, \"pm\"], [5, 19, \"pm\"], [5, 20, \"pm\"], [5, 21, \"pm\"], [5, 22, \"pm\"], [5, 23, \"pm\"], [5, 24, \"pm\"], [5, 25, \"pm\"], [5, 26, \"pm\"], [5, 27, \"pm\"], [5, 28, \"pm\"], [5, 29, \"pm\"], [5, 30, \"pm\"], [5, 31, \"pm\"], [5, 32, \"pm\"], [5, 33, \"pm\"], [5, 34, \"pm\"], [5, 35, \"pm\"], [5, 36, \"pm\"], [5, 37, \"pm\"], [5, 38, \"pm\"], [5, 39, \"pm\"], [5, 40, \"pm\"], [5, 41, \"pm\"], [5, 42, \"pm\"], [5, 43, \"pm\"], [5, 44, \"pm\"], [5, 45, \"pm\"], [5, 46, \"pm\"], [5, 47, \"pm\"], [5, 48, \"pm\"], [5, 49, \"pm\"], [5, 50, \"pm\"], [5, 51, \"pm\"], [5, 52, \"pm\"], [5, 53, \"pm\"], [5, 54, \"pm\"], [5, 55, \"pm\"], [5, 56, \"pm\"], [5, 57, \"pm\"], [5, 58, \"pm\"], [5, 59, \"pm\"], [6, 0, \"pm\"], [6, 1, \"pm\"], [6, 2, \"pm\"], [6, 3, \"pm\"], [6, 4, \"pm\"], [6, 5, \"pm\"], [6, 6, \"pm\"], [6, 7, \"pm\"], [6, 8, \"pm\"], [6, 9, \"pm\"], [6, 10, \"pm\"], [6, 11, \"pm\"], [6, 12, \"pm\"], [6, 13, \"pm\"], [6, 14, \"pm\"], [6, 15, \"pm\"], [6, 16, \"pm\"], [6, 17, \"pm\"], [6, 18, \"pm\"], [6, 19, \"pm\"], [6, 20, \"pm\"], [6, 21, \"pm\"], [6, 22, \"pm\"], [6, 23, \"pm\"], [6, 24, \"pm\"], [6, 25, \"pm\"], [6, 26, \"pm\"], [6, 27, \"pm\"], [6, 28, \"pm\"], [6, 29, \"pm\"], [6, 30, \"pm\"], [6, 31, \"pm\"], [6, 32, \"pm\"], [6, 33, \"pm\"], [6, 34, \"pm\"], [6, 35, \"pm\"], [6, 36, \"pm\"], [6, 37, \"pm\"], [6, 38, \"pm\"], [6, 39, \"pm\"], [6, 40, \"pm\"], [6, 41, \"pm\"], [6, 42, \"pm\"], [6, 43, \"pm\"], [6, 44, \"pm\"], [6, 45, \"pm\"], [6, 46, \"pm\"], [6, 47, \"pm\"], [6, 48, \"pm\"], [6, 49, \"pm\"], [6, 50, \"pm\"], [6, 51, \"pm\"], [6, 52, \"pm\"], [6, 53, \"pm\"], [6, 54, \"pm\"], [6, 55, \"pm\"], [6, 56, \"pm\"], [6, 57, \"pm\"], [6, 58, \"pm\"], [6, 59, \"pm\"], [7, 0, \"pm\"], [7, 1, \"pm\"], [7, 2, \"pm\"], [7, 3, \"pm\"], [7, 4, \"pm\"], [7, 5, \"pm\"], [7, 6, \"pm\"], [7, 7, \"pm\"], [7, 8, \"pm\"], [7, 9, \"pm\"], [7, 10, \"pm\"], [7, 11, \"pm\"], [7, 12, \"pm\"], [7, 13, \"pm\"], [7, 14, \"pm\"], [7, 15, \"pm\"], [7, 16, \"pm\"], [7, 17, \"pm\"], [7, 18, \"pm\"], [7, 19, \"pm\"], [7, 20, \"pm\"], [7, 21, \"pm\"], [7, 22, \"pm\"], [7, 23, \"pm\"], [7, 24, \"pm\"], [7, 25, \"pm\"], [7, 26, \"pm\"], [7, 27, \"pm\"], [7, 28, \"pm\"], [7, 29, \"pm\"], [7, 30, \"pm\"], [7, 31, \"pm\"], [7, 32, \"pm\"], [7, 33, \"pm\"], [7, 34, \"pm\"], [7, 35, \"pm\"], [7, 36, \"pm\"], [7, 37, \"pm\"], [7, 38, \"pm\"], [7, 39, \"pm\"], [7, 40, \"pm\"], [7, 41, \"pm\"], [7, 42, \"pm\"], [7, 43, \"pm\"], [7, 44, \"pm\"], [7, 45, \"pm\"], [7, 46, \"pm\"], [7, 47, \"pm\"], [7, 48, \"pm\"], [7, 49, \"pm\"], [7, 50, \"pm\"], [7, 51, \"pm\"], [7, 52, \"pm\"], [7, 53, \"pm\"], [7, 54, \"pm\"], [7, 55, \"pm\"], [7, 56, \"pm\"], [7, 57, \"pm\"], [7, 58, \"pm\"], [7, 59, \"pm\"], [8, 0, \"pm\"], [8, 1, \"pm\"], [8, 2, \"pm\"], [8, 3, \"pm\"], [8, 4, \"pm\"], [8, 5, \"pm\"], [8, 6, \"pm\"], [8, 7, \"pm\"], [8, 8, \"pm\"], [8, 9, \"pm\"], [8, 10, \"pm\"], [8, 11, \"pm\"], [8, 12, \"pm\"], [8, 13, \"pm\"], [8, 14, \"pm\"], [8, 15, \"pm\"], [8, 16, \"pm\"], [8, 17, \"pm\"], [8, 18, \"pm\"], [8, 19, \"pm\"], [8, 20, \"pm\"], [8, 21, \"pm\"], [8, 22, \"pm\"], [8, 23, \"pm\"], [8, 24, \"pm\"], [8, 25, \"pm\"], [8, 26, \"pm\"], [8, 27, \"pm\"], [8, 28, \"pm\"], [8, 29, \"pm\"], [8, 30, \"pm\"], [8, 31, \"pm\"], [8, 32, \"pm\"], [8, 33, \"pm\"], [8, 34, \"pm\"], [8, 35, \"pm\"], [8, 36, \"pm\"], [8, 37, \"pm\"], [8, 38, \"pm\"], [8, 39, \"pm\"], [8, 40, \"pm\"], [8, 41, \"pm\"], [8, 42, \"pm\"], [8, 43, \"pm\"], [8, 44, \"pm\"], [8, 45, \"pm\"], [8, 46, \"pm\"], [8, 47, \"pm\"], [8, 48, \"pm\"], [8, 49, \"pm\"], [8, 50, \"pm\"], [8, 51, \"pm\"], [8, 52, \"pm\"], [8, 53, \"pm\"], [8, 54, \"pm\"], [8, 55, \"pm\"], [8, 56, \"pm\"], [8, 57, \"pm\"], [8, 58, \"pm\"], [8, 59, \"pm\"], [9, 0, \"pm\"], [9, 1, \"pm\"], [9, 2, \"pm\"], [9, 3, \"pm\"], [9, 4, \"pm\"], [9, 5, \"pm\"], [9, 6, \"pm\"], [9, 7, \"pm\"], [9, 8, \"pm\"], [9, 9, \"pm\"], [9, 10, \"pm\"], [9, 11, \"pm\"], [9, 12, \"pm\"], [9, 13, \"pm\"], [9, 14, \"pm\"], [9, 15, \"pm\"], [9, 16, \"pm\"], [9, 17, \"pm\"], [9, 18, \"pm\"], [9, 19, \"pm\"], [9, 20, \"pm\"], [9, 21, \"pm\"], [9, 22, \"pm\"], [9, 23, \"pm\"], [9, 24, \"pm\"], [9, 25, \"pm\"], [9, 26, \"pm\"], [9, 27, \"pm\"], [9, 28, \"pm\"], [9, 29, \"pm\"], [9, 30, \"pm\"], [9, 31, \"pm\"], [9, 32, \"pm\"], [9, 33, \"pm\"], [9, 34, \"pm\"], [9, 35, \"pm\"], [9, 36, \"pm\"], [9, 37, \"pm\"], [9, 38, \"pm\"], [9, 39, \"pm\"], [9, 40, \"pm\"], [9, 41, \"pm\"], [9, 42, \"pm\"], [9, 43, \"pm\"], [9, 44, \"pm\"], [9, 45, \"pm\"], [9, 46, \"pm\"], [9, 47, \"pm\"], [9, 48, \"pm\"], [9, 49, \"pm\"], [9, 50, \"pm\"], [9, 51, \"pm\"], [9, 52, \"pm\"], [9, 53, \"pm\"], [9, 54, \"pm\"], [9, 55, \"pm\"], [9, 56, \"pm\"], [9, 57, \"pm\"], [9, 58, \"pm\"], [9, 59, \"pm\"], [10, 0, \"pm\"], [10, 1, \"pm\"], [10, 2, \"pm\"], [10, 3, \"pm\"], [10, 4, \"pm\"], [10, 5, \"pm\"], [10, 6, \"pm\"], [10, 7, \"pm\"], [10, 8, \"pm\"], [10, 9, \"pm\"], [10, 10, \"pm\"], [10, 11, \"pm\"], [10, 12, \"pm\"], [10, 13, \"pm\"], [10, 14, \"pm\"], [10, 15, \"pm\"], [10, 16, \"pm\"], [10, 17, \"pm\"], [10, 18, \"pm\"], [10, 19, \"pm\"], [10, 20, \"pm\"], [10, 21, \"pm\"], [10, 22, \"pm\"], [10, 23, \"pm\"], [10, 24, \"pm\"], [10, 25, \"pm\"], [10, 26, \"pm\"], [10, 27, \"pm\"], [10, 28, \"pm\"], [10, 29, \"pm\"], [10, 30, \"pm\"], [10, 31, \"pm\"], [10, 32, \"pm\"], [10, 33, \"pm\"], [10, 34, \"pm\"], [10, 35, \"pm\"], [10, 36, \"pm\"], [10, 37, \"pm\"], [10, 38, \"pm\"], [10, 39, \"pm\"], [10, 40, \"pm\"], [10, 41, \"pm\"], [10, 42, \"pm\"], [10, 43, \"pm\"], [10, 44, \"pm\"], [10, 45, \"pm\"], [10, 46, \"pm\"], [10, 47, \"pm\"], [10, 48, \"pm\"], [10, 49, \"pm\"], [10, 50, \"pm\"], [10, 51, \"pm\"], [10, 52, \"pm\"], [10, 53, \"pm\"], [10, 54, \"pm\"], [10, 55, \"pm\"], [10, 56, \"pm\"], [10, 57, \"pm\"], [10, 58, \"pm\"], [10, 59, \"pm\"], [11, 0, \"pm\"], [11, 1, \"pm\"], [11, 2, \"pm\"], [11, 3, \"pm\"], [11, 4, \"pm\"], [11, 5, \"pm\"], [11, 6, \"pm\"], [11, 7, \"pm\"], [11, 8, \"pm\"], [11, 9, \"pm\"], [11, 10, \"pm\"], [11, 11, \"pm\"], [11, 12, \"pm\"], [11, 13, \"pm\"], [11, 14, \"pm\"], [11, 15, \"pm\"], [11, 16, \"pm\"], [11, 17, \"pm\"], [11, 18, \"pm\"], [11, 19, \"pm\"], [11, 20, \"pm\"], [11, 21, \"pm\"], [11, 22, \"pm\"], [11, 23, \"pm\"], [11, 24, \"pm\"], [11, 25, \"pm\"], [11, 26, \"pm\"], [11, 27, \"pm\"], [11, 28, \"pm\"], [11, 29, \"pm\"], [11, 30, \"pm\"], [11, 31, \"pm\"], [11, 32, \"pm\"], [11, 33, \"pm\"], [11, 34, \"pm\"], [11, 35, \"pm\"], [11, 36, \"pm\"], [11, 37, \"pm\"], [11, 38, \"pm\"], [11, 39, \"pm\"], [11, 40, \"pm\"], [11, 41, \"pm\"], [11, 42, \"pm\"], [11, 43, \"pm\"], [11, 44, \"pm\"], [11, 45, \"pm\"], [11, 46, \"pm\"], [11, 47, \"pm\"], [11, 48, \"pm\"], [11, 49, \"pm\"], [11, 50, \"pm\"], [11, 51, \"pm\"], [11, 52, \"pm\"], [11, 53, \"pm\"], [11, 54, \"pm\"], [11, 55, \"pm\"], [11, 56, \"pm\"], [11, 57, \"pm\"], [11, 58, \"pm\"], [11, 59, \"pm\"]], \"outputs\": [[\"0000\"], [\"0001\"], [\"0002\"], [\"0003\"], [\"0004\"], [\"0005\"], [\"0006\"], [\"0007\"], [\"0008\"], [\"0009\"], [\"0010\"], [\"0011\"], [\"0012\"], [\"0013\"], [\"0014\"], [\"0015\"], [\"0016\"], [\"0017\"], [\"0018\"], [\"0019\"], [\"0020\"], [\"0021\"], [\"0022\"], [\"0023\"], [\"0024\"], [\"0025\"], [\"0026\"], [\"0027\"], [\"0028\"], [\"0029\"], [\"0030\"], [\"0031\"], [\"0032\"], [\"0033\"], [\"0034\"], [\"0035\"], [\"0036\"], [\"0037\"], [\"0038\"], [\"0039\"], [\"0040\"], [\"0041\"], [\"0042\"], [\"0043\"], [\"0044\"], [\"0045\"], [\"0046\"], [\"0047\"], [\"0048\"], [\"0049\"], [\"0050\"], [\"0051\"], [\"0052\"], [\"0053\"], [\"0054\"], [\"0055\"], [\"0056\"], [\"0057\"], [\"0058\"], [\"0059\"], [\"0100\"], [\"0101\"], [\"0102\"], [\"0103\"], [\"0104\"], [\"0105\"], [\"0106\"], [\"0107\"], [\"0108\"], [\"0109\"], [\"0110\"], [\"0111\"], [\"0112\"], [\"0113\"], [\"0114\"], [\"0115\"], [\"0116\"], [\"0117\"], [\"0118\"], [\"0119\"], [\"0120\"], [\"0121\"], [\"0122\"], [\"0123\"], [\"0124\"], [\"0125\"], [\"0126\"], [\"0127\"], [\"0128\"], [\"0129\"], [\"0130\"], [\"0131\"], [\"0132\"], [\"0133\"], [\"0134\"], [\"0135\"], [\"0136\"], [\"0137\"], [\"0138\"], [\"0139\"], [\"0140\"], [\"0141\"], [\"0142\"], [\"0143\"], [\"0144\"], [\"0145\"], [\"0146\"], [\"0147\"], [\"0148\"], [\"0149\"], [\"0150\"], [\"0151\"], [\"0152\"], [\"0153\"], [\"0154\"], [\"0155\"], [\"0156\"], [\"0157\"], [\"0158\"], [\"0159\"], [\"0200\"], [\"0201\"], [\"0202\"], [\"0203\"], [\"0204\"], [\"0205\"], [\"0206\"], [\"0207\"], [\"0208\"], [\"0209\"], [\"0210\"], [\"0211\"], [\"0212\"], [\"0213\"], [\"0214\"], [\"0215\"], [\"0216\"], [\"0217\"], [\"0218\"], [\"0219\"], [\"0220\"], [\"0221\"], [\"0222\"], [\"0223\"], [\"0224\"], [\"0225\"], [\"0226\"], [\"0227\"], [\"0228\"], [\"0229\"], [\"0230\"], [\"0231\"], [\"0232\"], [\"0233\"], [\"0234\"], [\"0235\"], [\"0236\"], [\"0237\"], [\"0238\"], [\"0239\"], [\"0240\"], [\"0241\"], [\"0242\"], [\"0243\"], [\"0244\"], [\"0245\"], [\"0246\"], [\"0247\"], [\"0248\"], [\"0249\"], [\"0250\"], [\"0251\"], [\"0252\"], [\"0253\"], [\"0254\"], [\"0255\"], [\"0256\"], [\"0257\"], [\"0258\"], [\"0259\"], [\"0300\"], [\"0301\"], [\"0302\"], [\"0303\"], [\"0304\"], [\"0305\"], [\"0306\"], [\"0307\"], [\"0308\"], [\"0309\"], [\"0310\"], [\"0311\"], [\"0312\"], [\"0313\"], [\"0314\"], [\"0315\"], [\"0316\"], [\"0317\"], [\"0318\"], [\"0319\"], [\"0320\"], [\"0321\"], [\"0322\"], [\"0323\"], [\"0324\"], [\"0325\"], [\"0326\"], [\"0327\"], [\"0328\"], [\"0329\"], [\"0330\"], [\"0331\"], [\"0332\"], [\"0333\"], [\"0334\"], [\"0335\"], [\"0336\"], [\"0337\"], [\"0338\"], [\"0339\"], [\"0340\"], [\"0341\"], [\"0342\"], [\"0343\"], [\"0344\"], [\"0345\"], [\"0346\"], [\"0347\"], [\"0348\"], [\"0349\"], [\"0350\"], [\"0351\"], [\"0352\"], [\"0353\"], [\"0354\"], [\"0355\"], [\"0356\"], [\"0357\"], [\"0358\"], [\"0359\"], [\"0400\"], [\"0401\"], [\"0402\"], [\"0403\"], [\"0404\"], [\"0405\"], [\"0406\"], [\"0407\"], [\"0408\"], [\"0409\"], [\"0410\"], [\"0411\"], [\"0412\"], [\"0413\"], [\"0414\"], [\"0415\"], [\"0416\"], [\"0417\"], [\"0418\"], [\"0419\"], [\"0420\"], [\"0421\"], [\"0422\"], [\"0423\"], [\"0424\"], [\"0425\"], [\"0426\"], [\"0427\"], [\"0428\"], [\"0429\"], [\"0430\"], [\"0431\"], [\"0432\"], [\"0433\"], [\"0434\"], [\"0435\"], [\"0436\"], [\"0437\"], [\"0438\"], [\"0439\"], [\"0440\"], [\"0441\"], [\"0442\"], [\"0443\"], [\"0444\"], [\"0445\"], [\"0446\"], [\"0447\"], [\"0448\"], [\"0449\"], [\"0450\"], [\"0451\"], [\"0452\"], [\"0453\"], [\"0454\"], [\"0455\"], [\"0456\"], [\"0457\"], [\"0458\"], [\"0459\"], [\"0500\"], [\"0501\"], [\"0502\"], [\"0503\"], [\"0504\"], [\"0505\"], [\"0506\"], [\"0507\"], [\"0508\"], [\"0509\"], [\"0510\"], [\"0511\"], [\"0512\"], [\"0513\"], [\"0514\"], [\"0515\"], [\"0516\"], [\"0517\"], [\"0518\"], [\"0519\"], [\"0520\"], [\"0521\"], [\"0522\"], [\"0523\"], [\"0524\"], [\"0525\"], [\"0526\"], [\"0527\"], [\"0528\"], [\"0529\"], [\"0530\"], [\"0531\"], [\"0532\"], [\"0533\"], [\"0534\"], [\"0535\"], [\"0536\"], [\"0537\"], [\"0538\"], [\"0539\"], [\"0540\"], [\"0541\"], [\"0542\"], [\"0543\"], [\"0544\"], [\"0545\"], [\"0546\"], [\"0547\"], [\"0548\"], [\"0549\"], [\"0550\"], [\"0551\"], [\"0552\"], [\"0553\"], [\"0554\"], [\"0555\"], [\"0556\"], [\"0557\"], [\"0558\"], [\"0559\"], [\"0600\"], [\"0601\"], [\"0602\"], [\"0603\"], [\"0604\"], [\"0605\"], [\"0606\"], [\"0607\"], [\"0608\"], [\"0609\"], [\"0610\"], [\"0611\"], [\"0612\"], [\"0613\"], [\"0614\"], [\"0615\"], [\"0616\"], [\"0617\"], [\"0618\"], [\"0619\"], [\"0620\"], [\"0621\"], [\"0622\"], [\"0623\"], [\"0624\"], [\"0625\"], [\"0626\"], [\"0627\"], [\"0628\"], [\"0629\"], [\"0630\"], [\"0631\"], [\"0632\"], [\"0633\"], [\"0634\"], [\"0635\"], [\"0636\"], [\"0637\"], [\"0638\"], [\"0639\"], [\"0640\"], [\"0641\"], [\"0642\"], [\"0643\"], [\"0644\"], [\"0645\"], [\"0646\"], [\"0647\"], [\"0648\"], [\"0649\"], [\"0650\"], [\"0651\"], [\"0652\"], [\"0653\"], [\"0654\"], [\"0655\"], [\"0656\"], [\"0657\"], [\"0658\"], [\"0659\"], [\"0700\"], [\"0701\"], [\"0702\"], [\"0703\"], [\"0704\"], [\"0705\"], [\"0706\"], [\"0707\"], [\"0708\"], [\"0709\"], [\"0710\"], [\"0711\"], [\"0712\"], [\"0713\"], [\"0714\"], [\"0715\"], [\"0716\"], [\"0717\"], [\"0718\"], [\"0719\"], [\"0720\"], [\"0721\"], [\"0722\"], [\"0723\"], [\"0724\"], [\"0725\"], [\"0726\"], [\"0727\"], [\"0728\"], [\"0729\"], [\"0730\"], [\"0731\"], [\"0732\"], [\"0733\"], [\"0734\"], [\"0735\"], [\"0736\"], [\"0737\"], [\"0738\"], [\"0739\"], [\"0740\"], [\"0741\"], [\"0742\"], [\"0743\"], [\"0744\"], [\"0745\"], [\"0746\"], [\"0747\"], [\"0748\"], [\"0749\"], [\"0750\"], [\"0751\"], [\"0752\"], [\"0753\"], [\"0754\"], [\"0755\"], [\"0756\"], [\"0757\"], [\"0758\"], [\"0759\"], [\"0800\"], [\"0801\"], [\"0802\"], [\"0803\"], [\"0804\"], [\"0805\"], [\"0806\"], [\"0807\"], [\"0808\"], [\"0809\"], [\"0810\"], [\"0811\"], [\"0812\"], [\"0813\"], [\"0814\"], [\"0815\"], [\"0816\"], [\"0817\"], [\"0818\"], [\"0819\"], [\"0820\"], [\"0821\"], [\"0822\"], [\"0823\"], [\"0824\"], [\"0825\"], [\"0826\"], [\"0827\"], [\"0828\"], [\"0829\"], [\"0830\"], [\"0831\"], [\"0832\"], [\"0833\"], [\"0834\"], [\"0835\"], [\"0836\"], [\"0837\"], [\"0838\"], [\"0839\"], [\"0840\"], [\"0841\"], [\"0842\"], [\"0843\"], [\"0844\"], [\"0845\"], [\"0846\"], [\"0847\"], [\"0848\"], [\"0849\"], [\"0850\"], [\"0851\"], [\"0852\"], [\"0853\"], [\"0854\"], [\"0855\"], [\"0856\"], [\"0857\"], [\"0858\"], [\"0859\"], [\"0900\"], [\"0901\"], [\"0902\"], [\"0903\"], [\"0904\"], [\"0905\"], [\"0906\"], [\"0907\"], [\"0908\"], [\"0909\"], [\"0910\"], [\"0911\"], [\"0912\"], [\"0913\"], [\"0914\"], [\"0915\"], [\"0916\"], [\"0917\"], [\"0918\"], [\"0919\"], [\"0920\"], [\"0921\"], [\"0922\"], [\"0923\"], [\"0924\"], [\"0925\"], [\"0926\"], [\"0927\"], [\"0928\"], [\"0929\"], [\"0930\"], [\"0931\"], [\"0932\"], [\"0933\"], [\"0934\"], [\"0935\"], [\"0936\"], [\"0937\"], [\"0938\"], [\"0939\"], [\"0940\"], [\"0941\"], [\"0942\"], [\"0943\"], [\"0944\"], [\"0945\"], [\"0946\"], [\"0947\"], [\"0948\"], [\"0949\"], [\"0950\"], [\"0951\"], [\"0952\"], [\"0953\"], [\"0954\"], [\"0955\"], [\"0956\"], [\"0957\"], [\"0958\"], [\"0959\"], [\"1000\"], [\"1001\"], [\"1002\"], [\"1003\"], [\"1004\"], [\"1005\"], [\"1006\"], [\"1007\"], [\"1008\"], [\"1009\"], [\"1010\"], [\"1011\"], [\"1012\"], [\"1013\"], [\"1014\"], [\"1015\"], [\"1016\"], [\"1017\"], [\"1018\"], [\"1019\"], [\"1020\"], [\"1021\"], [\"1022\"], [\"1023\"], [\"1024\"], [\"1025\"], [\"1026\"], [\"1027\"], [\"1028\"], [\"1029\"], [\"1030\"], [\"1031\"], [\"1032\"], [\"1033\"], [\"1034\"], [\"1035\"], [\"1036\"], [\"1037\"], [\"1038\"], [\"1039\"], [\"1040\"], [\"1041\"], [\"1042\"], [\"1043\"], [\"1044\"], [\"1045\"], [\"1046\"], [\"1047\"], [\"1048\"], [\"1049\"], [\"1050\"], [\"1051\"], [\"1052\"], [\"1053\"], [\"1054\"], [\"1055\"], [\"1056\"], [\"1057\"], [\"1058\"], [\"1059\"], [\"1100\"], [\"1101\"], [\"1102\"], [\"1103\"], [\"1104\"], [\"1105\"], [\"1106\"], [\"1107\"], [\"1108\"], [\"1109\"], [\"1110\"], [\"1111\"], [\"1112\"], [\"1113\"], [\"1114\"], [\"1115\"], [\"1116\"], [\"1117\"], [\"1118\"], [\"1119\"], [\"1120\"], [\"1121\"], [\"1122\"], [\"1123\"], [\"1124\"], [\"1125\"], [\"1126\"], [\"1127\"], [\"1128\"], [\"1129\"], [\"1130\"], [\"1131\"], [\"1132\"], [\"1133\"], [\"1134\"], [\"1135\"], [\"1136\"], [\"1137\"], [\"1138\"], [\"1139\"], [\"1140\"], [\"1141\"], [\"1142\"], [\"1143\"], [\"1144\"], [\"1145\"], [\"1146\"], [\"1147\"], [\"1148\"], [\"1149\"], [\"1150\"], [\"1151\"], [\"1152\"], [\"1153\"], [\"1154\"], [\"1155\"], [\"1156\"], [\"1157\"], [\"1158\"], [\"1159\"], [\"1200\"], [\"1201\"], [\"1202\"], [\"1203\"], [\"1204\"], [\"1205\"], [\"1206\"], [\"1207\"], [\"1208\"], [\"1209\"], [\"1210\"], [\"1211\"], [\"1212\"], [\"1213\"], [\"1214\"], [\"1215\"], [\"1216\"], [\"1217\"], [\"1218\"], [\"1219\"], [\"1220\"], [\"1221\"], [\"1222\"], [\"1223\"], [\"1224\"], [\"1225\"], [\"1226\"], [\"1227\"], [\"1228\"], [\"1229\"], [\"1230\"], [\"1231\"], [\"1232\"], [\"1233\"], [\"1234\"], [\"1235\"], [\"1236\"], [\"1237\"], [\"1238\"], [\"1239\"], [\"1240\"], [\"1241\"], [\"1242\"], [\"1243\"], [\"1244\"], [\"1245\"], [\"1246\"], [\"1247\"], [\"1248\"], [\"1249\"], [\"1250\"], [\"1251\"], [\"1252\"], [\"1253\"], [\"1254\"], [\"1255\"], [\"1256\"], [\"1257\"], [\"1258\"], [\"1259\"], [\"1300\"], [\"1301\"], [\"1302\"], [\"1303\"], [\"1304\"], [\"1305\"], [\"1306\"], [\"1307\"], [\"1308\"], [\"1309\"], [\"1310\"], [\"1311\"], [\"1312\"], [\"1313\"], [\"1314\"], [\"1315\"], [\"1316\"], [\"1317\"], [\"1318\"], [\"1319\"], [\"1320\"], [\"1321\"], [\"1322\"], [\"1323\"], [\"1324\"], [\"1325\"], [\"1326\"], [\"1327\"], [\"1328\"], [\"1329\"], [\"1330\"], [\"1331\"], [\"1332\"], [\"1333\"], [\"1334\"], [\"1335\"], [\"1336\"], [\"1337\"], [\"1338\"], [\"1339\"], [\"1340\"], [\"1341\"], [\"1342\"], [\"1343\"], [\"1344\"], [\"1345\"], [\"1346\"], [\"1347\"], [\"1348\"], [\"1349\"], [\"1350\"], [\"1351\"], [\"1352\"], [\"1353\"], [\"1354\"], [\"1355\"], [\"1356\"], [\"1357\"], [\"1358\"], [\"1359\"], [\"1400\"], [\"1401\"], [\"1402\"], [\"1403\"], [\"1404\"], [\"1405\"], [\"1406\"], [\"1407\"], [\"1408\"], [\"1409\"], [\"1410\"], [\"1411\"], [\"1412\"], [\"1413\"], [\"1414\"], [\"1415\"], [\"1416\"], [\"1417\"], [\"1418\"], [\"1419\"], [\"1420\"], [\"1421\"], [\"1422\"], [\"1423\"], [\"1424\"], [\"1425\"], [\"1426\"], [\"1427\"], [\"1428\"], [\"1429\"], [\"1430\"], [\"1431\"], [\"1432\"], [\"1433\"], [\"1434\"], [\"1435\"], [\"1436\"], [\"1437\"], [\"1438\"], [\"1439\"], [\"1440\"], [\"1441\"], [\"1442\"], [\"1443\"], [\"1444\"], [\"1445\"], [\"1446\"], [\"1447\"], [\"1448\"], [\"1449\"], [\"1450\"], [\"1451\"], [\"1452\"], [\"1453\"], [\"1454\"], [\"1455\"], [\"1456\"], [\"1457\"], [\"1458\"], [\"1459\"], [\"1500\"], [\"1501\"], [\"1502\"], [\"1503\"], [\"1504\"], [\"1505\"], [\"1506\"], [\"1507\"], [\"1508\"], [\"1509\"], [\"1510\"], [\"1511\"], [\"1512\"], [\"1513\"], [\"1514\"], [\"1515\"], [\"1516\"], [\"1517\"], [\"1518\"], [\"1519\"], [\"1520\"], [\"1521\"], [\"1522\"], [\"1523\"], [\"1524\"], [\"1525\"], [\"1526\"], [\"1527\"], [\"1528\"], [\"1529\"], [\"1530\"], [\"1531\"], [\"1532\"], [\"1533\"], [\"1534\"], [\"1535\"], [\"1536\"], [\"1537\"], [\"1538\"], [\"1539\"], [\"1540\"], [\"1541\"], [\"1542\"], [\"1543\"], [\"1544\"], [\"1545\"], [\"1546\"], [\"1547\"], [\"1548\"], [\"1549\"], [\"1550\"], [\"1551\"], [\"1552\"], [\"1553\"], [\"1554\"], [\"1555\"], [\"1556\"], [\"1557\"], [\"1558\"], [\"1559\"], [\"1600\"], [\"1601\"], [\"1602\"], [\"1603\"], [\"1604\"], [\"1605\"], [\"1606\"], [\"1607\"], [\"1608\"], [\"1609\"], [\"1610\"], [\"1611\"], [\"1612\"], [\"1613\"], [\"1614\"], [\"1615\"], [\"1616\"], [\"1617\"], [\"1618\"], [\"1619\"], [\"1620\"], [\"1621\"], [\"1622\"], [\"1623\"], [\"1624\"], [\"1625\"], [\"1626\"], [\"1627\"], [\"1628\"], [\"1629\"], [\"1630\"], [\"1631\"], [\"1632\"], [\"1633\"], [\"1634\"], [\"1635\"], [\"1636\"], [\"1637\"], [\"1638\"], [\"1639\"], [\"1640\"], [\"1641\"], [\"1642\"], [\"1643\"], [\"1644\"], [\"1645\"], [\"1646\"], [\"1647\"], [\"1648\"], [\"1649\"], [\"1650\"], [\"1651\"], [\"1652\"], [\"1653\"], [\"1654\"], [\"1655\"], [\"1656\"], [\"1657\"], [\"1658\"], [\"1659\"], [\"1700\"], [\"1701\"], [\"1702\"], [\"1703\"], [\"1704\"], [\"1705\"], [\"1706\"], [\"1707\"], [\"1708\"], [\"1709\"], [\"1710\"], [\"1711\"], [\"1712\"], [\"1713\"], [\"1714\"], [\"1715\"], [\"1716\"], [\"1717\"], [\"1718\"], [\"1719\"], [\"1720\"], [\"1721\"], [\"1722\"], [\"1723\"], [\"1724\"], [\"1725\"], [\"1726\"], [\"1727\"], [\"1728\"], [\"1729\"], [\"1730\"], [\"1731\"], [\"1732\"], [\"1733\"], [\"1734\"], [\"1735\"], [\"1736\"], [\"1737\"], [\"1738\"], [\"1739\"], [\"1740\"], [\"1741\"], [\"1742\"], [\"1743\"], [\"1744\"], [\"1745\"], [\"1746\"], [\"1747\"], [\"1748\"], [\"1749\"], [\"1750\"], [\"1751\"], [\"1752\"], [\"1753\"], [\"1754\"], [\"1755\"], [\"1756\"], [\"1757\"], [\"1758\"], [\"1759\"], [\"1800\"], [\"1801\"], [\"1802\"], [\"1803\"], [\"1804\"], [\"1805\"], [\"1806\"], [\"1807\"], [\"1808\"], [\"1809\"], [\"1810\"], [\"1811\"], [\"1812\"], [\"1813\"], [\"1814\"], [\"1815\"], [\"1816\"], [\"1817\"], [\"1818\"], [\"1819\"], [\"1820\"], [\"1821\"], [\"1822\"], [\"1823\"], [\"1824\"], [\"1825\"], [\"1826\"], [\"1827\"], [\"1828\"], [\"1829\"], [\"1830\"], [\"1831\"], [\"1832\"], [\"1833\"], [\"1834\"], [\"1835\"], [\"1836\"], [\"1837\"], [\"1838\"], [\"1839\"], [\"1840\"], [\"1841\"], [\"1842\"], [\"1843\"], [\"1844\"], [\"1845\"], [\"1846\"], [\"1847\"], [\"1848\"], [\"1849\"], [\"1850\"], [\"1851\"], [\"1852\"], [\"1853\"], [\"1854\"], [\"1855\"], [\"1856\"], [\"1857\"], [\"1858\"], [\"1859\"], [\"1900\"], [\"1901\"], [\"1902\"], [\"1903\"], [\"1904\"], [\"1905\"], [\"1906\"], [\"1907\"], [\"1908\"], [\"1909\"], [\"1910\"], [\"1911\"], [\"1912\"], [\"1913\"], [\"1914\"], [\"1915\"], [\"1916\"], [\"1917\"], [\"1918\"], [\"1919\"], [\"1920\"], [\"1921\"], [\"1922\"], [\"1923\"], [\"1924\"], [\"1925\"], [\"1926\"], [\"1927\"], [\"1928\"], [\"1929\"], [\"1930\"], [\"1931\"], [\"1932\"], [\"1933\"], [\"1934\"], [\"1935\"], [\"1936\"], [\"1937\"], [\"1938\"], [\"1939\"], [\"1940\"], [\"1941\"], [\"1942\"], [\"1943\"], [\"1944\"], [\"1945\"], [\"1946\"], [\"1947\"], [\"1948\"], [\"1949\"], [\"1950\"], [\"1951\"], [\"1952\"], [\"1953\"], [\"1954\"], [\"1955\"], [\"1956\"], [\"1957\"], [\"1958\"], [\"1959\"], [\"2000\"], [\"2001\"], [\"2002\"], [\"2003\"], [\"2004\"], [\"2005\"], [\"2006\"], [\"2007\"], [\"2008\"], [\"2009\"], [\"2010\"], [\"2011\"], [\"2012\"], [\"2013\"], [\"2014\"], [\"2015\"], [\"2016\"], [\"2017\"], [\"2018\"], [\"2019\"], [\"2020\"], [\"2021\"], [\"2022\"], [\"2023\"], [\"2024\"], [\"2025\"], [\"2026\"], [\"2027\"], [\"2028\"], [\"2029\"], [\"2030\"], [\"2031\"], [\"2032\"], [\"2033\"], [\"2034\"], [\"2035\"], [\"2036\"], [\"2037\"], [\"2038\"], [\"2039\"], [\"2040\"], [\"2041\"], [\"2042\"], [\"2043\"], [\"2044\"], [\"2045\"], [\"2046\"], [\"2047\"], [\"2048\"], [\"2049\"], [\"2050\"], [\"2051\"], [\"2052\"], [\"2053\"], [\"2054\"], [\"2055\"], [\"2056\"], [\"2057\"], [\"2058\"], [\"2059\"], [\"2100\"], [\"2101\"], [\"2102\"], [\"2103\"], [\"2104\"], [\"2105\"], [\"2106\"], [\"2107\"], [\"2108\"], [\"2109\"], [\"2110\"], [\"2111\"], [\"2112\"], [\"2113\"], [\"2114\"], [\"2115\"], [\"2116\"], [\"2117\"], [\"2118\"], [\"2119\"], [\"2120\"], [\"2121\"], [\"2122\"], [\"2123\"], [\"2124\"], [\"2125\"], [\"2126\"], [\"2127\"], [\"2128\"], [\"2129\"], [\"2130\"], [\"2131\"], [\"2132\"], [\"2133\"], [\"2134\"], [\"2135\"], [\"2136\"], [\"2137\"], [\"2138\"], [\"2139\"], [\"2140\"], [\"2141\"], [\"2142\"], [\"2143\"], [\"2144\"], [\"2145\"], [\"2146\"], [\"2147\"], [\"2148\"], [\"2149\"], [\"2150\"], [\"2151\"], [\"2152\"], [\"2153\"], [\"2154\"], [\"2155\"], [\"2156\"], [\"2157\"], [\"2158\"], [\"2159\"], [\"2200\"], [\"2201\"], [\"2202\"], [\"2203\"], [\"2204\"], [\"2205\"], [\"2206\"], [\"2207\"], [\"2208\"], [\"2209\"], [\"2210\"], [\"2211\"], [\"2212\"], [\"2213\"], [\"2214\"], [\"2215\"], [\"2216\"], [\"2217\"], [\"2218\"], [\"2219\"], [\"2220\"], [\"2221\"], [\"2222\"], [\"2223\"], [\"2224\"], [\"2225\"], [\"2226\"], [\"2227\"], [\"2228\"], [\"2229\"], [\"2230\"], [\"2231\"], [\"2232\"], [\"2233\"], [\"2234\"], [\"2235\"], [\"2236\"], [\"2237\"], [\"2238\"], [\"2239\"], [\"2240\"], [\"2241\"], [\"2242\"], [\"2243\"], [\"2244\"], [\"2245\"], [\"2246\"], [\"2247\"], [\"2248\"], [\"2249\"], [\"2250\"], [\"2251\"], [\"2252\"], [\"2253\"], [\"2254\"], [\"2255\"], [\"2256\"], [\"2257\"], [\"2258\"], [\"2259\"], [\"2300\"], [\"2301\"], [\"2302\"], [\"2303\"], [\"2304\"], [\"2305\"], [\"2306\"], [\"2307\"], [\"2308\"], [\"2309\"], [\"2310\"], [\"2311\"], [\"2312\"], [\"2313\"], [\"2314\"], [\"2315\"], [\"2316\"], [\"2317\"], [\"2318\"], [\"2319\"], [\"2320\"], [\"2321\"], [\"2322\"], [\"2323\"], [\"2324\"], [\"2325\"], [\"2326\"], [\"2327\"], [\"2328\"], [\"2329\"], [\"2330\"], [\"2331\"], [\"2332\"], [\"2333\"], [\"2334\"], [\"2335\"], [\"2336\"], [\"2337\"], [\"2338\"], [\"2339\"], [\"2340\"], [\"2341\"], [\"2342\"], [\"2343\"], [\"2344\"], [\"2345\"], [\"2346\"], [\"2347\"], [\"2348\"], [\"2349\"], [\"2350\"], [\"2351\"], [\"2352\"], [\"2353\"], [\"2354\"], [\"2355\"], [\"2356\"], [\"2357\"], [\"2358\"], [\"2359\"]]}", "source": "primeintellect"}
Converting a normal (12-hour) time like "8:30 am" or "8:30 pm" to 24-hour time (like "0830" or "2030") sounds easy enough, right? Well, let's see if you can do it! You will have to define a function named "to24hourtime", and you will be given an hour (always in the range of 1 to 12, inclusive), a minute (always in the range of 0 to 59, inclusive), and a period (either "am" or "pm") as input. Your task is to return a four-digit string that encodes that time in 24-hour time. Write your solution by modifying this code: ```python def to24hourtime(hour, minute, period): ``` Your solution should implemented in the function "to24hourtime". The i Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [\"55\\n73792\\n39309\\n73808\\n47389\\n34803\\n87947\\n32460\\n14649\\n70151\\n35816\\n8272\\n78886\\n71345\\n61907\\n16977\\n85362\\n0\\n43792\\n8118\\n83254\\n89459\\n32230\\n87068\\n82617\\n94847\\n83528\\n37629\\n31438\\n97413\\n62260\\n13651\\n47564\\n43543\\n61292\\n51025\\n64106\\n0\\n19282\\n35422\\n19657\\n95170\\n10266\\n43771\\n3190\\n93962\\n11747\\n43021\\n91531\\n88370\\n1760\\n10950\\n77059\\n61741\\n52965\\n10445\\n\", \"49\\n8735\\n95244\\n50563\\n33648\\n10711\\n30217\\n49166\\n28240\\n0\\n97232\\n12428\\n16180\\n58610\\n61112\\n74423\\n56323\\n43327\\n0\\n12549\\n48493\\n43086\\n69266\\n27033\\n37338\\n43900\\n5570\\n25293\\n44517\\n7183\\n41969\\n31944\\n32247\\n96959\\n44890\\n98237\\n52601\\n29081\\n93641\\n14980\\n29539\\n84672\\n57310\\n91014\\n31721\\n6944\\n67672\\n22040\\n86269\\n86709\\n\", \"10\\n1\\n2\\n3\\n5\\n4\\n9\\n8\\n6\\n7\\n0\\n\", \"5\\n1\\n1\\n1\\n2\\n1\\n\", \"5\\n3\\n2\\n3\\n1\\n0\\n\", \"10\\n1\\n3\\n4\\n2\\n6\\n8\\n5\\n7\\n10\\n9\\n\", \"2\\n0\\n1\\n\", \"1\\n0\\n\", \"55\\n73792\\n39309\\n73808\\n47389\\n34803\\n87947\\n32460\\n14649\\n70151\\n35816\\n8272\\n78886\\n71345\\n61907\\n16977\\n85362\\n0\\n43792\\n8118\\n83254\\n89459\\n32230\\n87068\\n82617\\n94847\\n83528\\n37629\\n31438\\n97413\\n62260\\n13651\\n47564\\n43543\\n61292\\n51025\\n64106\\n0\\n19282\\n35422\\n19657\\n95170\\n10266\\n43771\\n3190\\n93962\\n11747\\n43021\\n91531\\n88370\\n1760\\n10950\\n18553\\n61741\\n52965\\n10445\\n\", \"49\\n8735\\n95244\\n50563\\n33412\\n10711\\n30217\\n49166\\n28240\\n0\\n97232\\n12428\\n16180\\n58610\\n61112\\n74423\\n56323\\n43327\\n0\\n12549\\n48493\\n43086\\n69266\\n27033\\n37338\\n43900\\n5570\\n25293\\n44517\\n7183\\n41969\\n31944\\n32247\\n96959\\n44890\\n98237\\n52601\\n29081\\n93641\\n14980\\n29539\\n84672\\n57310\\n91014\\n31721\\n6944\\n67672\\n22040\\n86269\\n86709\\n\", \"10\\n1\\n2\\n3\\n4\\n4\\n9\\n8\\n6\\n7\\n0\\n\", \"5\\n1\\n1\\n1\\n4\\n1\\n\", \"5\\n3\\n3\\n3\\n1\\n0\\n\", \"10\\n1\\n3\\n4\\n1\\n6\\n8\\n5\\n7\\n10\\n9\\n\", \"2\\n0\\n2\\n\", \"1\\n-1\\n\", \"10\\n-1\\n1\\n0\\n1\\n2\\n0\\n1\\n2\\n3\\n0\\n\", \"4\\n1\\n0\\n3\\n0\\n\", \"5\\n1\\n1\\n1\\n0\\n1\\n\", \"5\\n3\\n2\\n3\\n0\\n0\\n\", \"4\\n0\\n0\\n3\\n0\\n\", \"5\\n2\\n1\\n1\\n0\\n1\\n\", \"5\\n3\\n4\\n3\\n0\\n0\\n\", \"2\\n-1\\n4\\n\", \"10\\n-1\\n1\\n0\\n1\\n2\\n0\\n1\\n0\\n4\\n0\\n\", \"4\\n0\\n1\\n3\\n0\\n\", \"55\\n73792\\n39309\\n73808\\n47389\\n34803\\n87947\\n32460\\n14649\\n70151\\n35816\\n8272\\n78886\\n71345\\n61907\\n16977\\n85362\\n1\\n43792\\n8118\\n83254\\n89459\\n32230\\n87068\\n82617\\n94847\\n83528\\n37629\\n31438\\n97413\\n62260\\n13651\\n47564\\n43543\\n61292\\n51025\\n64106\\n0\\n19282\\n35422\\n19657\\n95170\\n10266\\n43771\\n3190\\n93962\\n11747\\n43021\\n91531\\n127083\\n1760\\n939\\n18553\\n61741\\n52965\\n10445\\n\", \"5\\n3\\n4\\n2\\n0\\n0\\n\", \"10\\n-1\\n1\\n1\\n1\\n2\\n0\\n1\\n0\\n4\\n0\\n\", \"4\\n0\\n1\\n3\\n1\\n\", \"5\\n3\\n4\\n4\\n0\\n0\\n\", \"2\\n0\\n0\\n\", \"10\\n1\\n2\\n2\\n7\\n2\\n9\\n8\\n6\\n13\\n0\\n\", \"55\\n73792\\n39309\\n73808\\n47389\\n34803\\n87947\\n32460\\n14649\\n70151\\n35816\\n8272\\n78886\\n71345\\n61907\\n16977\\n85362\\n0\\n43792\\n8118\\n83254\\n89459\\n32230\\n87068\\n82617\\n94847\\n83528\\n37629\\n31438\\n97413\\n62260\\n13651\\n47564\\n43543\\n61292\\n51025\\n64106\\n0\\n19282\\n35422\\n19657\\n95170\\n10266\\n43771\\n3190\\n93962\\n11747\\n43021\\n91531\\n88370\\n1760\\n939\\n18553\\n61741\\n52965\\n10445\\n\", \"49\\n8735\\n95244\\n50563\\n33412\\n10711\\n30217\\n49166\\n28240\\n0\\n97232\\n12428\\n16180\\n58610\\n61112\\n74423\\n56323\\n43327\\n0\\n12549\\n48493\\n43086\\n69266\\n27033\\n37338\\n43900\\n5570\\n25293\\n44517\\n7183\\n41969\\n31944\\n32247\\n96959\\n44890\\n98237\\n52601\\n29081\\n93641\\n14980\\n29539\\n84672\\n57310\\n91014\\n31721\\n6944\\n67672\\n22040\\n86269\\n67339\\n\", \"10\\n1\\n2\\n1\\n4\\n4\\n9\\n8\\n6\\n7\\n0\\n\", \"10\\n1\\n3\\n4\\n1\\n7\\n8\\n5\\n7\\n10\\n9\\n\", \"2\\n0\\n4\\n\", \"1\\n1\\n\", \"10\\n-1\\n1\\n0\\n1\\n2\\n0\\n1\\n2\\n4\\n0\\n\", \"55\\n73792\\n39309\\n73808\\n47389\\n34803\\n87947\\n32460\\n14649\\n70151\\n35816\\n8272\\n78886\\n71345\\n61907\\n16977\\n85362\\n0\\n43792\\n8118\\n83254\\n89459\\n32230\\n87068\\n82617\\n94847\\n83528\\n37629\\n31438\\n97413\\n62260\\n13651\\n47564\\n43543\\n61292\\n51025\\n64106\\n0\\n19282\\n35422\\n19657\\n95170\\n10266\\n43771\\n3190\\n93962\\n11747\\n43021\\n91531\\n127083\\n1760\\n939\\n18553\\n61741\\n52965\\n10445\\n\", \"49\\n8735\\n95244\\n50563\\n7070\\n10711\\n30217\\n49166\\n28240\\n0\\n97232\\n12428\\n16180\\n58610\\n61112\\n74423\\n56323\\n43327\\n0\\n12549\\n48493\\n43086\\n69266\\n27033\\n37338\\n43900\\n5570\\n25293\\n44517\\n7183\\n41969\\n31944\\n32247\\n96959\\n44890\\n98237\\n52601\\n29081\\n93641\\n14980\\n29539\\n84672\\n57310\\n91014\\n31721\\n6944\\n67672\\n22040\\n86269\\n67339\\n\", \"10\\n1\\n2\\n1\\n4\\n2\\n9\\n8\\n6\\n7\\n0\\n\", \"10\\n1\\n3\\n4\\n1\\n2\\n8\\n5\\n7\\n10\\n9\\n\", \"1\\n2\\n\", \"49\\n8735\\n95244\\n50563\\n7070\\n10711\\n30217\\n49166\\n28240\\n0\\n97232\\n12428\\n16180\\n58610\\n61112\\n74423\\n56323\\n43327\\n0\\n12549\\n48493\\n43086\\n69266\\n27033\\n37338\\n43900\\n5570\\n25293\\n44517\\n7183\\n41969\\n31944\\n32247\\n96959\\n44890\\n98237\\n52601\\n29081\\n93641\\n12785\\n29539\\n84672\\n57310\\n91014\\n31721\\n6944\\n67672\\n22040\\n86269\\n67339\\n\", \"10\\n1\\n2\\n2\\n4\\n2\\n9\\n8\\n6\\n7\\n0\\n\", \"5\\n2\\n1\\n1\\n-1\\n1\\n\", \"10\\n1\\n3\\n4\\n1\\n2\\n8\\n5\\n12\\n10\\n9\\n\", \"2\\n-1\\n1\\n\", \"1\\n4\\n\", \"55\\n73792\\n39309\\n73808\\n47389\\n34803\\n87947\\n32460\\n14649\\n70151\\n35816\\n8272\\n78886\\n71345\\n61907\\n262\\n85362\\n1\\n43792\\n8118\\n83254\\n89459\\n32230\\n87068\\n82617\\n94847\\n83528\\n37629\\n31438\\n97413\\n62260\\n13651\\n47564\\n43543\\n61292\\n51025\\n64106\\n0\\n19282\\n35422\\n19657\\n95170\\n10266\\n43771\\n3190\\n93962\\n11747\\n43021\\n91531\\n127083\\n1760\\n939\\n18553\\n61741\\n52965\\n10445\\n\", \"49\\n8735\\n95244\\n50563\\n7070\\n10711\\n30217\\n49166\\n28240\\n0\\n97232\\n12428\\n16180\\n58610\\n61112\\n74423\\n56323\\n43327\\n0\\n12549\\n48493\\n43086\\n69266\\n27033\\n37338\\n43900\\n5570\\n25293\\n44517\\n7183\\n41969\\n31944\\n32247\\n96959\\n44890\\n98237\\n52601\\n29081\\n93641\\n12785\\n29539\\n84672\\n57310\\n91014\\n31721\\n6944\\n134348\\n22040\\n86269\\n67339\\n\", \"10\\n1\\n2\\n2\\n7\\n2\\n9\\n8\\n6\\n7\\n0\\n\", \"5\\n2\\n2\\n1\\n-1\\n1\\n\", \"10\\n1\\n3\\n5\\n1\\n2\\n8\\n5\\n12\\n10\\n9\\n\", \"1\\n8\\n\", \"10\\n-1\\n1\\n1\\n1\\n3\\n0\\n1\\n0\\n4\\n0\\n\", \"4\\n0\\n1\\n5\\n1\\n\", \"55\\n73792\\n39309\\n73808\\n47389\\n34803\\n87947\\n32460\\n14649\\n70151\\n35816\\n8272\\n78886\\n71345\\n61907\\n262\\n85362\\n1\\n71728\\n8118\\n83254\\n89459\\n32230\\n87068\\n82617\\n94847\\n83528\\n37629\\n31438\\n97413\\n62260\\n13651\\n47564\\n43543\\n61292\\n51025\\n64106\\n0\\n19282\\n35422\\n19657\\n95170\\n10266\\n43771\\n3190\\n93962\\n11747\\n43021\\n91531\\n127083\\n1760\\n939\\n18553\\n61741\\n52965\\n10445\\n\", \"49\\n8735\\n95244\\n50563\\n7070\\n10711\\n30217\\n49166\\n28240\\n0\\n97232\\n12428\\n16180\\n58610\\n61112\\n74423\\n56323\\n43327\\n0\\n12549\\n48493\\n43086\\n69266\\n48884\\n37338\\n43900\\n5570\\n25293\\n44517\\n7183\\n41969\\n31944\\n32247\\n96959\\n44890\\n98237\\n52601\\n29081\\n93641\\n12785\\n29539\\n84672\\n57310\\n91014\\n31721\\n6944\\n134348\\n22040\\n86269\\n67339\\n\", \"10\\n0\\n1\\n0\\n1\\n2\\n0\\n1\\n2\\n3\\n0\\n\", \"4\\n1\\n2\\n3\\n0\\n\"], \"outputs\": [\"pushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushStack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushFront\\npushBack\\npushBack\\npushBack\\npushQueue\\n3 popStack popQueue popFront\\npushBack\\npushBack\\npushBack\\npushFront\\npushBack\\npushBack\\npushBack\\npushQueue\\npushBack\\npushBack\\npushBack\\npushStack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\n3 popStack popQueue popFront\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\n\", \"pushBack\\npushStack\\npushQueue\\npushBack\\npushBack\\npushBack\\npushFront\\npushBack\\n3 popStack popQueue popFront\\npushStack\\npushBack\\npushBack\\npushBack\\npushFront\\npushQueue\\npushBack\\npushBack\\n3 popStack popQueue popFront\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\n\", \"pushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushStack\\npushQueue\\npushBack\\npushFront\\n3 popStack popQueue popFront\\n\", \"pushBack\\npushBack\\npushBack\\npushBack\\npushBack\\n\", \"pushStack\\npushFront\\npushQueue\\npushBack\\n3 popStack popQueue popFront\\n\", \"pushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\n\", \"0\\npushStack\\n\", \"0\\n\", \"pushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushStack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushFront\\npushBack\\npushBack\\npushBack\\npushQueue\\n3 popStack popQueue popFront\\npushBack\\npushBack\\npushBack\\npushFront\\npushBack\\npushBack\\npushBack\\npushQueue\\npushBack\\npushBack\\npushBack\\npushStack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\n3 popStack popQueue popFront\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\n\", \"pushBack\\npushStack\\npushQueue\\npushBack\\npushBack\\npushBack\\npushFront\\npushBack\\n3 popStack popQueue popFront\\npushStack\\npushBack\\npushBack\\npushBack\\npushFront\\npushQueue\\npushBack\\npushBack\\n3 popStack popQueue popFront\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\n\", \"pushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushStack\\npushQueue\\npushBack\\npushFront\\n3 popStack popQueue popFront\\n\", \"pushBack\\npushBack\\npushBack\\npushBack\\npushBack\\n\", \"pushFront\\npushQueue\\npushStack\\npushBack\\n3 popStack popQueue popFront\\n\", \"pushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\n\", \"0\\npushBack\\n\", \"pushBack\\n\", \"pushQueue\\npushStack\\n2 popStack popQueue\\npushQueue\\npushStack\\n2 popStack popQueue\\npushFront\\npushQueue\\npushStack\\n3 popStack popQueue popFront\\n\", \"pushStack\\n1 popStack\\npushStack\\n1 popStack\\n\", \"pushFront\\npushQueue\\npushStack\\n3 popStack popQueue popFront\\npushBack\\n\", \"pushQueue\\npushFront\\npushStack\\n3 popStack popQueue popFront\\n0\\n\", \"0\\n0\\npushStack\\n1 popStack\\n\", \"pushStack\\npushFront\\npushQueue\\n3 popStack popQueue popFront\\npushBack\\n\", \"pushFront\\npushStack\\npushQueue\\n3 popStack popQueue popFront\\n0\\n\", \"pushBack\\npushBack\\n\", \"pushQueue\\npushStack\\n2 popStack popQueue\\npushQueue\\npushStack\\n2 popStack popQueue\\npushStack\\n1 popStack\\npushStack\\n1 popStack\\n\", \"0\\npushQueue\\npushStack\\n2 popStack popQueue\\n\", \"pushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushFront\\npushBack\\npushBack\\npushBack\\npushQueue\\npushBack\\npushBack\\npushBack\\npushStack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\n3 popStack popQueue popFront\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\n\", \"pushQueue\\npushStack\\npushFront\\n3 popStack popQueue popFront\\n0\\n\", \"pushBack\\npushBack\\npushFront\\npushQueue\\npushStack\\n3 popStack popQueue popFront\\npushStack\\n1 popStack\\npushStack\\n1 popStack\\n\", \"0\\npushBack\\npushBack\\npushBack\\n\", \"pushFront\\npushQueue\\npushStack\\n3 popStack popQueue popFront\\n0\\n\", \"0\\n0\\n\", \"pushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushQueue\\npushFront\\npushBack\\npushStack\\n3 popStack popQueue popFront\\n\", \"pushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushStack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushFront\\npushBack\\npushBack\\npushBack\\npushQueue\\n3 popStack popQueue popFront\\npushBack\\npushBack\\npushBack\\npushFront\\npushBack\\npushBack\\npushBack\\npushQueue\\npushBack\\npushBack\\npushBack\\npushStack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\n3 popStack popQueue popFront\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\n\", \"pushBack\\npushStack\\npushQueue\\npushBack\\npushBack\\npushBack\\npushFront\\npushBack\\n3 popStack popQueue popFront\\npushStack\\npushBack\\npushBack\\npushBack\\npushFront\\npushQueue\\npushBack\\npushBack\\n3 popStack popQueue popFront\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\n\", \"pushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushStack\\npushQueue\\npushBack\\npushFront\\n3 popStack popQueue popFront\\n\", \"pushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\n\", \"0\\npushBack\\n\", \"pushBack\\n\", \"pushQueue\\npushStack\\n2 popStack popQueue\\npushQueue\\npushStack\\n2 popStack popQueue\\npushFront\\npushQueue\\npushStack\\n3 popStack popQueue popFront\\n\", \"pushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushStack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushFront\\npushBack\\npushBack\\npushBack\\npushQueue\\n3 popStack popQueue popFront\\npushBack\\npushBack\\npushBack\\npushFront\\npushBack\\npushBack\\npushBack\\npushQueue\\npushBack\\npushBack\\npushBack\\npushStack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\n3 popStack popQueue popFront\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\n\", \"pushBack\\npushStack\\npushQueue\\npushBack\\npushBack\\npushBack\\npushFront\\npushBack\\n3 popStack popQueue popFront\\npushStack\\npushBack\\npushBack\\npushBack\\npushFront\\npushQueue\\npushBack\\npushBack\\n3 popStack popQueue popFront\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\n\", \"pushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushStack\\npushQueue\\npushBack\\npushFront\\n3 popStack popQueue popFront\\n\", \"pushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\n\", \"pushBack\\n\", \"pushBack\\npushStack\\npushQueue\\npushBack\\npushBack\\npushBack\\npushFront\\npushBack\\n3 popStack popQueue popFront\\npushStack\\npushBack\\npushBack\\npushBack\\npushFront\\npushQueue\\npushBack\\npushBack\\n3 popStack popQueue popFront\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\n\", \"pushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushStack\\npushQueue\\npushBack\\npushFront\\n3 popStack popQueue popFront\\n\", \"pushBack\\npushBack\\npushBack\\npushBack\\npushBack\\n\", \"pushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\n\", \"pushBack\\npushBack\\n\", \"pushBack\\n\", \"pushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushFront\\npushBack\\npushBack\\npushBack\\npushQueue\\npushBack\\npushBack\\npushBack\\npushStack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\n3 popStack popQueue popFront\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\n\", \"pushBack\\npushStack\\npushQueue\\npushBack\\npushBack\\npushBack\\npushFront\\npushBack\\n3 popStack popQueue popFront\\npushStack\\npushBack\\npushBack\\npushBack\\npushFront\\npushQueue\\npushBack\\npushBack\\n3 popStack popQueue popFront\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\n\", \"pushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushStack\\npushQueue\\npushBack\\npushFront\\n3 popStack popQueue popFront\\n\", \"pushBack\\npushBack\\npushBack\\npushBack\\npushBack\\n\", \"pushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\n\", \"pushBack\\n\", \"pushBack\\npushBack\\npushFront\\npushQueue\\npushStack\\n3 popStack popQueue popFront\\npushStack\\n1 popStack\\npushStack\\n1 popStack\\n\", \"0\\npushBack\\npushBack\\npushBack\\n\", \"pushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushFront\\npushBack\\npushBack\\npushBack\\npushQueue\\npushBack\\npushBack\\npushBack\\npushStack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\n3 popStack popQueue popFront\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\n\", \"pushBack\\npushStack\\npushQueue\\npushBack\\npushBack\\npushBack\\npushFront\\npushBack\\n3 popStack popQueue popFront\\npushStack\\npushBack\\npushBack\\npushBack\\npushFront\\npushQueue\\npushBack\\npushBack\\n3 popStack popQueue popFront\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\npushBack\\n\", \"0\\npushStack\\n1 popStack\\npushQueue\\npushStack\\n2 popStack popQueue\\npushFront\\npushQueue\\npushStack\\n3 popStack popQueue popFront\\n\", \"pushFront\\npushQueue\\npushStack\\n3 popStack popQueue popFront\\n\"]}", "source": "primeintellect"}
Dima has a birthday soon! It's a big day! Saryozha's present to Dima is that Seryozha won't be in the room and won't disturb Dima and Inna as they celebrate the birthday. Inna's present to Dima is a stack, a queue and a deck. Inna wants her present to show Dima how great a programmer he is. For that, she is going to give Dima commands one by one. There are two types of commands: 1. Add a given number into one of containers. For the queue and the stack, you can add elements only to the end. For the deck, you can add elements to the beginning and to the end. 2. Extract a number from each of at most three distinct containers. Tell all extracted numbers to Inna and then empty all containers. In the queue container you can extract numbers only from the beginning. In the stack container you can extract numbers only from the end. In the deck number you can extract numbers from the beginning and from the end. You cannot extract numbers from empty containers. Every time Dima makes a command of the second type, Inna kisses Dima some (possibly zero) number of times. Dima knows Inna perfectly well, he is sure that this number equals the sum of numbers he extracts from containers during this operation. As we've said before, Dima knows Inna perfectly well and he knows which commands Inna will give to Dima and the order of the commands. Help Dima find the strategy that lets him give as more kisses as possible for his birthday! Input The first line contains integer n (1 ≤ n ≤ 105) — the number of Inna's commands. Then n lines follow, describing Inna's commands. Each line consists an integer: 1. Integer a (1 ≤ a ≤ 105) means that Inna gives Dima a command to add number a into one of containers. 2. Integer 0 shows that Inna asks Dima to make at most three extractions from different containers. Output Each command of the input must correspond to one line of the output — Dima's action. For the command of the first type (adding) print one word that corresponds to Dima's choice: * pushStack — add to the end of the stack; * pushQueue — add to the end of the queue; * pushFront — add to the beginning of the deck; * pushBack — add to the end of the deck. For a command of the second type first print an integer k (0 ≤ k ≤ 3), that shows the number of extract operations, then print k words separated by space. The words can be: * popStack — extract from the end of the stack; * popQueue — extract from the beginning of the line; * popFront — extract from the beginning from the deck; * popBack — extract from the end of the deck. The printed operations mustn't extract numbers from empty containers. Also, they must extract numbers from distinct containers. The printed sequence of actions must lead to the maximum number of kisses. If there are multiple sequences of actions leading to the maximum number of kisses, you are allowed to print any of them. Examples Input 10 0 1 0 1 2 0 1 2 3 0 Output 0 pushStack 1 popStack pushStack pushQueue 2 popStack popQueue pushStack pushQueue pushFront 3 popStack popQueue popFront Input 4 1 2 3 0 Output pushStack pushQueue pushFront 3 popStack popQueue popFront Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [[[\"bitcoin\", \"take\", \"over\", \"the\", \"world\", \"maybe\", \"who\", \"knows\", \"perhaps\"]], [[\"turns\", \"out\", \"random\", \"test\", \"cases\", \"are\", \"easier\", \"than\", \"writing\", \"out\", \"basic\", \"ones\"]], [[\"lets\", \"talk\", \"about\", \"javascript\", \"the\", \"best\", \"language\"]], [[\"i\", \"want\", \"to\", \"travel\", \"the\", \"world\", \"writing\", \"code\", \"one\", \"day\"]], [[\"Lets\", \"all\", \"go\", \"on\", \"holiday\", \"somewhere\", \"very\", \"cold\"]]], \"outputs\": [[\"b***i***t***c***o***i***n\"], [\"a***r***e\"], [\"a***b***o***u***t\"], [\"c***o***d***e\"], [\"L***e***t***s\"]]}", "source": "primeintellect"}
You will be given a vector of strings. You must sort it alphabetically (case-sensitive, and based on the ASCII values of the chars) and then return the first value. The returned value must be a string, and have `"***"` between each of its letters. You should not remove or add elements from/to the array. Write your solution by modifying this code: ```python def two_sort(array): ``` Your solution should implemented in the function "two_sort". The i Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [[\"\"], [\"127.0.0.1\"], [\"0.0.0.0\"], [\"255.255.255.255\"], [\"10.20.30.40\"], [\"10.256.30.40\"], [\"10.20.030.40\"], [\"127.0.1\"], [\"127.0.0.0.1\"], [\"..255.255\"], [\"127.0.0.1\\n\"], [\"\\n127.0.0.1\"], [\" 127.0.0.1\"], [\"127.0.0.1 \"], [\" 127.0.0.1 \"], [\"127.0.0.1.\"], [\".127.0.0.1\"], [\"127..0.1\"]], \"outputs\": [[false], [true], [true], [true], [true], [false], [false], [false], [false], [false], [false], [false], [false], [false], [false], [false], [false], [false]]}", "source": "primeintellect"}
Implement `String#ipv4_address?`, which should return true if given object is an IPv4 address - four numbers (0-255) separated by dots. It should only accept addresses in canonical representation, so no leading `0`s, spaces etc. Write your solution by modifying this code: ```python def ipv4_address(address): ``` Your solution should implemented in the function "ipv4_address". The i Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [\"1\\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\n\", \"4\\nANTON\\nNAAN\\nAAAAAA\\nOAANTTON\\n\", \"4\\nNOTNA\\nNAAN\\nAAAAAA\\nOAANTTON\\n\", \"4\\nNOTNA\\nNAAN\\nAAAAAA\\nOTANTAON\\n\", \"4\\nNOTNA\\nAANN\\nAAAAAA\\nOAANTTON\\n\", \"4\\nNOTNA\\nNAAN\\nAAAAAA\\nNOATNATO\\n\", \"4\\nNOTNA\\nAANN\\nAAAAAA\\nOANNTTOA\\n\", \"4\\nTONNA\\nNAAN\\nAAAAAA\\nNOATNATO\\n\", \"4\\nTONNA\\nNAAN\\nAAAAAA\\nOTANTAON\\n\", \"4\\nANTON\\nNAAN\\nAAAAAA\\nNOTTNAAO\\n\", \"4\\nNOTNA\\nNAAN\\nAAAAAA\\nOAANTTNN\\n\", \"4\\nNOTNA\\nAANN\\nAAAAAA\\nNOTTNAAO\\n\", \"4\\nANTON\\nNAAN\\nAAAAAA\\nNOATNATO\\n\", \"4\\nNOTNA\\nNAAN\\nAAAAAA\\nTAANTONN\\n\", \"4\\nANNOT\\nNAAN\\nAAAAAA\\nNOATNATO\\n\", \"4\\nANTON\\nNAAN\\nAAAAAA\\nTAANTONN\\n\", \"4\\nANNOT\\nNAAN\\nAAAAAA\\nOTANTAON\\n\", \"4\\nANTON\\nNAAN\\nAAAAAA\\nNNTTNAAO\\n\", \"4\\nANTON\\nNAAN\\nAAAAAA\\nOAANTTNN\\n\", \"4\\nNOTNA\\nNNAA\\nAAAAAA\\nOANNTTOA\\n\", \"4\\nANTON\\nNAAN\\nAAAAAA\\nNOTTOAAO\\n\", \"4\\nNOTNA\\nNAAN\\nAAAAAA\\nNNTTNAAO\\n\", \"4\\nTONNA\\nNAAN\\nAAAAAA\\nTAANTONN\\n\", \"4\\nNOTNA\\nNNAA\\nAAAAAA\\nAOTTNNAO\\n\", \"4\\nANTON\\nNNAA\\nAAAAAA\\nNOTNTAAO\\n\", \"4\\nTNAON\\nNNAA\\nAAAAAA\\nNOTNTAAO\\n\", \"4\\nANTON\\nAANN\\nAAAAAA\\nOANNTTOA\\n\", \"4\\nAONNT\\nNAAN\\nAAAAAA\\nNOATNATO\\n\", \"4\\nNOTNA\\nNAAN\\nAAAAAA\\nNOTTNAAO\\n\", \"4\\nNOTNA\\nAANN\\nAAAAAA\\nNOATNATO\\n\", \"4\\nNOTOA\\nNAAN\\nAAAAAA\\nTAANTONN\\n\", \"4\\nANNNT\\nNAAN\\nAAAAAA\\nNOATNATO\\n\", \"4\\nAOTNN\\nNAAN\\nAAAAAA\\nOAANTTNN\\n\", \"4\\nANTON\\nANAN\\nAAAAAA\\nNNTTAANO\\n\", \"4\\nANTON\\nNNAA\\nAAAAAA\\nAOTTNNAO\\n\", \"4\\nAONOT\\nNAAN\\nAAAAAA\\nNOATNATO\\n\", \"4\\nNOTOA\\nANAN\\nAAAAAA\\nTAANTONN\\n\", \"4\\nNOTOA\\nANAN\\nAAAAAA\\nNAANTONT\\n\", \"4\\nANTON\\nNAAO\\nAAAAAA\\nOAANTTON\\n\", \"4\\nNOTNA\\nNAAN\\nAAAAAA\\nOTAOTAON\\n\", \"4\\nTNAON\\nNNAA\\nAAAAAA\\nAOTTNNAO\\n\", \"4\\nNOTOA\\nNAAN\\nAAAAAA\\nTAANTONO\\n\", \"4\\nNOTOA\\nAOAN\\nAAAAAA\\nTAANTONN\\n\", \"4\\nANTOO\\nNANA\\nAAAAAA\\nNNTTAANO\\n\", \"4\\nANNNT\\nNNAA\\nAAAAAA\\nOTANTAON\\n\", \"4\\nANTON\\nOAAN\\nAAAAAA\\nOAANTTON\\n\", \"4\\nOOTNA\\nAANN\\nAAAAAA\\nOAATNTON\\n\", \"4\\nNTAOO\\nNNAA\\nAAAAAA\\nAOTTNNAO\\n\", \"4\\nANTON\\nAANN\\nAAAAAA\\nOAANTTON\\n\", \"4\\nTONNA\\nANAN\\nAAAAAA\\nOTANTAON\\n\", \"4\\nANTNN\\nNAAN\\nAAAAAA\\nNOTTNAAO\\n\", \"4\\nNOTOA\\nNAAN\\nAAAAAA\\nOAANTTNN\\n\", \"4\\nNATNO\\nNAAN\\nAAAAAA\\nTAANTONN\\n\", \"4\\nNOTNA\\nAANN\\nAAAAAA\\nOTATNAON\\n\", \"4\\nNOTNA\\nAANN\\nAAAAAA\\nAOTTNNAO\\n\", \"4\\nTNAON\\nNNAA\\nAAAAAA\\nNOTATANO\\n\", \"4\\nNOTNA\\nNAOA\\nAAAAAA\\nOTANTAON\\n\", \"4\\nTNAON\\nAANN\\nAAAAAA\\nOANNTTOA\\n\", \"4\\nAOTON\\nANAN\\nAAAAAA\\nNAANTONT\\n\", \"4\\nANNNT\\nAANN\\nAAAAAA\\nNOATNATO\\n\", \"4\\nOOTNA\\nANNA\\nAAAAAA\\nOAANTTON\\n\", \"4\\nANTON\\nNAAN\\nAAAAAA\\nNNATANTO\\n\", \"4\\nNOTOA\\nNAAN\\nAAAAAA\\nATANTONO\\n\", \"4\\nANNNT\\nNNAA\\nAAAAAA\\nOTONTAAN\\n\", \"4\\nOOTNA\\nAANN\\nAAAAAA\\nOAATNTOO\\n\", \"4\\nOOATN\\nNNAA\\nAAAAAA\\nAOTTNNAO\\n\", \"4\\nNOTOA\\nAANN\\nAAAAAA\\nOTATNAON\\n\", \"4\\nNOTNA\\nAANN\\nAAAAAA\\nAOTTNNAN\\n\", \"4\\nTNAON\\nNNAA\\nAAAAAA\\nONATATON\\n\", \"4\\nAOTNN\\nNAOA\\nAAAAAA\\nOTANTAON\\n\", \"4\\nNOTOA\\nAANN\\nAAAAAA\\nTAANTONO\\n\", \"4\\nANNNT\\nAANN\\nAAAAAA\\nNOTTNAAO\\n\", \"4\\nOOTNA\\nANNA\\nAAAAAA\\nNOTTNAAO\\n\", \"4\\nTONNA\\nNAAN\\nAAAAAA\\nAOTTNNAO\\n\", \"4\\nANNNT\\nAANN\\nAAAAAA\\nOTONTAAN\\n\", \"4\\nTNAON\\nOAAN\\nAAAAAA\\nOAATTNON\\n\", \"4\\nOOTNA\\nAANN\\nAAAAAA\\nOOTNTAAO\\n\", \"4\\nNOTOA\\nAANO\\nAAAAAA\\nOTATNAON\\n\", \"4\\nNOTNA\\nAANN\\nAAAAAA\\nNANNTTOA\\n\", \"4\\nTNAON\\nNNAA\\nAAAAAA\\nOTANATON\\n\", \"4\\nAOTNN\\nAOAN\\nAAAAAA\\nOTANTAON\\n\", \"4\\nTNAON\\nOAAN\\nAAAAAA\\nNONTTAAO\\n\", \"4\\nONTNA\\nAANN\\nAAAAAA\\nOAATNTOO\\n\", \"4\\nNOTOA\\nAANO\\nAAAAAA\\nNOANTATO\\n\", \"4\\nONTNA\\nNNAA\\nAAAAAA\\nOAATNTOO\\n\", \"4\\nNOTOA\\nAAOO\\nAAAAAA\\nNOANTATO\\n\", \"4\\nNOTNA\\nNAAO\\nAAAAAA\\nOTANTAON\\n\", \"4\\nTONNA\\nNAAN\\nAAAAAA\\nNOATOATN\\n\", \"4\\nTNNOA\\nNAAN\\nAAAAAA\\nOTANTAON\\n\", \"4\\nNOTNA\\nNAAN\\nAAAAAA\\nTNANTOAN\\n\", \"4\\nANNOT\\nNAAO\\nAAAAAA\\nOTANTAON\\n\", \"4\\nNOTNA\\nNOAA\\nAAAAAA\\nOANNTTOA\\n\", \"4\\nTONNA\\nAANN\\nAAAAAA\\nNOATNTAO\\n\", \"4\\nANNOT\\nNAAN\\nAAAAAA\\nTAANTONN\\n\", \"4\\nANTON\\nNANA\\nAAAAAA\\nOTANTAON\\n\", \"4\\nAOTNN\\nNAAN\\nAAAAAA\\nOAANTTNO\\n\", \"4\\nANTON\\nAOAN\\nAAAAAA\\nNNTTAANO\\n\", \"4\\nANTON\\nNANA\\nAAAAAA\\nNNTTAAOO\\n\", \"4\\nANTON\\nNAAO\\nAAAAAA\\nTAANOTON\\n\", \"4\\nNOTNA\\nNAAN\\nAAAAAA\\nNOATOATO\\n\", \"4\\nNOTOA\\nAOAN\\nAAAAAA\\nNNOTNAAT\\n\", \"4\\nNTAON\\nNNAA\\nAAAAAA\\nOOTTNNAA\\n\", \"4\\nTONNA\\nAOAN\\nAAAAAA\\nOTANTAON\\n\", \"4\\nNOTNA\\nAANN\\nAAAAAA\\nAANNTTOO\\n\", \"4\\nANTON\\nNAOA\\nAAAAAA\\nOTANTAON\\n\", \"4\\nANNNT\\nAANN\\nAAAAAA\\nNOATNATN\\n\", \"4\\nANTON\\nAANN\\nAAAAAA\\nNNATANTO\\n\", \"4\\nNOTNA\\nNAAN\\nAAAAAA\\nATANTONO\\n\", \"4\\nOOTNA\\nNNAA\\nAAAAAA\\nOAATNTOO\\n\", \"4\\nAOTON\\nNAOA\\nAAAAAA\\nOTANTAON\\n\", \"4\\nAONNT\\nAANN\\nAAAAAA\\nNOTTNAAO\\n\", \"4\\nTONNA\\nNAAN\\nAAAAAA\\nOANNTTOA\\n\", \"4\\nAOTON\\nAOAN\\nAAAAAA\\nOTANTAON\\n\", \"4\\nTNAON\\nNAAO\\nAAAAAA\\nNONTTAAO\\n\", \"4\\nONTNA\\nAANN\\nAAAAAA\\nOTAANTOO\\n\", \"4\\nONTNA\\nNNAA\\nAAAAAA\\nOAATOTOO\\n\", \"4\\nANTON\\nNAAO\\nAAAAAA\\nOTANTAON\\n\", \"4\\nNOTNA\\nNAAO\\nAAAAAA\\nTNANTOAN\\n\", \"4\\nANTON\\nNAAO\\nAAAAAA\\nNOATNATO\\n\", \"4\\nNOTNA\\nNOAA\\nAAAAAA\\nAOTTNNAO\\n\", \"4\\nTNNNA\\nNAAN\\nAAAAAA\\nOTANTAON\\n\", \"4\\nNNTNA\\nNANA\\nAAAAAA\\nONAATTNN\\n\", \"4\\nANTON\\nNAOA\\nAAAAAA\\nNOATNATO\\n\", \"4\\nNOTNA\\nAANN\\nAAAAAA\\nNNATANTO\\n\", \"4\\nOOTNA\\nONAA\\nAAAAAA\\nOAATNTOO\\n\", \"4\\nAOTON\\nOANA\\nAAAAAA\\nOTANTAON\\n\", \"4\\nAOTNN\\nAANN\\nAAAAAA\\nNANNTOTA\\n\", \"4\\nONTNA\\nNNAA\\nAAAAAA\\nOTAANTOO\\n\", \"4\\nONTNA\\nAANN\\nAAAAAA\\nOAATOTOO\\n\", \"4\\nANTON\\nNAAO\\nAAAAAA\\nTNANTOAN\\n\", \"4\\nNTAON\\nAANN\\nAAAAAA\\nOOTANNAT\\n\", \"4\\nNOTNA\\nAANO\\nAAAAAA\\nNNATANTO\\n\", \"4\\nOOTNA\\nOOAA\\nAAAAAA\\nOAATNTOO\\n\", \"4\\nOOTNA\\nNNAA\\nAAAAAA\\nOTAANTOO\\n\", \"4\\nNOTNA\\nAONA\\nAAAAAA\\nNNATANTO\\n\", \"4\\nOOTNA\\nOOAA\\nAAAAAA\\nOOTNTAAO\\n\", \"4\\nONTAN\\nNAAN\\nAAAAAA\\nTAONATNN\\n\", \"4\\nANTON\\nAONA\\nAAAAAA\\nNNATANTO\\n\", \"4\\nOOTNA\\nNOAA\\nAAAAAA\\nOAATNTOO\\n\", \"4\\nOOTNA\\nNOAA\\nAAAAAA\\nOAANTTOO\\n\", \"4\\nOOTAN\\nNOAA\\nAAAAAA\\nOAANTTOO\\n\", \"4\\nOOTAN\\nAAON\\nAAAAAA\\nOAANTTOO\\n\", \"4\\nANTON\\nNAAN\\nAAAAAA\\nTAANTONO\\n\", \"4\\nANTON\\nAANN\\nAAAAAA\\nOAANTTNN\\n\", \"4\\nANTON\\nANAN\\nAAAAAA\\nNOTTOAAO\\n\", \"4\\nNNTOA\\nNNAA\\nAAAAAA\\nAOTTNNAO\\n\", \"4\\nNOTNA\\nNANA\\nAAAAAA\\nOOTTNNAA\\n\", \"4\\nANNNT\\nNAAN\\nAAAAAA\\nNOATNATN\\n\", \"4\\nNNTOA\\nNAAN\\nAAAAAA\\nOAANTTNN\\n\", \"4\\nTNNNA\\nNANA\\nAAAAAA\\nNOATNATO\\n\", \"4\\nANTON\\nNAAN\\nAAAAAA\\nNOATOATO\\n\", \"4\\nTNANN\\nNNAA\\nAAAAAA\\nAOTTNNAO\\n\", \"4\\nOTAOO\\nNNAA\\nAAAAAA\\nAOTTNNAO\\n\", \"4\\nNOTNA\\nANAN\\nAAAAAA\\nOANNTTNA\\n\", \"4\\nANTNN\\nNAAN\\nAAAAAA\\nOAANTTON\\n\", \"4\\nNOTOA\\nNAAN\\nAAAAAA\\nNNTTNAAO\\n\", \"4\\nNATNO\\nNAAN\\nAAAAAA\\nNNOTNAAT\\n\", \"4\\nANTON\\nNAAO\\nAAAAAA\\nTAANOTNN\\n\", \"4\\nOOTNA\\nNANA\\nAAAAAA\\nOAANTTNN\\n\", \"4\\nNOTNA\\nOAAN\\nAAAAAA\\nNNTTAANO\\n\", \"4\\nTNAON\\nAANN\\nAAAAAA\\nAOTTNNAO\\n\", \"4\\nNNANT\\nAANN\\nAAAAAA\\nNOATNATO\\n\", \"4\\nAOTON\\nNAAN\\nAAAAAA\\nATANTONO\\n\", \"4\\nANTON\\nONAA\\nAAAAAA\\nOAATTNON\\n\", \"4\\nOOATN\\nAANN\\nAAAAAA\\nAOTTNNAO\\n\", \"4\\nANTON\\nANAN\\nAAAAAA\\nOANNTTNA\\n\", \"4\\nNOTOA\\nAANN\\nAAAAAA\\nNOANTATO\\n\", \"4\\nANNNT\\nAANN\\nAAAAAA\\nNOTNTAAO\\n\", \"4\\nTONNA\\nOAAN\\nAAAAAA\\nAOTTNNAO\\n\", \"4\\nNOTNA\\nNAAN\\nAAAAAA\\nNANNTTOA\\n\", \"4\\nNNTNA\\nAANN\\nAAAAAA\\nOAATNTOO\\n\", \"4\\nANTNO\\nNNAA\\nAAAAAA\\nOAATNTOO\\n\", \"4\\nNNTNA\\nANAN\\nAAAAAA\\nOAANTTON\\n\", \"4\\nTONNA\\nAANN\\nAAAAAA\\nNOATNTAN\\n\", \"4\\nANNOT\\nNAAN\\nAAAAAA\\nNNOTNAAT\\n\", \"4\\nANTON\\nANNA\\nAAAAAA\\nOAANTTON\\n\", \"4\\nNNTOA\\nNANA\\nAAAAAA\\nOTANTAON\\n\", \"4\\nAOTNN\\nNAAN\\nAAAAAA\\nNAANTTNO\\n\", \"4\\nNOTNA\\nNAAN\\nAAAAAA\\nNNONTAAT\\n\", \"4\\nAOTOO\\nNANA\\nAAAAAA\\nNNTTAAON\\n\", \"4\\nNOTNA\\nAANN\\nAAAAAA\\nNOTNTAAO\\n\", \"4\\nNOTNA\\nAANN\\nAAAAAA\\nNOATNTAO\\n\", \"4\\nNOTNA\\nNNAA\\nAAAAAA\\nNOTNTAAO\\n\", \"4\\nANTON\\nNAAN\\nAAAAAA\\nNNTTAANO\\n\", \"4\\nNOTNA\\nNANA\\nAAAAAA\\nAOTTNNAO\\n\", \"4\\nNOTNA\\nNNAA\\nAAAAAA\\nOAANTTON\\n\", \"4\\nNOTNA\\nNANA\\nAAAAAA\\nOTANTAON\\n\", \"4\\nNOTNA\\nNAAN\\nAAAAAA\\nTAANOTNN\\n\", \"4\\nANNNT\\nNANA\\nAAAAAA\\nNOATNATO\\n\", \"4\\nANTON\\nNANA\\nAAAAAA\\nNNTTAANO\\n\", \"4\\nANNN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NOTA\\nAANN\\nAAAAAA\\nTNNTAOOA\\n\"]}", "source": "primeintellect"}
After rejecting 10^{100} data structure problems, Errorgorn is very angry at Anton and decided to kill him. Anton's DNA can be represented as a string a which only contains the characters "ANTON" (there are only 4 distinct characters). Errorgorn can change Anton's DNA into string b which must be a permutation of a. However, Anton's body can defend against this attack. In 1 second, his body can swap 2 adjacent characters of his DNA to transform it back to a. Anton's body is smart and will use the minimum number of moves. To maximize the chance of Anton dying, Errorgorn wants to change Anton's DNA the string that maximizes the time for Anton's body to revert his DNA. But since Errorgorn is busy making more data structure problems, he needs your help to find the best string B. Can you help him? Input The first line of input contains a single integer t (1 ≤ t ≤ 100000) — the number of testcases. The first and only line of each testcase contains 1 string a (1 ≤ |a| ≤ 100000). a consists of only the characters "A", "N", "O" and "T". It is guaranteed that the sum of |a| over all testcases does not exceed 100000. Output For each testcase, print a single string, b. If there are multiple answers, you can output any one of them. b must be a permutation of the string a. Example Input 4 ANTON NAAN AAAAAA OAANTTON Output NNOTA AANN AAAAAA TNNTAOOA Note For the first testcase, it takes 7 seconds for Anton's body to transform NNOTA to ANTON: NNOTA → NNOAT → NNAOT → NANOT → NANTO → ANNTO → ANTNO → ANTON. Note that you cannot output strings such as AANTON, ANTONTRYGUB, AAAAA and anton as it is not a permutation of ANTON. For the second testcase, it takes 2 seconds for Anton's body to transform AANN to NAAN. Note that other strings such as NNAA and ANNA will also be accepted. Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [[153], [370], [371], [407], [1634], [8208], [9474], [54748], [92727], [93084], [548834], [1741725], [4210818], [9800817], [9926315], [24678050], [88593477], [146511208], [472335975], [534494836], [912985153], [4679307774], [115132219018763992565095597973971522401]], \"outputs\": [[true], [true], [true], [true], [true], [true], [true], [true], [true], [true], [true], [true], [true], [true], [true], [true], [true], [true], [true], [true], [true], [true], [true]]}", "source": "primeintellect"}
A Narcissistic Number is a number of length n in which the sum of its digits to the power of n is equal to the original number. If this seems confusing, refer to the example below. Ex: 153, where n = 3 (number of digits in 153) 1^(3) + 5^(3) + 3^(3) = 153 Write a method is_narcissistic(i) (in Haskell: isNarcissistic :: Integer -> Bool) which returns whether or not i is a Narcissistic Number. Write your solution by modifying this code: ```python def is_narcissistic(i): ``` Your solution should implemented in the function "is_narcissistic". The i Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [\"10 1000000\\n307196 650096 355966 710719 99165 959865 500346 677478 614586 6538\\n\", \"4 0\\n1 4 4 4\\n\", \"3 4\\n1 2 7\\n\", \"10 20\\n6 4 7 10 4 5 5 3 7 10\\n\", \"2 0\\n182 2\\n\", \"4 100\\n1 1 10 10\\n\", \"4 42\\n1 1 1 1000000000\\n\", \"123 54564\\n38 44 41 42 59 3 95 15 45 32 44 69 35 83 94 57 65 85 64 47 24 20 34 86 26 91 98 12 36 96 80 4 70 40 95 38 70 22 58 50 34 84 80 45 14 60 61 43 11 56 19 59 50 63 21 15 97 98 27 13 9 71 32 18 90 10 2 99 75 87 74 83 79 37 89 3 49 27 92 95 49 1 26 50 72 75 81 37 60 98 28 28 10 93 99 63 14 26 69 51 47 59 42 7 20 17 75 44 44 20 44 85 27 32 65 95 47 46 12 22 64 77 21\\n\", \"5 1000000\\n145119584 42061308 953418415 717474449 57984109\\n\", \"100 20\\n2 5 3 3 2 7 6 2 2 2 6 7 2 1 8 10 2 4 10 6 10 2 1 1 4 7 1 2 9 7 5 3 7 4 6 3 10 10 3 7 6 8 2 2 10 3 1 2 1 3 1 6 3 1 4 10 3 10 9 5 10 4 3 10 3 3 5 3 10 2 1 5 10 7 8 7 7 2 4 2 1 3 3 8 8 5 7 3 1 1 8 10 5 7 4 4 7 7 1 9\\n\", \"111 10\\n2 8 6 1 3 5 8 3 8 2 9 9 6 9 8 8 5 2 3 8 8 3 8 3 7 9 4 3 9 7 1 8 3 1 5 5 5 8 2 4 2 7 9 1 4 4 3 1 6 7 7 4 1 3 5 3 9 4 4 4 8 8 7 3 5 6 3 3 8 2 8 4 5 8 1 8 4 1 7 1 4 9 8 9 7 6 5 6 3 7 4 8 9 3 8 9 9 3 5 9 1 3 6 8 9 1 1 3 8 7 6\\n\", \"2 100000\\n1 3\\n\", \"10 1000\\n1000000000 999999994 999999992 1000000000 999999994 999999999 999999990 999999997 999999995 1000000000\\n\", \"30 7\\n3 3 2 2 2 2 3 4 4 5 2 1 1 5 5 3 4 3 2 1 3 4 3 2 2 5 2 5 1 2\\n\", \"10 1000000\\n307196 650096 355966 710719 99165 959865 500346 677478 614586 3779\\n\", \"4 0\\n1 4 4 7\\n\", \"3 8\\n1 2 7\\n\", \"100 20\\n2 5 3 3 2 7 6 2 2 2 6 7 2 1 8 10 2 4 10 6 10 2 1 1 4 7 1 2 9 7 5 3 7 4 6 3 10 10 3 7 6 8 2 2 10 3 1 2 1 3 1 6 3 1 4 10 3 10 9 5 10 4 3 10 3 3 5 3 10 2 1 5 10 7 8 7 7 2 4 2 1 3 3 8 8 5 7 3 1 1 8 10 5 7 4 3 7 7 1 9\\n\", \"111 10\\n2 8 6 1 3 5 8 3 8 2 9 9 6 9 8 8 5 2 3 8 8 3 8 3 7 9 4 3 9 7 1 15 3 1 5 5 5 8 2 4 2 7 9 1 4 4 3 1 6 7 7 4 1 3 5 3 9 4 4 4 8 8 7 3 5 6 3 3 8 2 8 4 5 8 1 8 4 1 7 1 4 9 8 9 7 6 5 6 3 7 4 8 9 3 8 9 9 3 5 9 1 3 6 8 9 1 1 3 8 7 6\\n\", \"2 100100\\n1 3\\n\", \"30 7\\n3 3 2 2 2 2 3 4 1 5 2 1 1 5 5 3 4 3 2 1 3 4 3 2 2 5 2 5 1 2\\n\", \"10 1000000\\n307196 650096 355966 710719 99165 959865 328659 677478 614586 3779\\n\", \"10 1000000\\n307196 650096 355966 710719 99165 959865 328659 677478 614586 4966\\n\", \"10 3\\n10 4 7 10 4 5 5 3 5 10\\n\", \"10 1000000\\n307196 650096 355966 710719 99165 959865 328659 1150627 614586 4966\\n\", \"10 1000000\\n307196 650096 355966 710719 99165 959865 470239 1150627 614586 4966\\n\", \"10 1001000\\n307196 650096 355966 710719 99165 959865 470239 1150627 614586 4966\\n\", \"10 1001000\\n307196 650096 355966 710719 99165 959865 105731 1150627 614586 4966\\n\", \"10 1001000\\n170434 650096 355966 710719 99165 959865 105731 1150627 583739 4966\\n\", \"10 1001000\\n170434 844988 355966 710719 99165 959865 105731 1150627 583739 4966\\n\", \"10 1011000\\n170434 844988 355966 710719 99165 959865 105731 1150627 583739 4966\\n\", \"10 1011000\\n170434 844988 355966 710719 99165 959865 178029 1150627 583739 4966\\n\", \"10 1011000\\n170434 612949 355966 710719 99165 959865 178029 1150627 583739 4966\\n\", \"10 1011000\\n152127 612949 355966 710719 99165 959865 178029 1150627 583739 4966\\n\", \"10 1011000\\n27144 612949 355966 710719 99165 959865 178029 1150627 583739 4966\\n\", \"10 20\\n10 4 7 10 4 5 5 3 7 10\\n\", \"4 100\\n0 1 10 10\\n\", \"123 54564\\n38 44 41 42 59 3 95 15 45 32 44 69 35 83 94 57 65 85 64 47 24 20 34 86 26 91 98 12 36 96 80 4 70 40 95 38 70 22 58 50 34 84 80 45 14 60 61 43 11 56 19 59 50 63 21 15 97 98 27 13 9 71 32 18 90 10 2 99 75 87 74 83 79 37 89 3 49 27 92 95 49 1 26 50 72 75 81 37 60 98 28 28 10 93 99 63 14 26 69 51 47 59 42 7 20 17 75 44 44 20 9 85 27 32 65 95 47 46 12 22 64 77 21\\n\", \"4 0\\n1 4 5 7\\n\", \"10 20\\n10 4 7 10 4 5 5 3 5 10\\n\", \"123 54564\\n38 44 41 42 59 3 95 15 45 32 44 69 35 83 94 57 65 85 64 47 24 20 34 86 26 91 98 12 36 96 80 4 70 40 95 38 70 22 58 50 34 84 80 45 14 60 61 43 11 56 19 59 50 63 21 15 97 98 27 13 9 71 32 18 90 10 2 99 75 87 74 83 79 37 89 3 49 27 92 95 49 1 26 50 72 75 81 37 60 98 28 28 10 93 99 63 14 26 69 51 47 59 42 7 20 17 75 44 44 20 9 85 27 32 65 95 47 46 12 22 121 77 21\\n\", \"100 20\\n2 5 3 3 2 7 6 2 2 2 6 7 2 1 8 10 2 4 10 6 10 2 1 1 4 7 1 2 9 7 5 3 7 4 6 3 10 10 3 7 6 8 2 2 10 3 1 2 1 3 1 6 3 1 4 10 3 10 9 5 10 4 3 10 3 3 5 3 10 2 2 5 10 7 8 7 7 2 4 2 1 3 3 8 8 5 7 3 1 1 8 10 5 7 4 3 7 7 1 9\\n\", \"111 10\\n2 8 6 1 3 5 8 3 8 2 9 9 6 9 8 8 5 2 3 8 8 3 8 1 7 9 4 3 9 7 1 15 3 1 5 5 5 8 2 4 2 7 9 1 4 4 3 1 6 7 7 4 1 3 5 3 9 4 4 4 8 8 7 3 5 6 3 3 8 2 8 4 5 8 1 8 4 1 7 1 4 9 8 9 7 6 5 6 3 7 4 8 9 3 8 9 9 3 5 9 1 3 6 8 9 1 1 3 8 7 6\\n\", \"2 110100\\n1 3\\n\", \"30 6\\n3 3 2 2 2 2 3 4 1 5 2 1 1 5 5 3 4 3 2 1 3 4 3 2 2 5 2 5 1 2\\n\", \"123 54564\\n38 44 41 42 59 3 95 15 45 32 44 69 35 83 94 57 65 85 64 47 24 20 34 86 26 91 98 12 36 96 80 4 70 40 95 38 70 22 58 50 34 84 80 45 14 60 61 43 11 56 19 59 50 63 21 15 97 98 27 13 9 71 32 18 90 10 2 99 75 87 74 83 79 37 89 3 49 27 92 95 49 1 26 50 72 75 81 37 60 98 28 28 10 93 99 63 14 26 69 51 47 59 42 7 20 17 75 33 44 20 9 85 27 32 65 95 47 46 12 22 121 77 21\\n\", \"100 20\\n2 5 3 3 2 7 6 2 2 2 6 7 2 1 8 10 2 4 10 6 10 2 1 1 4 7 1 2 9 7 5 3 7 4 6 3 10 10 3 7 6 8 2 2 10 3 1 2 1 3 1 6 3 1 4 10 3 10 9 5 10 2 3 10 3 3 5 3 10 2 2 5 10 7 8 7 7 2 4 2 1 3 3 8 8 5 7 3 1 1 8 10 5 7 4 3 7 7 1 9\\n\", \"111 12\\n2 8 6 1 3 5 8 3 8 2 9 9 6 9 8 8 5 2 3 8 8 3 8 1 7 9 4 3 9 7 1 15 3 1 5 5 5 8 2 4 2 7 9 1 4 4 3 1 6 7 7 4 1 3 5 3 9 4 4 4 8 8 7 3 5 6 3 3 8 2 8 4 5 8 1 8 4 1 7 1 4 9 8 9 7 6 5 6 3 7 4 8 9 3 8 9 9 3 5 9 1 3 6 8 9 1 1 3 8 7 6\\n\", \"2 110000\\n1 3\\n\", \"30 6\\n3 3 2 2 2 2 3 4 1 5 2 1 1 5 5 3 4 3 4 1 3 4 3 2 2 5 2 5 1 2\\n\", \"10 3\\n2 4 7 10 4 5 5 3 5 10\\n\", \"123 54564\\n38 44 41 42 59 3 95 15 45 32 44 69 35 83 94 57 65 85 64 47 24 20 34 86 26 91 98 12 36 96 80 4 70 40 95 38 70 22 58 50 34 84 80 45 14 60 61 43 11 56 19 59 50 63 35 15 97 98 27 13 9 71 32 18 90 10 2 99 75 87 74 83 79 37 89 3 49 27 92 95 49 1 26 50 72 75 81 37 60 98 28 28 10 93 99 63 14 26 69 51 47 59 42 7 20 17 75 33 44 20 9 85 27 32 65 95 47 46 12 22 121 77 21\\n\", \"100 20\\n2 5 3 3 2 7 6 2 2 2 6 7 2 1 8 10 2 4 10 6 10 2 1 1 4 7 1 2 9 7 5 3 7 4 6 3 10 10 3 7 6 8 2 2 10 3 1 2 1 3 1 6 3 1 4 10 3 10 9 5 10 2 3 10 3 0 5 3 10 2 2 5 10 7 8 7 7 2 4 2 1 3 3 8 8 5 7 3 1 1 8 10 5 7 4 3 7 7 1 9\\n\", \"111 12\\n2 8 6 1 3 5 8 3 8 2 9 9 6 9 8 8 5 2 3 8 8 3 8 1 7 9 4 3 9 7 1 15 3 2 5 5 5 8 2 4 2 7 9 1 4 4 3 1 6 7 7 4 1 3 5 3 9 4 4 4 8 8 7 3 5 6 3 3 8 2 8 4 5 8 1 8 4 1 7 1 4 9 8 9 7 6 5 6 3 7 4 8 9 3 8 9 9 3 5 9 1 3 6 8 9 1 1 3 8 7 6\\n\", \"30 6\\n3 3 2 2 2 2 3 4 1 5 2 1 1 5 5 3 4 3 4 1 3 4 4 2 2 5 2 5 1 2\\n\", \"123 54564\\n38 44 41 42 59 3 95 15 45 32 44 69 35 83 94 57 65 85 64 47 24 20 34 86 26 91 98 12 36 96 80 4 70 40 95 38 70 22 58 50 34 84 80 45 14 60 61 43 11 56 19 59 50 63 35 15 97 98 27 13 9 71 32 18 90 10 2 99 75 87 74 83 79 37 89 3 49 27 92 95 49 1 26 82 72 75 81 37 60 98 28 28 10 93 99 63 14 26 69 51 47 59 42 7 20 17 75 33 44 20 9 85 27 32 65 95 47 46 12 22 121 77 21\\n\", \"100 20\\n2 5 3 3 2 7 6 2 2 2 6 7 2 1 8 10 2 4 10 6 10 2 1 1 4 7 1 2 9 7 5 3 7 4 6 3 10 10 3 7 6 8 2 2 10 3 1 2 1 3 1 6 3 1 4 10 3 10 9 5 10 2 3 10 1 0 5 3 10 2 2 5 10 7 8 7 7 2 4 2 1 3 3 8 8 5 7 3 1 1 8 10 5 7 4 3 7 7 1 9\\n\", \"111 12\\n2 8 6 1 3 5 8 3 8 2 9 9 6 9 8 8 5 2 3 8 8 3 8 1 7 9 4 3 9 7 1 15 3 2 5 5 5 8 2 4 2 7 9 1 4 4 3 1 6 7 7 4 1 3 5 3 9 4 4 4 8 8 7 3 5 6 3 3 8 2 8 4 5 8 1 8 4 1 7 1 4 9 8 9 7 6 5 6 3 7 4 7 9 3 8 9 9 3 5 9 1 3 6 8 9 1 1 3 8 7 6\\n\", \"123 54564\\n38 44 41 42 59 3 95 15 45 32 44 69 35 83 94 57 65 85 64 47 24 20 34 86 26 91 98 12 36 96 80 4 70 40 95 38 70 22 58 50 34 84 80 45 14 60 61 43 11 56 19 59 50 63 35 15 97 98 27 13 9 71 32 18 90 10 2 99 75 87 74 83 79 37 89 3 49 27 92 95 49 1 26 82 72 75 81 37 60 98 28 28 10 93 99 63 14 26 69 51 47 59 42 7 20 17 135 33 44 20 9 85 27 32 65 95 47 46 12 22 121 77 21\\n\", \"100 20\\n2 5 3 3 2 7 6 2 2 2 6 7 2 1 8 10 2 4 10 6 10 2 1 1 4 7 1 2 9 7 5 3 7 4 6 3 10 10 3 7 6 8 2 2 10 3 1 2 1 3 1 6 3 1 4 10 3 10 9 5 10 2 3 10 1 0 5 3 10 2 2 5 10 7 8 2 7 2 4 2 1 3 3 8 8 5 7 3 1 1 8 10 5 7 4 3 7 7 1 9\\n\", \"123 54564\\n38 44 41 42 59 3 95 15 45 32 44 69 35 83 94 57 65 85 64 47 24 20 34 86 26 91 98 12 36 1 80 4 70 40 95 38 70 22 58 50 34 84 80 45 14 60 61 43 11 56 19 59 50 63 35 15 97 98 27 13 9 71 32 18 90 10 2 99 75 87 74 83 79 37 89 3 49 27 92 95 49 1 26 82 72 75 81 37 60 98 28 28 10 93 99 63 14 26 69 51 47 59 42 7 20 17 135 33 44 20 9 85 27 32 65 95 47 46 12 22 121 77 21\\n\", \"100 20\\n2 5 3 3 0 7 6 2 2 2 6 7 2 1 8 10 2 4 10 6 10 2 1 1 4 7 1 2 9 7 5 3 7 4 6 3 10 10 3 7 6 8 2 2 10 3 1 2 1 3 1 6 3 1 4 10 3 10 9 5 10 2 3 10 1 0 5 3 10 2 2 5 10 7 8 2 7 2 4 2 1 3 3 8 8 5 7 3 1 1 8 10 5 7 4 3 7 7 1 9\\n\", \"10 1001000\\n307196 650096 355966 710719 99165 959865 105731 1150627 583739 4966\\n\", \"123 54564\\n38 44 41 42 59 3 95 15 45 32 44 69 35 83 94 57 65 85 64 47 24 20 34 86 26 91 98 12 36 1 80 4 70 40 95 38 70 22 58 50 34 84 80 45 14 60 61 43 11 56 19 59 50 63 35 15 97 98 27 13 9 71 32 18 90 10 2 99 75 87 74 83 79 37 7 3 49 27 92 95 49 1 26 82 72 75 81 37 60 98 28 28 10 93 99 63 14 26 69 51 47 59 42 7 20 17 135 33 44 20 9 85 27 32 65 95 47 46 12 22 121 77 21\\n\", \"100 20\\n2 5 3 3 0 7 6 2 2 2 6 7 2 1 8 10 2 4 10 6 10 2 1 1 4 7 1 2 9 7 5 3 7 4 6 3 10 10 3 7 6 8 2 2 10 3 1 2 1 3 1 6 3 1 4 10 3 10 9 5 10 2 3 10 1 0 5 3 10 2 2 5 10 7 8 2 7 2 4 2 1 3 3 8 8 5 7 3 1 1 8 10 6 7 4 3 7 7 1 9\\n\", \"123 54564\\n38 44 41 42 59 3 95 15 45 32 44 69 18 83 94 57 65 85 64 47 24 20 34 86 26 91 98 12 36 1 80 4 70 40 95 38 70 22 58 50 34 84 80 45 14 60 61 43 11 56 19 59 50 63 35 15 97 98 27 13 9 71 32 18 90 10 2 99 75 87 74 83 79 37 7 3 49 27 92 95 49 1 26 82 72 75 81 37 60 98 28 28 10 93 99 63 14 26 69 51 47 59 42 7 20 17 135 33 44 20 9 85 27 32 65 95 47 46 12 22 121 77 21\\n\", \"100 20\\n2 5 3 3 0 7 6 2 2 2 6 7 2 1 8 10 2 4 10 6 10 2 1 1 4 7 1 2 9 7 5 3 7 4 7 3 10 10 3 7 6 8 2 2 10 3 1 2 1 3 1 6 3 1 4 10 3 10 9 5 10 2 3 10 1 0 5 3 10 2 2 5 10 7 8 2 7 2 4 2 1 3 3 8 8 5 7 3 1 1 8 10 6 7 4 3 7 7 1 9\\n\", \"123 54564\\n38 44 41 42 59 3 95 15 45 32 44 69 18 83 94 57 65 85 64 47 24 20 34 86 26 91 98 12 36 1 80 4 70 40 95 5 70 22 58 50 34 84 80 45 14 60 61 43 11 56 19 59 50 63 35 15 97 98 27 13 9 71 32 18 90 10 2 99 75 87 74 83 79 37 7 3 49 27 92 95 49 1 26 82 72 75 81 37 60 98 28 28 10 93 99 63 14 26 69 51 47 59 42 7 20 17 135 33 44 20 9 85 27 32 65 95 47 46 12 22 121 77 21\\n\", \"100 20\\n2 5 3 3 0 7 6 2 2 2 6 7 2 1 8 10 2 4 10 6 10 2 1 1 4 7 1 2 9 7 5 3 7 4 5 3 10 10 3 7 6 8 2 2 10 3 1 2 1 3 1 6 3 1 4 10 3 10 9 5 10 2 3 10 1 0 5 3 10 2 2 5 10 7 8 2 7 2 4 2 1 3 3 8 8 5 7 3 1 1 8 10 6 7 4 3 7 7 1 9\\n\", \"123 54564\\n38 44 41 42 59 3 95 15 45 33 44 69 18 83 94 57 65 85 64 47 24 20 34 86 26 91 98 12 36 1 80 4 70 40 95 5 70 22 58 50 34 84 80 45 14 60 61 43 11 56 19 59 50 63 35 15 97 98 27 13 9 71 32 18 90 10 2 99 75 87 74 83 79 37 7 3 49 27 92 95 49 1 26 82 72 75 81 37 60 98 28 28 10 93 99 63 14 26 69 51 47 59 42 7 20 17 135 33 44 20 9 85 27 32 65 95 47 46 12 22 121 77 21\\n\", \"100 20\\n2 5 3 3 0 7 6 2 2 2 6 7 2 1 8 10 2 1 10 6 10 2 1 1 4 7 1 2 9 7 5 3 7 4 5 3 10 10 3 7 6 8 2 2 10 3 1 2 1 3 1 6 3 1 4 10 3 10 9 5 10 2 3 10 1 0 5 3 10 2 2 5 10 7 8 2 7 2 4 2 1 3 3 8 8 5 7 3 1 1 8 10 6 7 4 3 7 7 1 9\\n\", \"123 54564\\n38 44 41 42 59 3 95 15 45 33 44 69 18 83 94 57 65 85 64 47 24 20 34 86 26 91 98 12 36 1 80 4 70 40 95 5 70 22 58 50 34 84 80 45 14 60 61 43 11 56 19 59 50 63 35 15 97 98 8 13 9 71 32 18 90 10 2 99 75 87 74 83 79 37 7 3 49 27 92 95 49 1 26 82 72 75 81 37 60 98 28 28 10 93 99 63 14 26 69 51 47 59 42 7 20 17 135 33 44 20 9 85 27 32 65 95 47 46 12 22 121 77 21\\n\", \"100 20\\n2 5 3 3 0 7 6 2 2 2 6 7 2 1 8 10 2 1 10 6 10 2 1 1 4 7 1 2 9 7 5 3 7 4 5 3 10 10 3 7 6 8 2 2 10 3 1 2 1 3 1 6 3 1 4 10 3 10 9 5 10 2 3 10 1 0 5 3 10 2 2 5 10 7 8 2 7 2 4 2 1 3 3 8 8 5 7 3 1 1 8 1 6 7 4 3 7 7 1 9\\n\", \"123 54564\\n38 44 41 42 59 3 95 15 45 33 44 69 18 83 94 57 65 85 64 47 24 20 34 86 26 91 98 12 36 1 80 4 70 40 95 5 70 22 58 50 34 84 80 45 14 60 61 43 11 56 19 59 50 63 35 15 97 98 8 13 9 71 32 18 90 10 2 99 75 87 74 83 79 37 7 3 49 27 92 95 49 1 26 82 72 75 81 37 60 98 28 28 10 93 99 63 14 26 69 51 47 59 42 7 20 17 135 33 44 20 9 137 27 32 65 95 47 46 12 22 121 77 21\\n\", \"100 20\\n2 5 3 3 0 7 6 2 2 2 6 7 2 1 8 10 2 1 10 6 10 2 1 1 4 7 1 2 9 7 5 3 7 4 5 3 10 10 3 7 6 8 2 2 10 3 1 2 1 3 1 6 3 1 4 15 3 10 9 5 10 2 3 10 1 0 5 3 10 2 2 5 10 7 8 2 7 2 4 2 1 3 3 8 8 5 7 3 1 1 8 1 6 7 4 3 7 7 1 9\\n\", \"123 54564\\n38 44 41 42 59 3 95 15 45 33 44 69 18 83 94 57 65 85 64 47 24 20 34 86 26 91 98 12 36 1 80 4 118 40 95 5 70 22 58 50 34 84 80 45 14 60 61 43 11 56 19 59 50 63 35 15 97 98 8 13 9 71 32 18 90 10 2 99 75 87 74 83 79 37 7 3 49 27 92 95 49 1 26 82 72 75 81 37 60 98 28 28 10 93 99 63 14 26 69 51 47 59 42 7 20 17 135 33 44 20 9 137 27 32 65 95 47 46 12 22 121 77 21\\n\", \"100 20\\n2 5 3 3 0 7 6 2 2 2 6 7 2 1 8 10 2 1 10 6 10 2 1 1 4 7 1 2 9 7 5 3 7 4 5 3 10 10 3 7 6 8 2 2 10 3 1 2 1 3 1 6 3 1 4 15 3 10 9 5 10 2 3 10 1 0 5 3 5 2 2 5 10 7 8 2 7 2 4 2 1 3 3 8 8 5 7 3 1 1 8 1 6 7 4 3 7 7 1 9\\n\", \"4 1\\n1 1 4 2\\n\", \"3 1\\n2 2 2\\n\"], \"outputs\": [\"80333\\n\", \"3\\n\", \"1\\n\", \"1\\n\", \"180\\n\", \"1\\n\", \"999999943\\n\", \"1\\n\", \"909357107\\n\", \"7\\n\", \"8\\n\", \"0\\n\", \"1\\n\", \"2\\n\", \"81023\\n\", \"6\\n\", \"1\\n\", \"7\\n\", \"8\\n\", \"0\\n\", \"2\\n\", \"103596\\n\", \"103359\\n\", \"5\\n\", \"198637\\n\", \"176004\\n\", \"175504\\n\", \"242773\\n\", \"272253\\n\", \"320976\\n\", \"315976\\n\", \"299888\\n\", \"241878\\n\", \"245540\\n\", \"275714\\n\", \"1\\n\", \"1\\n\", \"1\\n\", \"6\\n\", \"1\\n\", \"1\\n\", \"7\\n\", \"8\\n\", \"0\\n\", \"2\\n\", \"1\\n\", \"7\\n\", \"8\\n\", \"0\\n\", \"2\\n\", \"5\\n\", \"1\\n\", \"7\\n\", \"7\\n\", \"2\\n\", \"1\\n\", \"7\\n\", \"7\\n\", \"1\\n\", \"7\\n\", \"1\\n\", \"7\\n\", \"242773\\n\", \"1\\n\", \"7\\n\", \"1\\n\", \"7\\n\", \"1\\n\", \"7\\n\", \"1\\n\", \"7\\n\", \"1\\n\", \"7\\n\", \"1\\n\", \"7\\n\", \"1\\n\", \"7\\n\", \"2\\n\", \"0\\n\"]}", "source": "primeintellect"}
We all know the impressive story of Robin Hood. Robin Hood uses his archery skills and his wits to steal the money from rich, and return it to the poor. There are n citizens in Kekoland, each person has ci coins. Each day, Robin Hood will take exactly 1 coin from the richest person in the city and he will give it to the poorest person (poorest person right after taking richest's 1 coin). In case the choice is not unique, he will select one among them at random. Sadly, Robin Hood is old and want to retire in k days. He decided to spend these last days with helping poor people. After taking his money are taken by Robin Hood richest person may become poorest person as well, and it might even happen that Robin Hood will give his money back. For example if all people have same number of coins, then next day they will have same number of coins too. Your task is to find the difference between richest and poorest persons wealth after k days. Note that the choosing at random among richest and poorest doesn't affect the answer. Input The first line of the input contains two integers n and k (1 ≤ n ≤ 500 000, 0 ≤ k ≤ 109) — the number of citizens in Kekoland and the number of days left till Robin Hood's retirement. The second line contains n integers, the i-th of them is ci (1 ≤ ci ≤ 109) — initial wealth of the i-th person. Output Print a single line containing the difference between richest and poorest peoples wealth. Examples Input 4 1 1 1 4 2 Output 2 Input 3 1 2 2 2 Output 0 Note Lets look at how wealth changes through day in the first sample. 1. [1, 1, 4, 2] 2. [2, 1, 3, 2] or [1, 2, 3, 2] So the answer is 3 - 1 = 2 In second sample wealth will remain the same for each person. Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [[2, 222], [2, 77], [2700, 3000], [500, 999], [999, 2500]], \"outputs\": [[[22, 25, 27, 32, 33, 35, 52, 55, 57, 72, 75, 77]], [[22, 25, 27, 32, 33, 35, 52, 55, 57, 72, 75]], [[2722, 2723, 2725, 2727, 2732, 2733, 2735, 2737, 2752, 2755, 2757, 2772, 2773, 2775]], [[522, 525, 527, 532, 533, 535, 537, 552, 553, 555, 572, 573, 575, 722, 723, 725, 732, 735, 737, 752, 753, 755, 772, 775, 777]], [[2222, 2223, 2225, 2227, 2232, 2233, 2235, 2252, 2253, 2255, 2257, 2272, 2275, 2277, 2322, 2323, 2325, 2327, 2332, 2335, 2337, 2352, 2353, 2355, 2372, 2373, 2375]]]}", "source": "primeintellect"}
You are given two positive integers `a` and `b` (`a < b <= 20000`). Complete the function which returns a list of all those numbers in the interval `[a, b)` whose digits are made up of prime numbers (`2, 3, 5, 7`) but which are not primes themselves. Be careful about your timing! Good luck :) Write your solution by modifying this code: ```python def not_primes(a, b): ``` Your solution should implemented in the function "not_primes". The i Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [\"3\\n2 2 2\\n1 1 1\\n\", \"1\\n100000000 100000000 100000000\\n100000000\\n\", \"1\\n100000000 100000000 100000000\\n1\\n\", \"4\\n6 7 8\\n8 8 8 12\\n\", \"1\\n1 1 1\\n100000000\\n\", \"3\\n1 1 1\\n2 2 2\\n\", \"9\\n10 20 30\\n5 5 5 5 5 5 45 45 45\\n\", \"20\\n43 36 6\\n6 49 22 40 17 48 44 19 26 38 23 2 19 31 48 25 11 2 6 4\\n\", \"1\\n1 1 1\\n1\\n\", \"5\\n85660180 78921313 51382024\\n32512548 57103200 41738413 42188816 57569714\\n\", \"30\\n34938093 71279712 25853338\\n29827587 21741565 52179990 30235076 83272806 10815432 98887688 94542207 99870240 97586453 21739186 30460781 75347784 50711354 12162179 74306503 97398492 88466481 52489587 67579359 53177356 75077523 86044366 14405531 73916272 78242091 49321886 41937821 89258359 51438752\\n\", \"15\\n3 46 35\\n16 34 37 33 47 4 3 36 20 43 17 2 24 10 30\\n\", \"3\\n2 0 2\\n1 1 1\\n\", \"1\\n110000000 100000000 100000000\\n100000000\\n\", \"4\\n6 7 3\\n8 8 8 12\\n\", \"1\\n0 1 1\\n100000000\\n\", \"20\\n43 36 6\\n6 49 22 40 17 48 44 19 8 38 23 2 19 31 48 25 11 2 6 4\\n\", \"30\\n34938093 71279712 25853338\\n29827587 21741565 52179990 30235076 83272806 10815432 98887688 51704922 99870240 97586453 21739186 30460781 75347784 50711354 12162179 74306503 97398492 88466481 52489587 67579359 53177356 75077523 86044366 14405531 73916272 78242091 49321886 41937821 89258359 51438752\\n\", \"15\\n3 46 12\\n16 34 37 33 47 4 3 36 20 43 17 2 24 10 30\\n\", \"5\\n10 18 30\\n1 1 1 1 50\\n\", \"20\\n43 10 6\\n6 49 22 40 17 48 44 19 8 38 23 2 19 31 48 25 11 2 6 4\\n\", \"30\\n34938093 71279712 25853338\\n29827587 21741565 52179990 30235076 55651947 10815432 98887688 51704922 99870240 97586453 21739186 30460781 75347784 50711354 12162179 74306503 97398492 88466481 52489587 67579359 53177356 75077523 86044366 14405531 73916272 78242091 49321886 41937821 89258359 51438752\\n\", \"20\\n43 10 6\\n6 49 22 40 17 7 44 19 8 38 23 2 19 31 48 25 11 2 6 4\\n\", \"9\\n10 20 30\\n2 5 9 5 10 5 45 56 45\\n\", \"1\\n100000000 100000000 100000000\\n2\\n\", \"9\\n10 20 30\\n2 5 5 5 5 5 45 45 45\\n\", \"1\\n1 2 1\\n1\\n\", \"5\\n59736340 78921313 51382024\\n32512548 57103200 41738413 42188816 57569714\\n\", \"5\\n10 2 30\\n1 1 1 1 51\\n\", \"7\\n30 20 10\\n34 3 50 33 88 15 20\\n\", \"6\\n10 10 10\\n10 9 5 25 20 5\\n\", \"3\\n2 0 1\\n1 1 1\\n\", \"1\\n110000000 100000000 100000000\\n100000001\\n\", \"1\\n100000000 100000000 100010000\\n2\\n\", \"4\\n6 7 6\\n8 8 8 12\\n\", \"1\\n0 1 0\\n100000000\\n\", \"9\\n10 20 30\\n2 5 9 5 5 5 45 45 45\\n\", \"1\\n1 2 0\\n1\\n\", \"5\\n59736340 78921313 51382024\\n62326523 57103200 41738413 42188816 57569714\\n\", \"15\\n3 46 12\\n16 34 37 33 47 4 3 36 20 72 17 2 24 10 30\\n\", \"5\\n10 2 30\\n2 1 1 1 51\\n\", \"7\\n27 20 10\\n34 3 50 33 88 15 20\\n\", \"6\\n10 10 11\\n10 9 5 25 20 5\\n\", \"1\\n110000001 100000000 100000000\\n100000001\\n\", \"1\\n100000000 100100000 100010000\\n2\\n\", \"4\\n6 7 6\\n4 8 8 12\\n\", \"9\\n10 20 30\\n2 5 9 5 5 5 45 64 45\\n\", \"1\\n1 0 0\\n1\\n\", \"5\\n59736340 78921313 72636202\\n62326523 57103200 41738413 42188816 57569714\\n\", \"30\\n34938093 71279712 25853338\\n29827587 21741565 52179990 30235076 55651947 10815432 98887688 51704922 99870240 97586453 21739186 30460781 75347784 50711354 12162179 74306503 97398492 88466481 52489587 67579359 53177356 75077523 86044366 14405531 35482366 78242091 49321886 41937821 89258359 51438752\\n\", \"15\\n3 46 12\\n13 34 37 33 47 4 3 36 20 72 17 2 24 10 30\\n\", \"5\\n10 4 30\\n2 1 1 1 51\\n\", \"7\\n27 20 16\\n34 3 50 33 88 15 20\\n\", \"6\\n9 10 11\\n10 9 5 25 20 5\\n\", \"1\\n110000001 100000010 100000000\\n100000001\\n\", \"1\\n100000000 100100000 101010000\\n2\\n\", \"4\\n6 7 6\\n4 8 16 12\\n\", \"9\\n10 20 30\\n2 5 9 5 10 5 45 64 45\\n\", \"20\\n43 10 6\\n6 49 22 40 17 7 44 19 8 38 23 2 19 1 48 25 11 2 6 4\\n\", \"5\\n59736340 78921313 72636202\\n123507418 57103200 41738413 42188816 57569714\\n\", \"30\\n34938093 71279712 25853338\\n29827587 21741565 52179990 30235076 55651947 10815432 98887688 51704922 99870240 97586453 21739186 30460781 75347784 50711354 12162179 81286642 97398492 88466481 52489587 67579359 53177356 75077523 86044366 14405531 35482366 78242091 49321886 41937821 89258359 51438752\\n\", \"15\\n3 46 12\\n13 34 37 33 47 0 3 36 20 72 17 2 24 10 30\\n\", \"5\\n10 4 30\\n2 1 2 1 51\\n\", \"7\\n27 20 16\\n34 3 50 33 88 26 20\\n\", \"6\\n14 10 11\\n10 9 5 25 20 5\\n\", \"1\\n110000001 100000010 100000001\\n100000001\\n\", \"1\\n100000000 100100001 101010000\\n2\\n\", \"4\\n6 7 6\\n8 8 16 12\\n\", \"20\\n43 10 6\\n6 49 22 40 17 7 66 19 8 38 23 2 19 1 48 25 11 2 6 4\\n\", \"5\\n59736340 78921313 72636202\\n123507418 57241159 41738413 42188816 57569714\\n\", \"5\\n10 20 30\\n1 1 1 1 51\\n\", \"7\\n30 20 10\\n34 19 50 33 88 15 20\\n\", \"5\\n10 20 30\\n1 1 1 1 50\\n\", \"6\\n10 5 10\\n10 9 5 25 20 5\\n\"], \"outputs\": [\"1\\n\", \"1\\n\", \"1\\n\", \"2\\n\", \"-1\\n\", \"3\\n\", \"4\\n\", \"8\\n\", \"1\\n\", \"2\\n\", \"18\\n\", \"7\\n\", \"2\\n\", \"1\\n\", \"4\\n\", \"-1\\n\", \"8\\n\", \"18\\n\", \"11\\n\", \"3\\n\", \"13\\n\", \"17\\n\", \"12\\n\", \"5\\n\", \"1\\n\", \"4\\n\", \"1\\n\", \"2\\n\", \"-1\\n\", \"-1\\n\", \"3\\n\", \"2\\n\", \"1\\n\", \"1\\n\", \"4\\n\", \"-1\\n\", \"4\\n\", \"1\\n\", \"2\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"3\\n\", \"1\\n\", \"1\\n\", \"3\\n\", \"-1\\n\", \"1\\n\", \"2\\n\", \"17\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"3\\n\", \"1\\n\", \"1\\n\", \"3\\n\", \"-1\\n\", \"11\\n\", \"2\\n\", \"17\\n\", \"-1\\n\", \"-1\\n\", \"-1\\n\", \"3\\n\", \"1\\n\", \"1\\n\", \"4\\n\", \"-1\\n\", \"2\\n\", \"3\\n\", \"-1\\n\", \"2\\n\", \"3\\n\"]}", "source": "primeintellect"}
Do you know the story about the three musketeers? Anyway, you must help them now. Richelimakieu is a cardinal in the city of Bearis. He found three brave warriors and called them the three musketeers. Athos has strength a, Borthos strength b, and Caramis has strength c. The year 2015 is almost over and there are still n criminals to be defeated. The i-th criminal has strength ti. It's hard to defeat strong criminals — maybe musketeers will have to fight together to achieve it. Richelimakieu will coordinate musketeers' actions. In each hour each musketeer can either do nothing or be assigned to one criminal. Two or three musketeers can be assigned to the same criminal and then their strengths are summed up. A criminal can be defeated in exactly one hour (also if two or three musketeers fight him). Richelimakieu can't allow the situation where a criminal has strength bigger than the sum of strengths of musketeers fighting him — a criminal would win then! In other words, there are three ways to defeat a criminal. * A musketeer of the strength x in one hour can defeat a criminal of the strength not greater than x. So, for example Athos in one hour can defeat criminal i only if ti ≤ a. * Two musketeers can fight together and in one hour defeat a criminal of the strength not greater than the sum of strengths of these two musketeers. So, for example Athos and Caramis in one hour can defeat criminal i only if ti ≤ a + c. Note that the third remaining musketeer can either do nothing or fight some other criminal. * Similarly, all three musketeers can fight together and in one hour defeat a criminal of the strength not greater than the sum of musketeers' strengths, i.e. ti ≤ a + b + c. Richelimakieu doesn't want musketeers to fight during the New Year's Eve. Thus, he must coordinate their actions in order to minimize the number of hours till all criminals will be defeated. Find the minimum number of hours to defeat all criminals. If musketeers can't defeat them all then print "-1" (without the quotes) instead. Input The first line of the input contains a single integer n (1 ≤ n ≤ 200 000) — the number of criminals. The second line contains three integers a, b and c (1 ≤ a, b, c ≤ 108) — strengths of musketeers. The third line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ 108) — strengths of criminals. Output Print one line with the answer. If it's impossible to defeat all criminals, print "-1" (without the quotes). Otherwise, print the minimum number of hours the three musketeers will spend on defeating all criminals. Examples Input 5 10 20 30 1 1 1 1 50 Output 2 Input 5 10 20 30 1 1 1 1 51 Output 3 Input 7 30 20 10 34 19 50 33 88 15 20 Output -1 Input 6 10 5 10 10 9 5 25 20 5 Output 3 Note In the first sample Athos has strength 10, Borthos 20, and Caramis 30. They can defeat all criminals in two hours: * Borthos and Caramis should together fight a criminal with strength 50. In the same hour Athos can fight one of four criminals with strength 1. * There are three criminals left, each with strength 1. Each musketeer can fight one criminal in the second hour. In the second sample all three musketeers must together fight a criminal with strength 51. It takes one hour. In the second hour they can fight separately, each with one criminal. In the third hour one criminal is left and any of musketeers can fight him. Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [[\"H\"], [\"Cr\"], [\"C\"], [\"Br\"], [\"V\"]], \"outputs\": [[\"H -> 1s1\"], [\"Cr -> 1s2 2s2 2p6 3s2 3p6 3d5 4s1\"], [\"C -> 1s2 2s2 2p2\"], [\"Br -> 1s2 2s2 2p6 3s2 3p6 3d10 4s2 4p5\"], [\"V -> 1s2 2s2 2p6 3s2 3p6 3d3 4s2\"]]}", "source": "primeintellect"}
## Introduction Each chemical element in its neutral state has a specific number of electrons associated with it. This is represented by the **atomic number** which is noted by an integer number next to or above each element of the periodic table (as highlighted in the image above). As we move from left to right, starting from the top row of the periodic table, each element differs from its predecessor by 1 unit (electron). Electrons fill in different orbitals sets according to a specific order. Each set of orbitals, when full, contains an even number of electrons. The orbital sets are: * The _**s** orbital_ - a single orbital that can hold a maximum of 2 electrons. * The _**p** orbital set_ - can hold 6 electrons. * The _**d** orbital set_ - can hold 10 electrons. * The _**f** orbital set_ - can hold 14 electrons. The order in which electrons are filling the different set of orbitals is shown in the picture above. First electrons will occupy the **1s** orbital, then the **2s**, then the **2p** set, **3s** and so on. Electron configurations show how the number of electrons of an element is distributed across each orbital set. Each orbital is written as a sequence that follows the order in the picture, joined by the number of electrons contained in that orbital set. The final electron configuration is a single string of orbital names and number of electrons per orbital set where the first 2 digits of each substring represent the orbital name followed by a number that states the number of electrons that the orbital set contains. For example, a string that demonstrates an electron configuration of a chemical element that contains 10 electrons is: `1s2 2s2 2p6`. This configuration shows that there are two electrons in the `1s` orbital set, two electrons in the `2s` orbital set, and six electrons in the `2p` orbital set. `2 + 2 + 6 = 10` electrons total. ___ # Task Your task is to write a function that displays the electron configuration built according to the Madelung rule of all chemical elements of the periodic table. The argument will be the symbol of a chemical element, as displayed in the periodic table. **Note**: There will be a preloaded array called `ELEMENTS` with chemical elements sorted by their atomic number. For example, when the element "O" is fed into the function the output should look like: `"O -> 1s2 2s2 2p4"` However, there are some exceptions! The electron configurations of the elements below should end as: ``` Cr -> ...3d5 4s1 Cu -> ...3d10 4s1 Nb -> ...4d4 5s1 Mo -> ...4d5 5s1 Ru -> ...4d7 5s1 Rh -> ...4d8 5s1 Pd -> ...4d10 5s0 Ag -> ...4d10 5s1 La -> ...4f0 5d1 Ce -> ...4f1 5d1 Gd -> ...4f7 5d1 6s2 Pt -> ...4f14 5d9 6s1 Au -> ...4f14 5d10 6s1 Ac -> ...5f0 6d1 7s2 Th -> ...5f0 6d2 7s2 Pa -> ...5f2 6d1 7s2 U -> ...5f3 6d1 7s2 Np -> ...5f4 6d1 7s2 Cm -> ...5f7 6d1 7s2 ``` **Note**: for `Ni` the electron configuration should be `3d8 4s2` instead of `3d9 4s1`. Write your solution by modifying this code: ```python ELEMENTS = ['H', 'He', 'Li', 'Be', 'B', 'C', 'N', 'O', 'F', 'Ne', 'Na', 'Mg', 'Al', 'Si', 'P', 'S', 'Cl', 'Ar', 'K', 'Ca', 'Sc', 'Ti', 'V', 'Cr', 'Mn', 'Fe', 'Co', 'Ni', 'Cu', 'Zn', 'Ga', 'Ge', 'As', 'Se', 'Br', 'Kr', 'Rb', 'Sr', 'Y', 'Zr', 'Nb', 'Mo', 'Tc', 'Ru', 'Rh', 'Pd', 'Ag', 'Cd', 'In', 'Sn', 'Sb', 'Te', 'I', 'Xe', 'Cs', 'Ba', 'La', 'Ce', 'Pr', 'Nd', 'Pm', 'Sm', 'Eu', 'Gd', 'Tb', 'Dy', 'Ho', 'Er', 'Tm', 'Yb', 'Lu', 'Hf', 'Ta', 'W', 'Re', 'Os', 'Ir', 'Pt', 'Au', 'Hg', 'Tl', 'Pb', 'Bi', 'Po', 'At', 'Rn', 'Fr', 'Ra', 'Ac', 'Th', 'Pa', 'U', 'Np', 'Pu', 'Am', 'Cm', 'Bk', 'Cf', 'Es', 'Fm', 'Md', 'No', 'Lr', 'Rf', 'Db', 'Sg', 'Bh', 'Hs', 'Mt', 'Ds', 'Rg', 'Cn', 'Nh', 'Fl', 'Mc', 'Lv', 'Ts', 'Og'] def get_electron_configuration(element): ``` Your solution should implemented in the function "get_electron_configuration". The i Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [\"3\\n4 6\\n.R....\\n......\\n......\\n.W....\\n4 4\\n.R.W\\n....\\n....\\n....\\n5 1\\nR\\nW\\nR\\nW\\nR\\n\", \"1\\n3 1\\n.\\nR\\n.\\n\", \"1\\n1 1\\n.\\n\", \"1\\n5 5\\n.....\\n.....\\n.....\\n.....\\n....W\\n\", \"1\\n5 5\\n.....\\n.....\\n.....\\n.....\\n....W\\n\", \"1\\n1 1\\n.\\n\", \"1\\n3 1\\n.\\nR\\n.\\n\", \"1\\n1 1\\n.\\nR\\n.\\n\", \"3\\n4 6\\n.R....\\n......\\n......\\n.W....\\n4 4\\nR..W\\n....\\n....\\n....\\n5 1\\nR\\nW\\nR\\nW\\nR\\n\", \"3\\n4 6\\n.R....\\n......\\n......\\n.W....\\n4 4\\n.R.W\\n....\\n.../\\n....\\n5 1\\nR\\nW\\nR\\nW\\nR\\n\", \"1\\n3 5\\n.....\\n.....\\n.....\\n.....\\n....W\\n\", \"3\\n4 6\\n.R....\\n......\\n......\\n.W....\\n4 4\\n.R.W\\n....\\n....\\n....\\n4 1\\nR\\nW\\nR\\nW\\nR\\n\", \"3\\n4 6\\n.R....\\n......\\n......\\n....W.\\n4 4\\n.R.W\\n....\\n....\\n....\\n5 1\\nR\\nW\\nR\\nW\\nR\\n\", \"1\\n2 5\\n.....\\n.....\\n.....\\n...-.\\n....W\\n\", \"1\\n2 1\\n.\\nR\\n/\\n\", \"3\\n4 6\\n.R....\\n......\\n......\\n....W.\\n4 4\\nR..W\\n....\\n....\\n....\\n5 1\\nR\\nW\\nR\\nW\\nR\\n\", \"1\\n1 5\\n.....\\n.....\\n.....\\n.-/.-\\n....W\\n\", \"1\\n4 5\\n.....\\n.....\\n.....\\n.....\\n....W\\n\", \"3\\n4 6\\n.R....\\n......\\n......\\n.W....\\n4 4\\n.R.W\\n....\\n.../\\n....\\n2 1\\nR\\nW\\nR\\nW\\nR\\n\", \"3\\n4 6\\n.R....\\n......\\n......\\n....W.\\n4 4\\nW..R\\n....\\n....\\n....\\n5 1\\nR\\nW\\nR\\nW\\nR\\n\", \"3\\n4 6\\n.R....\\n......\\n......\\n.W....\\n4 4\\n.R.W\\n....\\n.../\\n....\\n1 1\\nR\\nW\\nR\\nW\\nR\\n\", \"3\\n4 6\\n....R.\\n......\\n......\\n.W....\\n4 4\\n.R.W\\n.-..\\n.../\\n....\\n2 1\\nR\\nW\\nR\\nW\\nR\\n\", \"3\\n4 6\\n.R....\\n......\\n......\\n....W.\\n4 4\\nW..R\\n....\\n....\\n....\\n2 1\\nR\\nW\\nR\\nW\\nR\\n\", \"3\\n4 6\\n....R.\\n......\\n......\\n....W.\\n4 4\\n.R.W\\n../-\\n.-./\\n....\\n5 1\\nR\\nW\\nR\\nW\\nR\\n\", \"3\\n4 6\\n....R.\\n..../.\\n......\\n.W....\\n4 4\\n.R.W\\n.-..\\n.../\\n....\\n3 1\\nR\\nW\\nR\\nV\\nR\\n\", \"1\\n1 1\\n.\\nQ\\n.\\n\", \"3\\n4 6\\n.R....\\n......\\n......\\n.W....\\n4 4\\n.R.W\\n..-.\\n....\\n....\\n5 1\\nR\\nW\\nR\\nW\\nR\\n\", \"1\\n1 1\\n.\\nQ\\n-\\n\", \"3\\n4 6\\n.R....\\n......\\n......\\n.W....\\n4 4\\n.R.W\\n.-..\\n.../\\n....\\n5 1\\nR\\nW\\nR\\nW\\nR\\n\", \"1\\n3 5\\n.....\\n.....\\n.....\\n.....\\n-...W\\n\", \"1\\n1 1\\n.\\nQ\\n/\\n\", \"3\\n4 6\\n.R....\\n......\\n......\\n.W....\\n4 4\\n.R.W\\n....\\n-../\\n....\\n5 1\\nR\\nW\\nR\\nW\\nR\\n\", \"1\\n3 5\\n.....\\n.....\\n.....\\n...-.\\n....W\\n\", \"1\\n1 1\\n.\\nP\\n-\\n\", \"1\\n1 1\\n.\\nP\\n,\\n\", \"1\\n1 1\\n.\\nO\\n,\\n\", \"1\\n3 5\\n.....\\n.....\\n.....\\n.....\\n....V\\n\", \"3\\n4 6\\n.R....\\n......\\n......\\n.W....\\n4 4\\n.R.W\\n--..\\n.../\\n....\\n5 1\\nR\\nW\\nR\\nW\\nR\\n\", \"1\\n3 5\\n.....\\n.....\\n.....\\n-..-.\\n....W\\n\", \"1\\n1 1\\n.\\nP\\n.\\n\", \"1\\n3 5\\n.....\\n.....\\n.....\\n-..,.\\n....W\\n\", \"3\\n4 6\\n.R....\\n......\\n......\\n....W.\\n4 4\\n.R.W\\n....\\n.../\\n....\\n5 1\\nR\\nW\\nR\\nW\\nR\\n\", \"1\\n1 1\\n.\\nR\\n/\\n\", \"1\\n3 5\\n.....\\n.....\\n.....\\n-./-.\\n....W\\n\", \"1\\n3 5\\n.....\\n.....\\n.....\\n,..,.\\n....W\\n\", \"1\\n2 1\\n.\\nR\\n.\\n\", \"3\\n4 6\\n.R....\\n......\\n......\\n.W....\\n4 4\\n.R.W\\n...-\\n.../\\n....\\n5 1\\nR\\nW\\nR\\nW\\nR\\n\", \"3\\n4 6\\n.R....\\n......\\n......\\n.W....\\n4 4\\n.R.W\\n--..\\n.../\\n../.\\n5 1\\nR\\nW\\nR\\nW\\nR\\n\", \"1\\n1 1\\n.\\nO\\n-\\n\", \"1\\n1 1\\n.\\nR\\n0\\n\", \"1\\n2 5\\n.....\\n.....\\n../..\\n...-.\\n....W\\n\", \"1\\n3 5\\n.....\\n.....\\n.....\\n.-/.-\\n....W\\n\", \"1\\n3 5\\n.....\\n.....\\n.....\\n.,..,\\n....W\\n\", \"1\\n2 1\\n.\\nR\\n-\\n\", \"1\\n1 1\\n.\\nR\\n1\\n\", \"1\\n1 1\\n.\\nR\\n-\\n\", \"1\\n1 5\\n.....\\n...-.\\n.....\\n.-/.-\\n....W\\n\", \"1\\n1 1\\n.\\nP\\n/\\n\", \"1\\n3 5\\n.....\\n.....\\n.....\\n-....\\n....W\\n\", \"1\\n1 5\\n.....\\n.....\\n.....\\n.....\\n-...W\\n\", \"1\\n1 1\\n.\\nO\\n/\\n\", \"1\\n1 1\\n.\\nN\\n,\\n\", \"3\\n4 6\\n.R....\\n......\\n......\\n.W....\\n4 4\\n.R.W\\n---.\\n.../\\n....\\n5 1\\nR\\nW\\nR\\nW\\nR\\n\", \"1\\n3 5\\n.....\\n.....\\n.....\\n.-..-\\n....W\\n\", \"1\\n2 5\\n.....\\n.....\\n.....\\n.-...\\n....W\\n\", \"3\\n4 6\\n.R....\\n......\\n......\\n.W....\\n4 4\\n.R.W\\n...-\\n.-./\\n....\\n5 1\\nR\\nW\\nR\\nW\\nR\\n\", \"1\\n2 5\\n.....\\n.....\\n.././\\n...-.\\n....W\\n\", \"1\\n2 1\\n.\\nR\\n1\\n\", \"1\\n1 5\\n.....\\n.....\\n..../\\n.-/.-\\n....W\\n\", \"1\\n1 1\\n.\\nR\\n,\\n\", \"1\\n1 5\\n.....\\n.....\\n.....\\n/....\\n-...W\\n\", \"1\\n2 5\\n.....\\n.....\\n.....\\n.-...\\nW....\\n\", \"1\\n2 5\\n.....\\n.....\\n.././\\n../-.\\n....W\\n\", \"1\\n1 5\\n.....\\n.....\\n/.../\\n.-/.-\\n....W\\n\", \"1\\n1 1\\n.\\nQ\\n,\\n\", \"1\\n1 5\\n.....\\n.....\\n/....\\n/....\\n-...W\\n\", \"1\\n2 5\\n.....\\n.....\\n.//./\\n../-.\\n....W\\n\", \"1\\n1 1\\n.\\nQ\\n+\\n\", \"1\\n3 5\\n.....\\n.....\\n.....\\n...-.\\n/...W\\n\", \"1\\n2 1\\n.\\nR\\n0\\n\", \"1\\n3 5\\n.....\\n.....\\n.....\\n-./-/\\n....W\\n\", \"3\\n4 6\\n.R....\\n......\\n......\\n.W....\\n4 4\\n.R.W\\n--..\\n/...\\n../.\\n5 1\\nR\\nW\\nR\\nW\\nR\\n\", \"1\\n1 5\\n.....\\n...-.\\n.-...\\n.-/.-\\n....W\\n\", \"1\\n1 1\\n.\\nP\\n0\\n\", \"3\\n4 6\\n.R....\\n......\\n......\\n.W....\\n4 4\\n.R.W\\n../-\\n.-./\\n....\\n5 1\\nR\\nW\\nR\\nW\\nR\\n\", \"1\\n2 5\\n.....\\n.....\\n.-/./\\n...-.\\n....W\\n\", \"1\\n2 1\\n.\\nR\\n2\\n\", \"1\\n2 1\\n.\\nR\\n,\\n\", \"1\\n2 5\\n.....\\n.....\\n-././\\n../-.\\n....W\\n\", \"1\\n1 5\\n.....\\n.....\\n/.../\\n./-.-\\n....W\\n\", \"1\\n1 5\\n.....\\n.....\\n/....\\n/.-..\\n-...W\\n\", \"1\\n3 5\\n.....\\n.....\\n.....\\n-./-/\\nW....\\n\", \"3\\n4 6\\n.R....\\n......\\n......\\n.W....\\n4 4\\n.R.W\\n.-..\\n/...\\n../.\\n5 1\\nR\\nW\\nR\\nW\\nR\\n\", \"1\\n2 5\\n.....\\n.....\\n.-/./\\n.-...\\n....W\\n\", \"1\\n2 5\\n.....\\n.....\\n,././\\n../-.\\n....W\\n\", \"1\\n1 5\\n.....\\n.....\\n/.../\\n./.--\\n....W\\n\", \"1\\n1 5\\n.....\\n....-\\n/....\\n/.-..\\n-...W\\n\", \"1\\n3 5\\n.....\\n.....\\n.....\\n-.0-/\\nW....\\n\", \"3\\n4 6\\n.R....\\n......\\n......\\n.W....\\n4 4\\n.R.W\\n.,..\\n/...\\n../.\\n5 1\\nR\\nW\\nR\\nW\\nR\\n\", \"1\\n2 5\\n.....\\n.....\\n,.///\\n../-.\\n....W\\n\", \"1\\n1 5\\n.....\\n.....\\n/.../\\n...--\\n....W\\n\", \"1\\n1 5\\n.....\\n....-\\n//...\\n/.-..\\n-...W\\n\", \"1\\n1 5\\n.....\\n.....\\n.....\\n-.0-/\\nW....\\n\", \"1\\n2 5\\n.....\\n.....\\n.....\\n-.0-/\\nW....\\n\", \"1\\n1 1\\n.\\nS\\n.\\n\", \"1\\n3 5\\n.....\\n.....\\n.....\\n.....\\nW....\\n\", \"3\\n4 6\\n.R....\\n......\\n......\\n.W....\\n4 4\\n.R.W\\n..-.\\n./..\\n....\\n5 1\\nR\\nW\\nR\\nW\\nR\\n\", \"1\\n3 5\\n.....\\n.....\\n.....\\n.-...\\n....W\\n\", \"1\\n3 5\\n.....\\n.....\\n.....\\n...,.\\n....W\\n\", \"1\\n3 5\\n.....\\n.....\\n.....\\n-./-.\\n....V\\n\", \"3\\n4 6\\n.R....\\n......\\n......\\n.W....\\n4 4\\n.R.W\\n...-\\n..//\\n....\\n5 1\\nR\\nW\\nR\\nW\\nR\\n\", \"3\\n4 6\\n...R..\\n......\\n......\\n.W....\\n4 4\\n.R.W\\n--..\\n.../\\n../.\\n5 1\\nR\\nW\\nR\\nW\\nR\\n\", \"1\\n1 1\\n.\\nN\\n-\\n\", \"1\\n1 1\\n.\\nS\\n0\\n\", \"1\\n2 5\\n.....\\n.....\\n.//..\\n...-.\\n....W\\n\", \"1\\n3 5\\n.....\\n.....\\n.....\\n.-/.-\\nW....\\n\", \"1\\n1 5\\n.....\\n.....\\n.....\\n-./.-\\n....W\\n\", \"1\\n1 5\\n.....\\n...-.\\n.....\\n.-/.-\\n-...W\\n\", \"1\\n2 5\\n.....\\n.....\\n.....\\n.-...\\n.W...\\n\", \"1\\n1 5\\n.....\\n.....\\n.././\\n...-.\\n....W\\n\", \"1\\n2 5\\n.....\\n.....\\n.././\\n../-.\\n/...W\\n\", \"1\\n2 5\\n.....\\n.....\\n.//./\\n../-.\\n..W..\\n\", \"3\\n4 6\\n.R....\\n......\\n......\\n.W....\\n4 4\\n.R.W\\n.-..\\n.../\\n....\\n2 1\\nR\\nW\\nR\\nW\\nR\\n\", \"1\\n3 5\\n.....\\n.....\\n.....\\n-./-/\\n/...W\\n\", \"1\\n1 5\\n.....\\n..../\\n/.../\\n./-.-\\n....W\\n\", \"1\\n2 5\\n.....\\n.....\\n.././\\n.-...\\n....W\\n\", \"1\\n2 5\\n.....\\n.....\\n,././\\n.-/..\\n....W\\n\", \"1\\n1 5\\n.....\\n../..\\n/.../\\n./.--\\n....W\\n\", \"1\\n1 5\\n.....\\n....-\\n/....\\n..-./\\n-...W\\n\", \"1\\n3 5\\n.....\\n.....\\n.....\\n,.0-/\\nW....\\n\", \"1\\n1 5\\n.....\\n/....\\n/.../\\n...--\\n....W\\n\", \"1\\n1 5\\n.....\\n....-\\n//-..\\n/.-..\\n-...W\\n\", \"1\\n1 5\\n.....\\n.....\\n../..\\n-.0-/\\nW....\\n\", \"1\\n1 1\\n.\\nT\\n.\\n\", \"3\\n4 6\\n.R....\\n......\\n......\\n.W....\\n4 4\\n.R.W\\n....\\n./..\\n....\\n5 1\\nR\\nW\\nR\\nW\\nR\\n\", \"1\\n2 5\\n.....\\n.....\\n.....\\n...,.\\n....W\\n\", \"1\\n1 1\\n.\\nM\\n-\\n\", \"1\\n2 5\\n.....\\n.....\\n.//..\\n...-.\\n.-..W\\n\", \"1\\n1 5\\n.....\\n.....\\n.....\\n,./.-\\n....W\\n\", \"1\\n1 5\\n.....\\n...-.\\n...-.\\n.-/.-\\n-...W\\n\", \"1\\n1 5\\n.....\\n.....\\n.././\\n./.-.\\n....W\\n\", \"1\\n2 5\\n.....\\n.....\\n.././\\n.-/..\\n/...W\\n\", \"1\\n2 5\\n.....\\n.....\\n.//..\\n../-.\\n..W..\\n\", \"1\\n1 5\\n.....\\n./..-\\n/....\\n..-./\\n-...W\\n\", \"1\\n3 5\\n.....\\n.....\\n.....\\n,.0-/\\n....W\\n\", \"1\\n1 5\\n.....\\n....-\\n//-..\\n/..-.\\n-...W\\n\", \"1\\n1 5\\n.....\\n.....\\n/./..\\n-.0-/\\nW....\\n\", \"1\\n2 5\\n.....\\n.....\\n.//./\\n...-.\\n.-..W\\n\", \"1\\n1 5\\n.....\\n...-.\\n.....\\n.-/.-\\n-/..W\\n\", \"1\\n1 5\\n.....\\n/....\\n.././\\n./.-.\\n....W\\n\", \"1\\n2 5\\n.....\\n.....\\n/./..\\n.-/..\\n/...W\\n\", \"1\\n2 5\\n.....\\n.....\\n.//..\\n../,.\\n..W..\\n\", \"1\\n1 5\\n.....\\n./..-\\n/..-.\\n..-./\\n-...W\\n\", \"1\\n1 5\\n.....\\n.....\\n/./..\\n-.0-/\\n.W...\\n\", \"1\\n1 5\\n.....\\n/..-.\\n.....\\n.-/.-\\n-/..W\\n\", \"1\\n2 5\\n.....\\n.....\\n/./..\\n.-./.\\n/...W\\n\", \"3\\n4 6\\n.R....\\n......\\n......\\n.W....\\n4 4\\n.R.W\\n....\\n.-..\\n....\\n5 1\\nR\\nW\\nR\\nW\\nR\\n\", \"3\\n4 6\\n.R....\\n......\\n......\\n.W....\\n4 4\\n.R.W\\n....\\n/..-\\n....\\n5 1\\nR\\nW\\nR\\nW\\nR\\n\", \"1\\n2 5\\n.....\\n.....\\n.....\\n...-.\\n/...W\\n\", \"1\\n3 5\\n.....\\n.....\\n.....\\n-..-.\\n../.W\\n\", \"3\\n4 6\\n.R....\\n......\\n......\\n.W....\\n4 4\\n.R.W\\n..--\\n.../\\n../.\\n5 1\\nR\\nW\\nR\\nW\\nR\\n\", \"1\\n1 1\\n.\\nR\\n2\\n\", \"1\\n2 5\\n.....\\n.....\\n../..\\n...-.\\n..-.W\\n\", \"1\\n2 5\\n.....\\n.....\\n.....\\n.-/.-\\n....W\\n\", \"1\\n3 5\\n.....\\n.....\\n.....\\n.,..,\\n./..W\\n\", \"1\\n1 5\\n.....\\n.....\\n.....\\n.-/.-\\n...-W\\n\", \"1\\n1 5\\n.....\\n..-..\\n.....\\n.-/.-\\n....W\\n\", \"1\\n1 5\\n.....\\n.....\\n.....\\n-....\\n-...W\\n\", \"3\\n4 6\\n.R....\\n......\\n......\\n.W....\\n4 4\\n.R.W\\n.---\\n.../\\n....\\n5 1\\nR\\nW\\nR\\nW\\nR\\n\", \"1\\n1 5\\n.....\\n.....\\n..../\\n.-/.-\\n.../W\\n\", \"1\\n2 5\\n.....\\n.....\\n.....\\n.-..-\\nW....\\n\", \"1\\n2 5\\n.....\\n.....\\n.././\\n../-/\\n....W\\n\", \"1\\n1 5\\n.....\\n.....\\n//...\\n.-/.-\\n....W\\n\", \"1\\n1 5\\n.....\\n.....\\n.//./\\n../-.\\n....W\\n\", \"1\\n1 1\\n.\\nR\\n+\\n\", \"1\\n1 5\\n.....\\n...-.\\n.-...\\n.-/.-\\nW....\\n\", \"3\\n4 6\\n....R.\\n......\\n......\\n.W....\\n4 4\\n.R.W\\n../-\\n.-./\\n....\\n5 1\\nR\\nW\\nR\\nW\\nR\\n\", \"1\\n2 5\\n.....\\n.....\\n--/./\\n.-...\\n....W\\n\", \"1\\n2 5\\n.....\\n.....\\n-././\\n../-.\\nW....\\n\", \"1\\n2 5\\n.....\\n.....\\n/.../\\n./-.-\\n....W\\n\", \"1\\n1 5\\n.....\\n.....\\n..../\\n/.-..\\n-...W\\n\", \"1\\n1 5\\n.....\\n.....\\n/.../\\n./.--\\nW....\\n\", \"1\\n1 5\\n.....\\n....-\\n/./..\\n/.-..\\n-...W\\n\", \"1\\n2 5\\n.....\\n.....\\n.....\\n-.0-/\\nW../.\\n\", \"1\\n1 5\\n.....\\n.....\\n/.../\\n...--\\n-...W\\n\", \"1\\n1 5\\n.....\\n....-\\n//...\\n/.-..\\n-...V\\n\", \"1\\n1 5\\n.....\\n.....\\n.....\\n-.0-/\\n....W\\n\", \"1\\n2 5\\n.....\\n.....\\n.....\\n-.0-/\\nW.-..\\n\", \"1\\n3 5\\n.....\\n.....\\n.....\\n.-...\\n/...W\\n\", \"1\\n3 5\\n.....\\n.....\\n.....\\n....,\\n....W\\n\", \"1\\n3 5\\n.....\\n.....\\n.....\\n-./-/\\n....V\\n\", \"1\\n1 1\\n.\\nN\\n.\\n\", \"1\\n2 5\\n.....\\n.....\\n.//..\\n..--.\\n....W\\n\", \"1\\n1 5\\n.....\\n...-.\\n.....\\n.-/.-\\n-.-.W\\n\", \"1\\n1 5\\n.....\\n.....\\n.....\\n.-...\\n.W...\\n\", \"1\\n1 5\\n.....\\n.....\\n..0./\\n...-.\\n....W\\n\", \"1\\n2 5\\n.....\\n.....\\n../-/\\n../-.\\n/...W\\n\", \"1\\n1 5\\n.....\\n..../\\n/.../\\n./-.-\\nW....\\n\", \"1\\n2 5\\n.....\\n.....\\n.././\\n.-...\\n....X\\n\", \"1\\n3 5\\n.....\\n.....\\n.....\\n+.0-/\\nW....\\n\", \"1\\n1 5\\n.....\\n.....\\n../..\\n-.0-.\\nW....\\n\", \"1\\n2 5\\n.....\\n.....\\n..//.\\n...-.\\n.-..W\\n\", \"1\\n1 5\\n.....\\n.....\\n.....\\n.,/.-\\n....W\\n\", \"1\\n1 5\\n.....\\n...-/\\n...-.\\n.-/.-\\n-...W\\n\", \"1\\n1 5\\n.....\\n.....\\n/././\\n./.-.\\n....W\\n\", \"1\\n1 5\\n.....\\n./..-\\n..../\\n..-./\\n-...W\\n\", \"1\\n1 5\\n.....\\n....-\\n..-//\\n/..-.\\n-...W\\n\", \"3\\n4 6\\n.R....\\n......\\n......\\n.W....\\n4 4\\n.R.W\\n....\\n....\\n....\\n5 1\\nR\\nW\\nR\\nW\\nR\\n\"], \"outputs\": [\"YES\\nWRWRWR\\nRWRWRW\\nWRWRWR\\nRWRWRW\\nNO\\nYES\\nR\\nW\\nR\\nW\\nR\\n\", \"YES\\nW\\nR\\nW\\n\", \"YES\\nR\\n\", \"YES\\nWRWRW\\nRWRWR\\nWRWRW\\nRWRWR\\nWRWRW\\n\", \"YES\\nWRWRW\\nRWRWR\\nWRWRW\\nRWRWR\\nWRWRW\\n\", \"YES\\nR\\n\", \"YES\\nW\\nR\\nW\\n\", \"YES\\nR\\n\", \"YES\\nWRWRWR\\nRWRWRW\\nWRWRWR\\nRWRWRW\\nYES\\nRWRW\\nWRWR\\nRWRW\\nWRWR\\nYES\\nR\\nW\\nR\\nW\\nR\\n\", \"YES\\nWRWRWR\\nRWRWRW\\nWRWRWR\\nRWRWRW\\nNO\\nYES\\nR\\nW\\nR\\nW\\nR\\n\", \"YES\\nRWRWR\\nWRWRW\\nRWRWR\\n\", \"YES\\nWRWRWR\\nRWRWRW\\nWRWRWR\\nRWRWRW\\nNO\\nYES\\nR\\nW\\nR\\nW\\n\", \"NO\\nNO\\nYES\\nR\\nW\\nR\\nW\\nR\\n\", \"YES\\nRWRWR\\nWRWRW\\n\", \"YES\\nW\\nR\\n\", \"NO\\nYES\\nRWRW\\nWRWR\\nRWRW\\nWRWR\\nYES\\nR\\nW\\nR\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W\\nR\\nW\\nR\\n\", \"YES\\nR\\n\", \"YES\\nRWRWR\\nWRWRW\\nRWRWR\\n\", \"YES\\nRWRWR\\nWRWRW\\nRWRWR\\n\", \"YES\\nW\\nR\\n\", \"YES\\nWRWRWR\\nRWRWRW\\nWRWRWR\\nRWRWRW\\nNO\\nYES\\nR\\nW\\nR\\nW\\nR\\n\", \"YES\\nWRWRWR\\nRWRWRW\\nWRWRWR\\nRWRWRW\\nNO\\nYES\\nR\\nW\\nR\\nW\\nR\\n\", \"YES\\nR\\n\", \"YES\\nR\\n\", \"YES\\nRWRWR\\nWRWRW\\n\", \"YES\\nRWRWR\\nWRWRW\\nRWRWR\\n\", \"YES\\nRWRWR\\nWRWRW\\nRWRWR\\n\", \"YES\\nW\\nR\\n\", \"YES\\nR\\n\", \"YES\\nR\\n\", \"YES\\nRWRWR\\n\", \"YES\\nR\\n\", \"YES\\nRWRWR\\nWRWRW\\nRWRWR\\n\", \"YES\\nRWRWR\\n\", \"YES\\nR\\n\", \"YES\\nR\\n\", \"YES\\nWRWRWR\\nRWRWRW\\nWRWRWR\\nRWRWRW\\nNO\\nYES\\nR\\nW\\nR\\nW\\nR\\n\", \"YES\\nRWRWR\\nWRWRW\\nRWRWR\\n\", \"YES\\nRWRWR\\nWRWRW\\n\", \"YES\\nWRWRWR\\nRWRWRW\\nWRWRWR\\nRWRWRW\\nNO\\nYES\\nR\\nW\\nR\\nW\\nR\\n\", \"YES\\nRWRWR\\nWRWRW\\n\", \"YES\\nW\\nR\\n\", \"YES\\nRWRWR\\n\", \"YES\\nR\\n\", \"YES\\nRWRWR\\n\", \"YES\\nRWRWR\\nWRWRW\\n\", \"YES\\nRWRWR\\nWRWRW\\n\", \"YES\\nRWRWR\\n\", \"YES\\nR\\n\", \"YES\\nRWRWR\\n\", \"YES\\nRWRWR\\nWRWRW\\n\", \"YES\\nR\\n\", \"YES\\nRWRWR\\nWRWRW\\nRWRWR\\n\", \"YES\\nW\\nR\\n\", \"YES\\nRWRWR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WRWR\\nRWRWRW\\nWRWRWR\\nRWRWRW\\nNO\\nYES\\nR\\nW\\nR\\nW\\nR\\n\", \"YES\\nR\\n\", \"YES\\nR\\n\", \"YES\\nRWRWR\\nWRWRW\\n\", \"YES\\nRWRWR\\nWRWRW\\nRWRWR\\n\", \"YES\\nRWRWR\\n\", \"YES\\nRWRWR\\n\", \"YES\\nRWRWR\\nWRWRW\\n\", \"YES\\nRWRWR\\n\", \"YES\\nRWRWR\\nWRWRW\\n\", \"YES\\nRWRWR\\nWRWRW\\n\", \"YES\\nWRWRWR\\nRWRWRW\\nWRWRWR\\nRWRWRW\\nNO\\nYES\\nR\\nW\\n\", \"YES\\nRWRWR\\nWRWRW\\nRWRWR\\n\", \"YES\\nRWRWR\\n\", \"YES\\nRWRWR\\nWRWRW\\n\", \"YES\\nRWRWR\\nWRWRW\\n\", \"YES\\nRWRWR\\n\", \"YES\\nRWRWR\\n\", \"YES\\nRWRWR\\nWRWRW\\nRWRWR\\n\", \"YES\\nRWRWR\\n\", \"YES\\nRWRWR\\n\", \"YES\\nRWRWR\\n\", \"YES\\nR\\n\", \"YES\\nWRWRWR\\nRWRWRW\\nWRWRWR\\nRWRWRW\\nNO\\nYES\\nR\\nW\\nR\\nW\\nR\\n\", \"YES\\nRWRWR\\nWRWRW\\n\", \"YES\\nR\\n\", \"YES\\nRWRWR\\nWRWRW\\n\", \"YES\\nRWRWR\\n\", \"YES\\nRWRWR\\n\", \"YES\\nRWRWR\\n\", \"YES\\nRWRWR\\nWRWRW\\n\", \"YES\\nRWRWR\\nWRWRW\\n\", \"YES\\nRWRWR\\n\", \"YES\\nRWRWR\\nWRWRW\\nRWRWR\\n\", \"YES\\nRWRWR\\n\", \"YES\\nRWRWR\\n\", \"YES\\nRWRWR\\nWRWRW\\n\", \"YES\\nRWRWR\\n\", \"YES\\nRWRWR\\n\", \"YES\\nRWRWR\\nWRWRW\\n\", \"YES\\nRWRWR\\nWRWRW\\n\", \"YES\\nRWRWR\\n\", \"YES\\nRWRWR\\n\", \"YES\\nRWRWR\\n\", \"YES\\nRWRWR\\nWRWRW\\n\", \"YES\\nWRWRWR\\nRWRWRW\\nWRWRWR\\nRWRWRW\\nNO\\nYES\\nR\\nW\\nR\\nW\\nR\\n\", \"YES\\nWRWRWR\\nRWRWRW\\nWRWRWR\\nRWRWRW\\nNO\\nYES\\nR\\nW\\nR\\nW\\nR\\n\", \"YES\\nRWRWR\\nWRWRW\\n\", \"YES\\nRWRWR\\nWRWRW\\nRWRWR\\n\", \"YES\\nWRWRWR\\nRWRWRW\\nWRWRWR\\nRWRWRW\\nNO\\nYES\\nR\\nW\\nR\\nW\\nR\\n\", \"YES\\nR\\n\", \"YES\\nRWRWR\\nWRWRW\\n\", \"YES\\nRWRWR\\nWRWRW\\n\", \"YES\\nRWRWR\\nWRWRW\\nRWRWR\\n\", \"YES\\nRWRWR\\n\", \"YES\\nRWRWR\\n\", \"YES\\nRWRWR\\n\", \"YES\\nWRWRWR\\nRWRWRW\\nWRWRWR\\nRWRWRW\\nNO\\nYES\\nR\\nW\\nR\\nW\\nR\\n\", \"YES\\nRWRWR\\n\", \"YES\\nRWRWR\\nWRWRW\\n\", \"YES\\nRWRWR\\nWRWRW\\n\", \"YES\\nRWRWR\\n\", \"YES\\nRWRWR\\n\", \"YES\\nR\\n\", \"YES\\nRWRWR\\n\", \"NO\\nNO\\nYES\\nR\\nW\\nR\\nW\\nR\\n\", \"YES\\nRWRWR\\nWRWRW\\n\", \"YES\\nRWRWR\\nWRWRW\\n\", \"YES\\nRWRWR\\nWRWRW\\n\", \"YES\\nRWRWR\\n\", \"YES\\nRWRWR\\n\", \"YES\\nRWRWR\\n\", \"YES\\nRWRWR\\nWRWRW\\n\", \"YES\\nRWRWR\\n\", \"YES\\nRWRWR\\n\", \"YES\\nRWRWR\\n\", \"YES\\nRWRWR\\nWRWRW\\n\", \"YES\\nRWRWR\\nWRWRW\\nRWRWR\\n\", \"YES\\nRWRWR\\nWRWRW\\nRWRWR\\n\", \"YES\\nRWRWR\\nWRWRW\\nRWRWR\\n\", \"YES\\nR\\n\", \"YES\\nRWRWR\\nWRWRW\\n\", \"YES\\nRWRWR\\n\", \"YES\\nRWRWR\\n\", \"YES\\nRWRWR\\n\", \"YES\\nRWRWR\\nWRWRW\\n\", \"YES\\nRWRWR\\n\", \"YES\\nRWRWR\\nWRWRW\\n\", \"YES\\nRWRWR\\nWRWRW\\nRWRWR\\n\", \"YES\\nRWRWR\\n\", \"YES\\nRWRWR\\nWRWRW\\n\", \"YES\\nRWRWR\\n\", \"YES\\nRWRWR\\n\", \"YES\\nRWRWR\\n\", \"YES\\nRWRWR\\n\", \"YES\\nRWRWR\\n\", \"\\nYES\\nWRWRWR\\nRWRWRW\\nWRWRWR\\nRWRWRW\\nNO\\nYES\\nR\\nW\\nR\\nW\\nR\\n\"]}", "source": "primeintellect"}
Today we will be playing a red and white colouring game (no, this is not the Russian Civil War; these are just the colours of the Canadian flag). You are given an $n \times m$ grid of "R", "W", and "." characters. "R" is red, "W" is white and "." is blank. The neighbours of a cell are those that share an edge with it (those that only share a corner do not count). Your job is to colour the blank cells red or white so that every red cell only has white neighbours (and no red ones) and every white cell only has red neighbours (and no white ones). You are not allowed to recolour already coloured cells. -----Input----- The first line contains $t$ ($1 \le t \le 100$), the number of test cases. In each test case, the first line will contain $n$ ($1 \le n \le 50$) and $m$ ($1 \le m \le 50$), the height and width of the grid respectively. The next $n$ lines will contain the grid. Each character of the grid is either 'R', 'W', or '.'. -----Output----- For each test case, output "YES" if there is a valid grid or "NO" if there is not. If there is, output the grid on the next $n$ lines. If there are multiple answers, print any. In the output, the "YES"s and "NO"s are case-insensitive, meaning that outputs such as "yEs" and "nO" are valid. However, the grid is case-sensitive. -----Examples----- Input 3 4 6 .R.... ...... ...... .W.... 4 4 .R.W .... .... .... 5 1 R W R W R Output YES WRWRWR RWRWRW WRWRWR RWRWRW NO YES R W R W R -----Note----- The answer for the first example case is given in the example output, and it can be proven that no grid exists that satisfies the requirements of the second example case. In the third example all cells are initially coloured, and the colouring is valid. Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0.375
{"tests": "{\"inputs\": [\"3\\n2 0 0\\n1 1\\n10 1 0 0 1 0\", \"2\\n1 1\\n3 0\", \"2\\n1 1\\n2 0\", \"3\\n2 0 0\\n1 1\\n10 1 0 0 2 0\", \"2\\n1 0\\n2 0\", \"3\\n3 0 0\\n1 1\\n10 1 0 0 2 0\", \"2\\n1 1\\n2 -1\", \"3\\n3 0 0\\n1 1\\n10 2 0 0 2 0\", \"2\\n1 1\\n2 -2\", \"3\\n3 0 0\\n0 1\\n10 2 0 0 2 0\", \"2\\n1 1\\n0 -2\", \"2\\n1 1\\n0 -1\", \"2\\n1 1\\n0 0\", \"3\\n2 0 0\\n1 1\\n5 1 0 0 1 -1\", \"2\\n2 1\\n2 0\", \"3\\n2 0 0\\n1 1\\n10 1 0 0 0 0\", \"3\\n2 0 0\\n1 2\\n10 1 0 0 2 0\", \"2\\n1 0\\n1 0\", \"2\\n1 1\\n3 -1\", \"3\\n3 0 0\\n1 1\\n10 4 0 0 2 0\", \"2\\n1 1\\n2 -3\", \"3\\n3 0 0\\n0 1\\n1 2 0 0 2 0\", \"2\\n1 1\\n0 -4\", \"2\\n0 1\\n0 -1\", \"2\\n2 1\\n0 0\", \"2\\n1 1\\n2 1\", \"3\\n2 0 0\\n1 1\\n10 1 1 0 0 0\", \"2\\n0 1\\n0 0\", \"3\\n2 0 0\\n1 2\\n10 1 0 0 2 1\", \"2\\n1 1\\n1 -1\", \"3\\n3 0 0\\n1 1\\n10 4 1 0 2 0\", \"2\\n1 0\\n2 -3\", \"3\\n3 -1 0\\n0 1\\n1 2 0 0 2 0\", \"2\\n0 1\\n-1 -1\", \"2\\n1 1\\n2 2\", \"3\\n2 0 0\\n1 1\\n10 0 1 0 0 0\", \"2\\n0 1\\n0 1\", \"3\\n1 0 0\\n1 1\\n10 4 1 0 2 0\", \"2\\n1 -1\\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1\\n1 1\\n10 4 1 0 2 0\", \"2\\n1 0\\n2 -4\", \"3\\n3 -1 0\\n0 1\\n1 1 0 0 2 0\", \"2\\n0 1\\n-1 0\", \"3\\n1 1 0\\n1 1\\n10 4 1 0 2 0\", \"3\\n3 -1 0\\n0 1\\n1 3 0 1 2 0\", \"2\\n1 1\\n4 1\", \"2\\n0 2\\n-1 1\", \"3\\n1 0 0\\n1 1\\n10 3 0 0 2 0\", \"3\\n3 -1 0\\n0 1\\n1 2 0 2 2 0\", \"2\\n1 0\\n4 1\", \"2\\n0 1\\n1 1\", \"3\\n1 0 0\\n1 1\\n8 3 1 0 2 -1\", \"3\\n3 -1 0\\n0 1\\n1 1 -1 1 2 0\", \"2\\n1 0\\n5 0\", \"2\\n0 0\\n1 2\", \"3\\n3 -1 0\\n0 1\\n1 2 0 1 3 1\", \"3\\n3 -1 0\\n0 1\\n1 2 -1 0 3 1\", \"3\\n2 0 0\\n1 2\\n5 1 0 0 2 0\", \"3\\n2 0 0\\n1 1\\n5 1 0 0 1 0\", \"2\\n1 1\\n1 0\"], \"outputs\": [\"yes\\n\", \"no\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\\n\", \"yes\", \"no\"]}", "source": "primeintellect"}
Problem There are $ N $ Amidakuji with 3 vertical lines. No matter which line you start from, the Amidakuji that ends at the starting line is considered a good Amidakuji. You can select one or more Amidakuji and connect them vertically in any order. Output "yes" if you can make a good Amidakuji, otherwise output "no". There are $ w_i $ horizontal lines in the $ i $ th Amidakuji. $ a_ {i, j} $ indicates whether the $ j $ th horizontal bar from the top of Amidakuji $ i $ extends from the central vertical line to the left or right. If $ a_ {i, j} $ is 0, it means that it extends to the left, and if it is 1, it means that it extends to the right. Constraints The input satisfies the following conditions. * $ 1 \ le N \ le 50 $ * $ 0 \ le w_i \ le 100 $ * $ a_ {i, j} $ is 0 or 1 Input The input is given in the following format. $ N $ $ w_1 $ $ a_ {1,1} $ $ a_ {1,2} $ ... $ a_ {1, w_1} $ $ w_2 $ $ a_ {2,1} $ $ a_ {2,2} $ ... $ a_ {2, w_2} $ ... $ w_N $ $ a_ {N, 1} $ $ a_ {N, 2} $ ... $ a_ {N, w_N} $ All inputs are given as integers. $ N $ is given on the first line. $ W_i $ and $ w_i $ $ a_ {i, j} $ are given on the following $ N $ line, separated by blanks. Output If you can make a good Amidakuji, it outputs "yes", otherwise it outputs "no". Examples Input 3 2 0 0 1 1 5 1 0 0 1 0 Output yes Input 2 1 1 1 0 Output no Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0.125
{"tests": "{\"inputs\": [\"8 9 10 1 0\\n1 2 1\\n2 4 1\\n1 3 0\\n3 4 0\\n4 5 0\\n5 6 1\\n6 0 1\\n5 7 0\\n7 0 0\\n\", \"7 9 320 0 3\\n0 1 0\\n1 2 0\\n2 3 0\\n0 4 1\\n4 1 1\\n1 5 100\\n5 2 100\\n2 6 59\\n6 3 61\\n\", \"1000 1 5 999 0\\n0 999 0\\n\", \"4 5 7 0 3\\n0 1 0\\n1 2 3\\n2 3 0\\n0 2 5\\n1 3 5\\n\", \"5 5 3 0 2\\n0 1 1\\n1 2 1\\n0 4 0\\n4 3 0\\n3 2 0\\n\", \"4 4 14 1 3\\n1 3 13\\n2 3 0\\n2 0 0\\n1 0 12\\n\", \"5 6 1000000000 0 4\\n0 1 1\\n2 0 2\\n3 0 3\\n4 1 0\\n4 2 0\\n3 4 0\\n\", \"4 5 10 1 2\\n0 1 3\\n1 2 0\\n1 3 4\\n2 3 4\\n2 0 6\\n\", \"4 4 13 1 3\\n1 3 13\\n2 3 0\\n2 0 0\\n1 0 12\\n\", \"7 9 999999999 0 3\\n0 1 0\\n1 2 0\\n2 3 0\\n0 4 1\\n4 1 1\\n1 5 499999999\\n5 2 499999999\\n2 6 1\\n6 3 1\\n\", \"4 4 2 1 3\\n1 3 13\\n2 3 0\\n2 0 0\\n1 0 0\\n\", \"4 4 8 1 3\\n1 3 13\\n2 3 0\\n2 0 0\\n1 0 6\\n\", \"5 5 2 0 2\\n0 1 1\\n1 2 1\\n0 4 0\\n4 3 0\\n3 2 0\\n\", \"5 5 1 0 2\\n0 1 1\\n1 2 1\\n0 4 0\\n4 3 0\\n3 2 0\\n\", \"100 1 123456 99 0\\n0 99 123456\\n\", \"7 9 319 0 3\\n0 1 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5 2 499999999\\n2 6 1\\n3 3 1\\n\", \"4 4 8 1 3\\n1 3 19\\n2 3 0\\n2 0 0\\n1 0 6\\n\", \"5 5 13 0 4\\n0 1 5\\n2 1 2\\n3 2 3\\n2 4 0\\n4 3 4\\n\", \"7 9 320 0 3\\n0 1 0\\n1 2 0\\n2 3 0\\n0 4 1\\n4 1 1\\n2 5 100\\n5 1 100\\n2 6 59\\n6 3 61\\n\", \"5 5 5 0 2\\n0 1 1\\n1 2 1\\n0 4 0\\n4 3 0\\n3 2 0\\n\", \"5 6 1000000000 0 4\\n0 1 1\\n2 0 2\\n3 0 3\\n4 1 0\\n4 2 0\\n3 4 1\\n\", \"4 4 8 1 3\\n1 3 13\\n2 3 0\\n2 0 0\\n1 1 6\\n\", \"5 5 1 0 2\\n0 1 1\\n1 2 1\\n0 4 0\\n4 3 0\\n3 1 0\\n\", \"1001 1 1000000000 998 0\\n0 999 0\\n\", \"3 1 999999999 1 0\\n0 1 1000000000\\n\", \"1000 1 5 999 2\\n0 999 0\\n\", \"5 5 5 0 2\\n0 1 1\\n1 2 1\\n1 4 0\\n4 3 0\\n3 2 0\\n\", \"5 6 1000000000 0 4\\n0 1 1\\n2 0 3\\n3 0 3\\n4 1 0\\n4 2 0\\n3 4 1\\n\", \"4 4 4 1 3\\n1 3 13\\n2 3 0\\n2 0 0\\n1 1 6\\n\", \"1001 1 1001000000 998 0\\n0 999 0\\n\", \"5 6 1000000000 0 4\\n0 1 1\\n2 0 3\\n3 0 3\\n4 1 1\\n4 2 0\\n3 4 1\\n\", \"4 4 4 1 3\\n1 3 13\\n2 3 0\\n2 0 0\\n1 2 6\\n\", \"5 5 2 1 2\\n0 1 1\\n1 2 1\\n0 4 0\\n4 3 0\\n3 1 0\\n\", \"1001 1 1011000000 998 0\\n0 999 0\\n\", \"5 5 2 1 2\\n0 1 0\\n1 2 1\\n0 4 0\\n4 3 0\\n3 1 0\\n\", \"1000 1 1011000000 998 0\\n0 999 0\\n\", \"4 4 7 1 3\\n1 3 13\\n2 0 0\\n2 0 0\\n1 2 6\\n\", \"1000 1 1011001000 998 0\\n0 999 0\\n\", \"4 4 7 1 3\\n1 3 13\\n2 1 0\\n2 0 0\\n1 2 6\\n\", \"5 5 2 1 2\\n0 1 0\\n0 2 2\\n0 4 0\\n4 3 0\\n3 1 0\\n\", \"5 5 3 0 2\\n0 2 1\\n1 2 1\\n0 4 0\\n4 3 0\\n3 2 0\\n\", \"1000 1 1000000010 998 0\\n0 999 0\\n\", \"2 1 999999999 1 0\\n0 0 1000000000\\n\", \"1100 1 5 999 1\\n0 999 0\\n\", \"5 5 13 0 4\\n0 1 5\\n2 1 2\\n3 2 3\\n1 4 0\\n4 3 4\\n\", \"2 1 999999999 1 0\\n0 1 1000000000\\n\", \"2 1 123456789 0 1\\n0 1 0\\n\"], \"outputs\": [\"YES\\n1 2 1\\n2 4 1\\n1 3 1\\n3 4 1\\n4 5 6\\n5 6 1\\n6 0 1\\n5 7 1\\n7 0 1\\n\", \"YES\\n0 1 1\\n1 2 199\\n2 3 318\\n0 4 1\\n4 1 1\\n1 5 100\\n5 2 100\\n2 6 59\\n6 3 61\\n\", \"YES\\n0 999 5\\n\", \"YES\\n0 1 3\\n1 2 3\\n2 3 2\\n0 2 5\\n1 3 5\\n\", \"NO\", \"NO\", \"YES\\n0 1 1\\n2 0 2\\n3 0 3\\n4 1 999999999\\n4 2 999999998\\n3 4 999999997\\n\", \"NO\", \"YES\\n1 3 13\\n2 3 1\\n2 0 1\\n1 0 12\\n\", \"YES\\n0 1 1\\n1 2 999999996\\n2 3 999999997\\n0 4 1\\n4 1 1\\n1 5 499999999\\n5 2 499999999\\n2 6 1\\n6 3 1\\n\", \"NO\", \"YES\\n1 3 13\\n2 3 1\\n2 0 1\\n1 0 6\\n\", \"YES\\n0 1 1\\n1 2 1\\n0 4 1\\n4 3 1\\n3 2 1\\n\", \"NO\", \"YES\\n0 99 123456\\n\", \"YES\\n0 1 1\\n1 2 198\\n2 3 317\\n0 4 1\\n4 1 1\\n1 5 100\\n5 2 100\\n2 6 59\\n6 3 61\\n\", \"NO\", \"YES\\n0 1 318\\n1 2 317\\n2 3 1\\n0 4 1\\n4 1 1\\n2 5 100\\n5 2 100\\n2 6 59\\n6 3 61\\n\", \"NO\\n\", \"YES\\n0 1 3\\n1 2 3\\n2 3 1\\n0 2 6\\n1 3 5\\n\", \"YES\\n1 3 13\\n2 3 1\\n2 0 1\\n1 0 12\\n\", \"YES\\n0 1 1\\n1 2 1\\n0 4 1\\n4 2 1\\n3 2 1\\n\", \"YES\\n0 1 317\\n1 2 316\\n2 3 117\\n0 4 1\\n4 1 1\\n1 5 100\\n5 2 100\\n2 6 78\\n6 3 61\\n\", \"YES\\n0 1 5\\n2 1 2\\n3 2 6\\n1 4 8\\n4 3 4\\n\", \"YES\\n0 1 1\\n1 2 1\\n0 4 1\\n4 3 1\\n3 1 1\\n\", \"YES\\n0 1 12\\n2 1 2\\n3 2 6\\n1 4 1\\n4 3 4\\n\", \"YES\\n0 1 12\\n2 1 2\\n3 2 6\\n1 4 1\\n0 3 4\\n\", \"YES\\n1 3 13\\n2 3 1\\n2 0 1\\n1 2 6\\n\", \"YES\\n0 1 1\\n1 2 2\\n0 4 1\\n4 3 1\\n3 1 1\\n\", \"YES\\n0 0 1\\n2 0 2\\n3 0 3\\n4 1 1\\n4 2 999999998\\n3 4 999999997\\n\", \"YES\\n0 1 3\\n1 2 1\\n1 3 4\\n2 3 4\\n2 0 6\\n\", \"YES\\n1 3 13\\n2 3 1\\n0 0 1\\n1 0 12\\n\", \"YES\\n0 1 999999997\\n1 2 999999996\\n2 3 1\\n0 4 1\\n4 1 1\\n1 5 499999999\\n5 2 499999999\\n2 6 1\\n3 3 1\\n\", \"YES\\n1 3 19\\n2 3 1\\n2 0 1\\n1 0 6\\n\", \"YES\\n0 1 5\\n2 1 2\\n3 2 3\\n2 4 6\\n4 3 4\\n\", \"YES\\n0 1 318\\n1 2 317\\n2 3 118\\n0 4 1\\n4 1 1\\n2 5 100\\n5 1 100\\n2 6 59\\n6 3 61\\n\", \"NO\\n\", \"NO\\n\", \"NO\\n\", \"NO\\n\", \"NO\\n\", \"NO\\n\", \"NO\\n\", \"NO\\n\", \"NO\\n\", \"NO\\n\", \"NO\\n\", \"NO\\n\", \"NO\\n\", \"NO\\n\", \"NO\\n\", \"NO\\n\", \"NO\\n\", \"NO\\n\", \"NO\\n\", \"NO\\n\", \"NO\\n\", \"NO\\n\", \"NO\\n\", \"NO\\n\", \"NO\\n\", \"YES\\n0 1 5\\n2 1 2\\n3 2 3\\n1 4 8\\n4 3 4\\n\", \"NO\", \"YES\\n0 1 123456789\\n\"]}", "source": "primeintellect"}
ZS the Coder has drawn an undirected graph of n vertices numbered from 0 to n - 1 and m edges between them. Each edge of the graph is weighted, each weight is a positive integer. The next day, ZS the Coder realized that some of the weights were erased! So he wants to reassign positive integer weight to each of the edges which weights were erased, so that the length of the shortest path between vertices s and t in the resulting graph is exactly L. Can you help him? Input The first line contains five integers n, m, L, s, t (2 ≤ n ≤ 1000, 1 ≤ m ≤ 10 000, 1 ≤ L ≤ 109, 0 ≤ s, t ≤ n - 1, s ≠ t) — the number of vertices, number of edges, the desired length of shortest path, starting vertex and ending vertex respectively. Then, m lines describing the edges of the graph follow. i-th of them contains three integers, ui, vi, wi (0 ≤ ui, vi ≤ n - 1, ui ≠ vi, 0 ≤ wi ≤ 109). ui and vi denote the endpoints of the edge and wi denotes its weight. If wi is equal to 0 then the weight of the corresponding edge was erased. It is guaranteed that there is at most one edge between any pair of vertices. Output Print "NO" (without quotes) in the only line if it's not possible to assign the weights in a required way. Otherwise, print "YES" in the first line. Next m lines should contain the edges of the resulting graph, with weights assigned to edges which weights were erased. i-th of them should contain three integers ui, vi and wi, denoting an edge between vertices ui and vi of weight wi. The edges of the new graph must coincide with the ones in the graph from the input. The weights that were not erased must remain unchanged whereas the new weights can be any positive integer not exceeding 1018. The order of the edges in the output doesn't matter. The length of the shortest path between s and t must be equal to L. If there are multiple solutions, print any of them. Examples Input 5 5 13 0 4 0 1 5 2 1 2 3 2 3 1 4 0 4 3 4 Output YES 0 1 5 2 1 2 3 2 3 1 4 8 4 3 4 Input 2 1 123456789 0 1 0 1 0 Output YES 0 1 123456789 Input 2 1 999999999 1 0 0 1 1000000000 Output NO Note Here's how the graph in the first sample case looks like : <image> In the first sample case, there is only one missing edge weight. Placing the weight of 8 gives a shortest path from 0 to 4 of length 13. In the second sample case, there is only a single edge. Clearly, the only way is to replace the missing weight with 123456789. In the last sample case, there is no weights to assign but the length of the shortest path doesn't match the required value, so the answer is "NO". Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0
{"tests": "{\"inputs\": [\"24 32 6 2 7 4\\n\", \"45 62 28 48 28 50\\n\", \"100 32 71 12 71 22\\n\", \"57 85 29 40 29 69\\n\", \"95 28 50 12 50 13\\n\", \"5 4 1 1 5 4\\n\", \"100 100 1 1 100 100\\n\", \"51 76 50 5 45 76\\n\", \"37 100 33 13 32 30\\n\", \"47 91 36 61 32 63\\n\", \"28 7 17 5 11 6\\n\", \"1 2 1 1 1 2\\n\", \"89 51 76 1 25 51\\n\", \"60 100 28 80 26 85\\n\", \"5 5 1 1 5 5\\n\", \"10 10 3 4 3 5\\n\", \"5 5 1 1 5 3\\n\", \"61 39 14 30 14 37\\n\", \"21 18 16 6 15 17\\n\", \"97 94 96 2 7 93\\n\", \"50 50 1 1 4 5\\n\", \"10 10 7 7 3 4\\n\", \"41 64 10 21 29 50\\n\", \"8 33 2 21 8 23\\n\", \"77 99 56 1 3 99\\n\", \"3 5 1 1 3 5\\n\", \"30 47 9 32 3 35\\n\", \"47 95 27 70 23 70\\n\", \"39 46 21 22 30 35\\n\", \"48 53 24 37 21 42\\n\", \"73 95 58 11 11 24\\n\", \"18 18 11 12 13 16\\n\", \"10 10 1 1 5 4\\n\", \"41 34 27 7 20 8\\n\", \"10 5 10 1 4 5\\n\", \"73 27 40 8 45 13\\n\", \"24 97 21 54 19 55\\n\", \"15 11 12 5 8 9\\n\", \"5 4 1 4 5 1\\n\", \"5 5 1 1 4 5\\n\", \"64 91 52 64 49 67\\n\", \"76 7 24 4 26 6\\n\", \"18 72 2 71 3 71\\n\", \"31 80 28 70 24 75\\n\", \"10 10 1 1 3 5\\n\", \"33 13 12 1 12 6\\n\", \"21 68 2 13 6 57\\n\", \"11 97 2 29 1 76\\n\", \"30 85 9 45 8 49\\n\", \"4 4 1 4 4 1\\n\", \"10 10 1 1 5 3\\n\", \"5 5 1 1 5 4\\n\", \"100 94 1 30 100 30\\n\", \"89 100 54 1 55 100\\n\", \"7 41 3 5 3 6\\n\", \"100 100 1 1 3 5\\n\", \"44 99 10 5 8 92\\n\", \"84 43 71 6 77 26\\n\", \"6 2 6 1 1 2\\n\", \"48 11 33 8 24 8\\n\", \"28 14 21 2 20 5\\n\", \"96 54 9 30 9 47\\n\", \"50 50 1 1 5 2\\n\", \"71 85 10 14 13 20\\n\", \"25 32 17 18 20 19\\n\", \"50 50 1 1 5 4\\n\", \"28 17 20 10 27 2\\n\", \"73 88 30 58 30 62\\n\", \"24 65 23 18 3 64\\n\", \"100 100 1 1 5 1\\n\", \"6 6 1 1 6 1\\n\", \"13 62 10 13 5 15\\n\", \"24 68 19 14 18 15\\n\", \"49 34 38 19 38 25\\n\", \"57 17 12 7 12 10\\n\", \"80 97 70 13 68 13\\n\", \"13 25 4 2 7 3\\n\", \"34 55 7 25 8 30\\n\", \"30 1 10 1 20 1\\n\", \"73 64 63 32 68 32\\n\", \"73 79 17 42 10 67\\n\", \"40 100 4 1 30 100\\n\", \"48 86 31 36 23 36\\n\", \"4 5 1 1 4 5\\n\", \"51 8 24 3 19 7\\n\", \"10 10 1 1 6 2\\n\", \"64 96 4 2 4 80\\n\", \"10 10 6 1 1 1\\n\", \"10 10 1 1 4 5\\n\", \"35 19 4 8 9 11\\n\", \"25 68 3 39 20 41\\n\", \"23 90 6 31 9 88\\n\", \"52 70 26 65 23 65\\n\", \"20 77 5 49 3 52\\n\", \"6 6 1 1 1 6\\n\", \"63 22 54 16 58 19\\n\", \"87 15 56 8 59 12\\n\", \"16 97 7 4 15 94\\n\", \"10 10 1 1 1 6\\n\", \"89 81 33 18 28 19\\n\", \"100 100 1 1 2 6\\n\", \"100 100 1 1 5 4\\n\", \"36 76 36 49 33 51\\n\", \"74 88 33 20 39 20\\n\", \"99 100 24 1 24 100\\n\", \"14 96 3 80 1 86\\n\", \"34 39 18 1 17 7\\n\", \"5 5 1 1 3 5\\n\", \"96 75 15 10 6 65\\n\", \"63 54 19 22 23 23\\n\", \"5 5 1 5 4 1\\n\", \"100 100 10 10 13 14\\n\", \"40 43 40 9 38 28\\n\", \"100 100 1 1 4 5\\n\", \"15 48 6 42 10 48\\n\", \"87 13 77 7 70 7\\n\", \"20 32 6 2 7 4\\n\", \"45 62 28 48 28 88\\n\", \"100 32 71 2 71 22\\n\", \"111 85 29 40 29 69\\n\", \"95 28 50 12 39 13\\n\", \"5 7 1 1 5 4\\n\", \"000 100 1 1 100 100\\n\", \"51 76 72 5 45 76\\n\", \"37 100 33 13 34 30\\n\", \"47 91 12 61 32 63\\n\", \"28 7 20 5 11 6\\n\", \"1 2 1 2 1 2\\n\", \"89 51 76 1 25 27\\n\", \"60 101 28 80 26 85\\n\", \"5 2 1 1 5 5\\n\", \"10 10 3 2 3 5\\n\", \"35 39 14 30 14 37\\n\", \"21 18 29 6 15 17\\n\", \"97 94 96 2 7 79\\n\", \"80 50 1 1 4 5\\n\", \"10 10 7 7 3 8\\n\", \"41 64 0 21 29 50\\n\", \"8 33 2 21 14 23\\n\", \"77 99 61 1 3 99\\n\", \"17 47 9 32 3 35\\n\", \"47 95 32 70 23 70\\n\", \"39 46 21 36 30 35\\n\", \"48 18 24 37 21 42\\n\", \"73 95 58 11 18 24\\n\", \"18 36 11 12 13 16\\n\", \"10 10 1 2 5 4\\n\", \"41 61 27 7 20 8\\n\", \"10 5 16 1 4 5\\n\", \"73 27 40 8 45 2\\n\", \"24 97 21 54 19 43\\n\", \"15 11 12 5 8 2\\n\", \"5 4 0 4 5 1\\n\", \"5 5 1 0 4 5\\n\", \"64 91 52 27 49 67\\n\", \"76 7 24 4 26 5\\n\", \"18 72 4 71 3 71\\n\", \"31 80 20 70 24 75\\n\", \"10 10 1 1 3 6\\n\", \"33 23 12 1 12 6\\n\", \"0 68 2 13 6 57\\n\", \"11 97 2 29 0 76\\n\", \"30 85 15 45 8 49\\n\", \"10 12 1 1 5 3\\n\", \"5 5 1 1 5 6\\n\", \"100 94 1 30 101 30\\n\", \"89 100 93 1 55 100\\n\", \"7 41 3 2 3 6\\n\", \"100 100 1 1 3 8\\n\", \"44 99 16 5 8 92\\n\", \"84 43 128 6 77 26\\n\", \"6 2 6 2 1 2\\n\", \"48 11 33 8 39 8\\n\", \"22 14 21 2 20 5\\n\", \"96 54 9 30 2 47\\n\", \"50 89 1 1 5 2\\n\", \"71 85 11 14 13 20\\n\", \"25 32 17 18 16 19\\n\", \"0 50 1 1 5 4\\n\", \"28 17 20 10 48 2\\n\", \"24 65 23 34 3 64\\n\", \"100 110 1 1 5 1\\n\", \"6 6 1 0 6 1\\n\", \"13 62 18 13 5 15\\n\", \"49 34 38 19 38 1\\n\", \"57 17 12 7 12 11\\n\", \"80 97 70 2 68 13\\n\", \"34 55 7 25 8 19\\n\", \"30 1 5 1 20 1\\n\", \"6 5 4 3 2 1\\n\", \"10 10 1 1 10 10\\n\", \"1 6 1 2 1 6\\n\"], \"outputs\": [\"First\\n\", \"First\\n\", \"Second\\n\", \"Second\\n\", \"First\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"First\\n\", \"Second\\n\", \"First\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"First\\n\", \"First\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"First\\n\", \"Second\\n\", \"First\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"First\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"First\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"First\\n\", \"First\\n\", \"First\\n\", \"Second\\n\", \"First\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"First\\n\", \"First\\n\", \"First\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"First\\n\", \"First\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"First\\n\", \"Second\\n\", \"First\\n\", \"Second\\n\", \"First\\n\", \"Second\\n\", \"Second\\n\", \"First\\n\", \"Second\\n\", \"First\\n\", \"Second\\n\", \"Second\\n\", \"First\\n\", \"Second\\n\", \"First\\n\", \"First\\n\", \"First\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"First\\n\", \"First\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"First\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"First\\n\", \"Second\\n\", \"First\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"First\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"First\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"First\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"First\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"First\\n\", \"First\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"First\\n\", \"First\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"First\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"First\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"First\\n\", \"Second\\n\", \"First\\n\", \"Second\\n\", \"First\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"First\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"First\\n\", \"Second\\n\", \"Second\\n\", \"Second\\n\", \"First\\n\", \"Second\\n\", \"First\\n\"]}", "source": "primeintellect"}
Two players play a game. The game is played on a rectangular board with n × m squares. At the beginning of the game two different squares of the board have two chips. The first player's goal is to shift the chips to the same square. The second player aims to stop the first one with a tube of superglue. We'll describe the rules of the game in more detail. The players move in turns. The first player begins. With every move the first player chooses one of his unglued chips, and shifts it one square to the left, to the right, up or down. It is not allowed to move a chip beyond the board edge. At the beginning of a turn some squares of the board may be covered with a glue. The first player can move the chip to such square, in this case the chip gets tightly glued and cannot move any longer. At each move the second player selects one of the free squares (which do not contain a chip or a glue) and covers it with superglue. The glue dries long and squares covered with it remain sticky up to the end of the game. If, after some move of the first player both chips are in the same square, then the first player wins. If the first player cannot make a move (both of his chips are glued), then the second player wins. Note that the situation where the second player cannot make a move is impossible — he can always spread the glue on the square from which the first player has just moved the chip. We will further clarify the case where both chips are glued and are in the same square. In this case the first player wins as the game ends as soon as both chips are in the same square, and the condition of the loss (the inability to move) does not arise. You know the board sizes and the positions of the two chips on it. At the beginning of the game all board squares are glue-free. Find out who wins if the players play optimally. Input The first line contains six integers n, m, x1, y1, x2, y2 — the board sizes and the coordinates of the first and second chips, correspondingly (1 ≤ n, m ≤ 100; 2 ≤ n × m; 1 ≤ x1, x2 ≤ n; 1 ≤ y1, y2 ≤ m). The numbers in the line are separated by single spaces. It is guaranteed that the chips are located in different squares. Output If the first player wins, print "First" without the quotes. Otherwise, print "Second" without the quotes. Examples Input 1 6 1 2 1 6 Output First Input 6 5 4 3 2 1 Output First Input 10 10 1 1 10 10 Output Second Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
0