FPEvalDataset/LeetCodeProblem
0304
1{2 "id": 2810,3 "name": "collecting_chocolates",4 "difficulty": "Medium",5 "link": "https://leetcode.com/problems/collecting-chocolates/",6 "date": "2023-06-04 00:00:00",7 "task_description": "You are given a **0-indexed** integer array `nums` of size `n` representing the cost of collecting different chocolates. The cost of collecting the chocolate at the index `i` is `nums[i]`. Each chocolate is of a different type, and initially, the chocolate at the index `i` is of `ith` type. In one operation, you can do the following with an incurred **cost** of `x`: Simultaneously change the chocolate of `ith` type to `((i + 1) mod n)th` type for all chocolates. Return _the minimum cost to collect chocolates of all types, given that you can perform as many operations as you would like._ **Example 1:** ``` **Input:** nums = [20,1,15], x = 5 **Output:** 13 **Explanation:** Initially, the chocolate types are [0,1,2]. We will buy the 1st type of chocolate at a cost of 1. Now, we will perform the operation at a cost of 5, and the types of chocolates will become [1,2,0]. We will buy the 2nd type of chocolate at a cost of 1. Now, we will again perform the operation at a cost of 5, and the chocolate types will become [2,0,1]. We will buy the 0th type of chocolate at a cost of 1. Thus, the total cost will become (1 + 5 + 1 + 5 + 1) = 13. We can prove that this is optimal. ``` **Example 2:** ``` **Input:** nums = [1,2,3], x = 4 **Output:** 6 **Explanation:** We will collect all three types of chocolates at their own price without performing any operations. Therefore, the total cost is 1 + 2 + 3 = 6. ``` **Constraints:** `1 <= nums.length <= 1000` `1 <= nums[i] <= 109` `1 <= x <= 109`",8 "public_test_cases": [9 {10 "label": "Example 1",11 "input": "nums = [20,1,15], x = 5",12 "output": "13 "13 },14 {15 "label": "Example 2",16 "input": "nums = [1,2,3], x = 4",17 "output": "6 "18 }19 ],20 "private_test_cases": [21 {22 "input": [23 [24 195199014,25 984800196,26 607924423,27 36348739,28 813130315,29 153065099,30 588296506,31 617132062,32 781027683,33 116629882,34 581208811,35 569440617,36 870838107,37 939227748,38 574241627,39 488909059,40 479214749,41 920077184,42 809104907,43 97812621,44 739489242,45 733086437,46 654080955,47 987436545,48 140526391,49 372643245,50 149983222,51 229866605,52 912832555,53 986734995,54 161610887,55 660721797,56 431179104,57 37923818,58 337467714,59 344568419,60 408880028,61 298866142,62 586368843,63 655456322,64 182642371,65 81945619,66 607613577,67 887811013,68 626376923,69 715066277,70 27312739,71 242413291,72 491056317,73 626066721,74 329827884,75 51373087,76 377603455,77 285888257,78 289189990,79 437036712,80 51492615,81 773483380,82 273050223,83 239823783,84 178687773,85 86195843,86 311103091,87 513170145,88 818474194,89 861218557,90 673632638,91 973212016,92 990596428,93 584797315,94 390187131,95 16063215,96 671830121,97 403723544,98 368926620,99 291577238,100 836588088,101 603827758,102 2606594,103 259323471,104 249091497,105 372920588,106 781724843,107 390173853,108 817933194,109 302969239,110 164540460,111 652257475,112 452847149,113 751974372,114 417340325,115 609385790,116 325428582,117 5518899,118 689255278,119 306884488,120 240441423,121 990221737,122 127779717,123 469798221,124 809710543,125 76651043,126 114721605,127 811337085,128 838269422,129 210573940,130 550804251,131 151059732,132 963856152,133 454169768,134 649700828,135 863499421,136 666400114,137 739255458,138 148479307,139 810214197,140 701169766,141 224247585,142 528904494,143 677094434,144 656368211,145 964745763,146 285343955,147 354199258,148 604592293,149 84075276,150 171162476,151 198006259,152 792771994,153 921766273,154 513057436,155 442342857,156 393647274,157 928913521,158 129759381,159 926801252,160 382921119,161 590703484,162 947689972,163 645597832,164 80489849,165 402504867,166 793560817,167 304668159,168 752099804,169 272063343,170 237287828,171 311417665,172 110016486,173 391816426,174 573541853,175 412955906,176 774375508,177 988828191,178 529616010,179 365784851,180 130714687,181 625023361,182 51870264,183 3921080,184 970552943,185 831690784,186 304632280,187 163415864,188 945698689,189 992319209,190 607764312,191 916603382,192 69904958,193 529364651,194 877540295,195 742675142,196 217211577,197 929501124,198 359606819,199 792089571,200 628840547,201 470317204,202 245666470,203 538467321,204 542525942,205 301217535,206 254924657,207 494655010,208 462250827,209 480408495,210 21908896,211 994013811,212 32823489,213 900377181,214 767397312,215 536885644,216 109915622,217 739194012,218 394242870,219 281165002,220 684530302,221 642378737,222 252917803,223 289701811,224 920316781,225 561202250,226 485794592,227 985927864,228 452933034,229 396341427,230 464970466,231 650547832,232 435718719,233 407937592,234 825524338,235 342161946,236 794783327,237 78363130,238 758859001,239 339179672,240 276222116,241 331080978,242 355655498,243 529702137,244 246833303,245 444240535,246 390433754,247 383207254,248 685984136,249 776310837,250 971712059,251 291328757,252 498988370,253 944595442,254 210158741,255 474588291,256 728452333,257 327892670,258 633123722,259 280937805,260 961564731,261 896302261,262 364818399,263 791196212,264 678626404,265 702912193,266 966940719,267 697837937,268 229233322,269 615904816,270 142873499,271 239716403,272 88386028,273 814798561,274 518353881,275 498482718,276 458907246,277 296617630,278 685054486,279 159771808,280 423294860,281 494014169,282 150924742,283 12436220,284 755400713,285 258190124,286 65531288,287 454041355,288 221518994,289 860222475,290 932970280,291 531681169,292 602109256,293 585029274,294 24112250,295 832975854,296 702277613,297 886158293,298 993671856,299 745950250,300 9815904,301 428057692,302 951726244,303 182913765,304 886722589,305 752178138,306 941397089,307 754737490,308 328291852,309 179288814,310 959223573,311 523585699,312 542035645,313 184733133,314 198371804,315 304883176,316 998452141,317 124524129,318 885584699,319 481174985,320 616696757,321 593324918,322 454968615,323 52844661,324 970336457,325 59652415,326 503863689,327 763412487,328 318086037,329 431678900,330 772961494,331 379979411,332 748770602,333 564912364,334 176131533,335 33162653,336 811147845,337 911170860,338 147574219,339 147811026,340 152613327,341 313470576,342 67773459,343 635593023,344 923663369,345 940797858,346 353228924,347 894589838,348 113893957,349 270912429,350 810499926,351 343383832,352 999461432,353 428879623,354 882203250,355 137842711,356 963733831,357 228328390,358 388609130,359 444731715,360 876905523,361 820643216,362 292901933,363 300114876,364 646370184,365 139589078,366 173813411,367 641490002,368 511780675,369 138009273,370 168326041,371 455523429,372 577968590,373 822486887,374 206628466,375 406962072,376 776818543,377 243949136,378 773326982,379 943666446,380 751147131,381 535649421,382 445290504,383 493015215,384 441504843,385 460178556,386 176659001,387 966315793,388 622966118,389 99102348,390 959671731,391 489578182,392 700131590,393 692678432,394 843997706,395 84316992,396 295052242,397 553321387,398 675541223,399 343432650,400 389473733,401 370807758,402 385237489,403 945158723,404 227527971,405 875594740,406 125454021,407 423896252,408 15560748,409 6210546,410 794287516,411 458892965,412 645223642,413 996372617,414 537229661,415 954211580,416 293738043,417 696027865,418 46737506,419 80039731,420 692608133,421 145885645,422 560041641,423 318623001,424 562827220,425 742688194,426 100673661,427 178786795,428 289815352,429 652188537,430 735242308,431 734937272,432 891739424,433 664946181,434 987635466,435 788629312,436 402822043,437 955411387,438 929766648,439 410007672,440 377269822,441 561962151,442 937239079,443 13238555,444 966880602,445 905525735,446 233868138,447 123894478,448 827850053,449 613602240,450 649224028,451 208377928,452 317404952,453 872164249,454 238027473,455 603347539,456 15913528,457 511476986,458 60472308,459 825530316,460 575387964,461 10613894,462 817509174,463 745601985,464 316498340,465 393598793,466 909624006,467 14905850,468 215533967,469 411912051,470 984884312,471 749494941,472 678806049,473 509115086,474 312513897,475 436730186,476 622622583,477 410981845,478 6187747,479 240335095,480 871466569,481 298738342,482 753964255,483 842764464,484 763669249,485 726831257,486 262805735,487 456928993,488 921464338,489 398268879,490 902183475,491 491502741,492 872348170,493 244442294,494 715060792,495 925352396,496 588960406,497 463602725,498 881739070,499 317752390,500 709787883,501 704456597,502 239353639,503 42648361,504 330506671,505 881390592,506 270400733,507 431217820,508 923604163,509 199350714,510 730784157,511 618816379,512 390154481,513 510752733,514 419362979,515 7864821,516 670638993,517 931944085,518 877025976,519 356710805,520 580480749,521 523376265,522 32536697,523 534640272,524 658422828,525 602869101,526 257627936,527 19353320,528 307231189,529 767777638,530 116075954,531 910132199,532 890785831,533 112656238,534 535125877,535 899585967,536 212528780,537 52594748,538 476910963,539 702000280,540 914379828,541 232401095,542 815622453,543 170806089,544 142026010,545 974803062,546 446266689,547 647729617,548 141540830,549 209984756,550 917469850,551 366614793,552 505088170,553 336199776,554 458282243,555 776726118,556 65898399,557 588747470,558 336803515,559 227473240,560 807022596,561 76282996,562 556822238,563 890598517,564 320719589,565 833641979,566 274922280,567 850612850,568 805689839,569 350345518,570 268524345,571 537854273,572 133048817,573 941825930,574 531193388,575 234420006,576 652476571,577 376886332,578 471886483,579 966682042,580 169210281,581 794515277,582 84541212,583 702197814,584 294385154,585 932048350,586 357165852,587 106845267,588 838294046,589 268767026,590 768928242,591 317757906,592 642134607,593 866468112,594 408162350,595 316778091,596 315071199,597 946231322,598 462597803,599 803470909,600 113477738,601 981387113,602 350882681,603 622688065,604 877058174,605 707677845,606 678125185,607 987244185,608 416176335,609 435153468,610 898770636,611 739742120,612 368770071,613 718975205,614 132449699,615 112157585,616 614954407,617 277410771,618 845349804,619 41620036,620 459533573,621 440667505,622 351711058,623 51265070,624 692281115,625 414086736,626 582255027,627 278173598,628 837369224,629 134070537,630 411382375,631 783386478,632 59113229,633 20075845,634 11128092,635 578770990,636 239563044,637 539793169,638 405961871,639 465019583,640 881445046,641 379539062,642 604898363,643 846257377,644 120473440,645 286543229,646 554792750,647 360420609,648 994274929,649 647518644,650 639628224,651 958244598,652 134806133,653 982204738,654 969696721,655 438608528,656 684891723,657 401247476,658 263136938,659 690073753,660 429568456,661 758466696,662 834591579,663 765511214,664 245834044,665 5432691,666 949868089,667 189205914,668 182922234,669 267536500,670 556288860,671 275325798,672 228763038,673 43198009,674 626958467,675 589408140,676 157891879,677 191866252,678 566237343,679 489338090,680 316442951,681 378261638,682 250879999,683 678793094,684 863771713,685 91704092,686 254836077,687 169623528,688 3163204,689 173845140,690 346893958,691 776113836,692 973508092,693 645340992,694 590430401,695 951563534,696 473705954,697 729796359,698 97394867,699 103018547,700 254535655,701 60538203,702 584520812,703 986220593,704 444323091,705 965536113,706 869419091,707 5081692,708 327462154,709 643651844,710 579512728,711 908311364,712 223782800,713 784660433,714 354251199,715 223432445,716 557927372,717 132706843,718 207201606,719 244254156,720 597845799,721 764449087,722 586516681,723 815675472,724 517278658,725 500556000,726 970376215,727 989955500,728 72034657,729 206722688730 ],731 59772293732 ],733 "output": 10633276482734 },735 {736 "input": [737 [738 563669213,739 825855133,740 170715616,741 848248921,742 900296610,743 887903420,744 675871814,745 486596683,746 235735391,747 414856374,748 822396398,749 44266810,750 771867053,751 915395390,752 407577458,753 526132977,754 435493588,755 200118428,756 522821959,757 508699245,758 209107510,759 775835633,760 848773024,761 737330318,762 49170263,763 680427509,764 573882300,765 47975331,766 107865654,767 717536143,768 530193469,769 815833575,770 172088373,771 245232698,772 13843861,773 505703667,774 920495124,775 239600583,776 738826172,777 885854894,778 287143084,779 855637308,780 143274687,781 483262375,782 405384251,783 100977809,784 953509786,785 841235525,786 575644136,787 728039828,788 448530985,789 15997067,790 72457869,791 101030668,792 373958835,793 405681725,794 405119064,795 640524495,796 878589097,797 853263253,798 326180319,799 905875964,800 224218040,801 191497343,802 54231792,803 209037869,804 375754140,805 733021805,806 872850958,807 680061098,808 909589897,809 283417467,810 992550860,811 786664967,812 204480733,813 694702469,814 695974678,815 964700834,816 592869236,817 401811813,818 56938882,819 269231172,820 766091455,821 884761542,822 38371452,823 154205087,824 416251331,825 891071809,826 869898081,827 49865978,828 975945402,829 890700102,830 988503568,831 763930157,832 815989390,833 971377022,834 282112026,835 877551177,836 580863559,837 786925081,838 447744173,839 90081861,840 22716552,841 610375817,842 696503886,843 894129516,844 643629922,845 361399122,846 212873496,847 24950850,848 272084837,849 225407940,850 69118584,851 585427257,852 93199531,853 759303736,854 892684401,855 54387311,856 219211102,857 734932330,858 253133867,859 287296779,860 356393711,861 521830829,862 942986574,863 835526734,864 775641657,865 793444573,866 234586574,867 305990543,868 589957492,869 840715257,870 18793840,871 61463393,872 771904419,873 174384737,874 449298523,875 998770680,876 385905690,877 556897939,878 257114939,879 75136071,880 458396933,881 568211851,882 482458998,883 156091396,884 439827914,885 296595468,886 806556096,887 759274512,888 359380225,889 11956902,890 840335491,891 186135643,892 512506043,893 431375016,894 209975739,895 955020417,896 3503802,897 400814123,898 234876476,899 576947222,900 266791712,901 608870365,902 766466346,903 707602090,904 428120087,905 958082253,906 184905080,907 433493060,908 602373693,909 607604421,910 812112090,911 502237719,912 952452187,913 987786539,914 64846139,915 324252439,916 59882599,917 902241415,918 371692197,919 546742761,920 659820907,921 578700678,922 551662153,923 613246026,924 639899097,925 117406911,926 301855994,927 957388774,928 897991451,929 582703892,930 88142700,931 266915022,932 151060378,933 985016617,934 149325809,935 67085982,936 417947811,937 510895036,938 18308997,939 718674228,940 332240402,941 17036994,942 482912726,943 351285736,944 931679892,945 132057383,946 15285131,947 726581011,948 856968187,949 152149953,950 848842139,951 282301851,952 885802920,953 190876914,954 136959644,955 148312259,956 519113422,957 38376962,958 356726594,959 942808169,960 238367302,961 976641835,962 560402238,963 39078265,964 846300705,965 862455098,966 392081438,967 13303271,968 407489581,969 516158738,970 426092730,971 230270579,972 566857210,973 671558383,974 501070302,975 305494756,976 149996375,977 604973608,978 475691854,979 535650477,980 68341824,981 564713481,982 675904594,983 571734504,984 481381942,985 499047210,986 960241932,987 559188621,988 339907471,989 414845928,990 381969569,991 412056007,992 222429126,993 759873667,994 95557112,995 447973200,996 562821228,997 719714521,998 711258907,999 102339783,1000 482924658,1001 586039964,1002 28020821,1003 110040334,1004 311022027,1005 940526292,1006 648295974,1007 922554876,1008 660908464,1009 757134079,1010 846179529,1011 416721229,1012 980355072,1013 843258633,1014 773348852,1015 966317083,1016 903796445,1017 761515397,1018 962889142,1019 201745268,1020 873174137,1021 212674858,1022 910042856,1023 94088310,1024 168163893,1025 869159155,1026 233037439,1027 230987328,1028 589828823,1029 826806352,1030 664994060,1031 471688622,1032 745134907,1033 103187429,1034 603229400,1035 516560254,1036 955406852,1037 194155723,1038 683367090,1039 424942924,1040 106958578,1041 354855672,1042 35586725,1043 477587633,1044 906879483,1045 747824680,1046 815731568,1047 209223077,1048 478948459,1049 443136667,1050 720477753,1051 440977862,1052 389579185,1053 409137367,1054 666006140,1055 759594819,1056 381334522,1057 126128657,1058 456579003,1059 930758953,1060 190764978,1061 273220669,1062 613582969,1063 239713242,1064 538056745,1065 805006158,1066 752633857,1067 703024704,1068 467664263,1069 53684952,1070 390578805,1071 577204112,1072 323682769,1073 786364144,1074 893936510,1075 950948160,1076 261353949,1077 507236096,1078 366069533,1079 494139795,1080 971364473,1081 39447797,1082 365220426,1083 851906154,1084 317619002,1085 557803119,1086 716377485,1087 174428191,1088 383384919,1089 549160022,1090 571289329,1091 76711012,1092 890877483,1093 712773829,1094 167470644,1095 354483046,1096 477986720,1097 618472061,1098 405821922,1099 218831336,1100 116007746,1101 567271319,1102 477663635,1103 580816817,1104 559175243,1105 606926231,1106 890403431,1107 339487787,1108 248300406,1109 687048731,1110 511158806,1111 678359920,1112 696800477,1113 587350397,1114 179474495,1115 340894123,1116 700777902,1117 845853210,1118 921124908,1119 918785967,1120 587770467,1121 630217706,1122 717362563,1123 595981553,1124 340289370,1125 427610929,1126 714563512,1127 262433294,1128 441327464,1129 401582640,1130 691140041,1131 420004646,1132 656741070,1133 230421845,1134 278214583,1135 730761322,1136 964957276,1137 358896796,1138 557503666,1139 853464006,1140 284632286,1141 459150133,1142 603336734,1143 385689302,1144 356957264,1145 335776266,1146 745677663,1147 725855548,1148 484327271,1149 313178752,1150 850926700,1151 101190892,1152 381544552,1153 337926553,1154 144349570,1155 880307824,1156 281718892,1157 403045929,1158 193797651,1159 519465702,1160 615842736,1161 424666106,1162 214198330,1163 283598578,1164 143950066,1165 16833080,1166 12717220,1167 786413914,1168 249071653,1169 912424496,1170 830410107,1171 366021503,1172 22560213,1173 91875567,1174 567986445,1175 848426556,1176 605599362,1177 54189090,1178 616921622,1179 302844160,1180 477888837,1181 902147730,1182 618349759,1183 30587427,1184 389475281,1185 862036284,1186 248639560,1187 820585713,1188 635906374,1189 449218765,1190 693837644,1191 435514535,1192 995952207,1193 826467537,1194 144181767,1195 531526221,1196 340055046,1197 549225799,1198 387397015,1199 197758328,1200 568382231,