Statistics

Problem Statement for "DefectiveAddition"

Problem Statement

Cucumber Boy is very young. He is too young for base 10, so he does all his calculations in base 2. Additionally, he did not learn to add yet. When adding two numbers, he always forgets to do the carries, he just adds each digit independently. As you probably guessed already, the result of his calculation is in fact the bitwise xor of the two input numbers. For example, for Cucumber Boy 1+1 is 0, 1+2 is 3, 2+3 is 1, and 4+7 is 3. (All the numbers in this example are in base 10.)

Cucumber Boy has a sequence of cards. Each card contains a positive integer. You are given a int[] cards containing those integers.

You are also given a int n. Cucumber Boy wants to choose a sequence of integers b with the following properties:

  • For each i, the integer b[i] is greater than or equal to 0.
  • For each i, the integer b[i] is less than or equal to cards[i].
  • The "Cucumber Boy sum" (i.e., the bitwise xor) of all elements of the sequence b is equal to n.

Return the number of such sequences, modulo 1,000,000,007.

Definition

Class:
DefectiveAddition
Method:
count
Parameters:
int[], int
Returns:
int
Method signature:
int count(int[] cards, int n)
(be sure your method is public)

Constraints

  • cards will contain between 1 and 50 elements, inclusive.
  • Each element of cards will be between 1 and 1,000,000,000, inclusive.
  • n will be between 1 and 1,000,000,000, inclusive.

Examples

  1. {2,3}

    2

    Returns: 3

    Cucumber Boy can choose 12 different sequences: b[0] can be between 0 and 2, inclusive, and b[1] can be between 0 and 3, inclusive. Out of those 12 sequences, 3 have the required "Cucumber Boy sum": 0+2 = 2, 1+3 = 2, and 2+0 = 2.

  2. {1,2,3}

    1

    Returns: 6

    The six good sequences are (0,0,1), (0,1,0), (0,2,3), (1,0,0), (1,1,1), and (1,2,2).

  3. {4, 5, 7, 11}

    6

    Returns: 240

  4. {1,2,3,4,5,6,7,8,9,10}

    15

    Returns: 1965600

  5. {1,2,3,4,5,6,7,8,9,10}

    16

    Returns: 0

  6. {270216263,191391530,812669701,553475509,445349753,344887257,730417257,812158120,147699712,880268352,889772844,686078706,105754109,182546394,949118331,220137367,979932170,89957933,873226918,715669848,486937973,196032869,777206981,68706224,843638550,212567593,883488165,964776170,928126552,301950428,992516191,426542625,849040636,941604921}

    85377744

    Returns: 883998283

  7. {38269863,659998485,280937364,681643302,725914711,729267237,23351877,142750432,840579930,98560398,910500676,170970492,856224191,983059345,718458135,876268426,764841630,398844031,185252728,370429127,502141744,993687335,15934105,363674761,904629750,47965621,451230257,84670933,561035573,840531614,248402491,518954510,614127120,683337406,382875696,843654050,436430328,951656720,120033498,669566825,277092597,219218650,643287357,41654185,429623094}

    994719311

    Returns: 865173708

  8. {505099307,807426510,317442755,853580353,292425666,944216784,589638739,401170802,86979691,225161331,444887338,339228196,131636657,182095964,211082012,152299428,223840043,287487107,593400969,735206213,589759002,69834511,668882481,808284659,201886572,14983332,86000815,361784848,761170565,801013198,730103626,5748439,576460932,267998019,287998488,883570152,659169188,28409914,145324180,148026996,783671751,994411751,6364914,968295563,559931135,653962274}

    888581008

    Returns: 831601686

  9. {699304831,261159141,968925558,891777679,928854727,542938504,135550598,59320409,521884894,873213989,71339239,965117086,525440094,212677189,484742721,852483212,533958747,583332388,80815711,217079210,913595888,931858669,2583104,237123474,963071901,825207675,700375106,196796184,706140953,9984371,976151788,319159303,442727411,232021906,578512111,303305401,117157997,269950143,471898586,343191861,114797048,152143925,338685732,762321159,749675387,634535220,114316401,68043416}

    241418522

    Returns: 795097378

  10. {54969875,580643062,957115007,948283603,553189269,23689366}

    659481683

    Returns: 592875316

  11. {6724,6090,9107,4320,3131,7656,8733,3994,9975,7596,8811,3674,5056,8731,6096,8246,706,7695,2949,9874,8354}

    6519

    Returns: 729584454

  12. {742,6757,5645,3144,1641,3738,4680,6136,1150,1530,7211,6608,4418,5256,3788,9374,7627,7446,4113,9173,3596,7154,5054,5184,1718}

    761

    Returns: 829202447

  13. {9177,3078,8777,5400,655,2729}

    6018

    Returns: 610884202

  14. {5456,8871,8317}

    2162

    Returns: 44789424

  15. {7931,7481,6605,3387,1360,6208,1955,6080,3703,1366,4454,3733,9837,8433,4564,3018,5108,3584,4911,8468,8117,1547,1720,5529,8072,108,8257,8521,2354,6529,8155,6431,3478,5049,6521,1205,3415,811,5720,7926,8299,2132,1702,6710,752}

    9382

    Returns: 638123402

  16. {8653,3925,4696,472,1154,4626,979,5617,1143,6598,7089,274341733,475831918,33644405,860692744,441680396,153542750,333654408,383555937,399374303,178883768,827166046,499751564}

    512818

    Returns: 112611775

  17. {4897,3052,7808,1768,4998,8979,651,7810,2331,2361,717,5162,2294,3210,3754,6099,5131,9635,4544,1890,941574089,234179032,62300693,324920402,691968675,612172295,731415694,346491166,81471950,541238766,604257738,411582459,360400842,970817049,53465944,414036230,170490216,21467390,28707210,309610389,14059755}

    33399

    Returns: 409569316

  18. {2272,6517,7565,278,6913,6,612,7213,2783,3093,3124,9202,8325,4005,1438,2603,8805,3364,1392,4274,6576,9907,557511760,861506627,110751897,934278860,418587764,112026359,510083578,54150485,296877748,91507157,695475949,106023606,857575455,853016195,394623360,73113431,408884324,362645884,600221025,311361448,331020203,789630848}

    213502

    Returns: 211835809

  19. {1793,9589,9305,9134,1559,4843,6415,4568,1729,8507,8392,7001,8993,97051119,82953399,251951719,760329869,966331976,725640580,877082120,917831364,699274597,942525380,432507917,362431467,141343841,665564233}

    206050

    Returns: 129340903

  20. {3156,4572,312,6180,797,5301,4217,904,1994,1056,3729,2482,5906,6030,1038,393479898,470441287,484908658,265491378,494070683,685789555,846206507,66110758,481376530,18269581,333824642,524643867,117104853,739141934,605540661,454008491}

    677415

    Returns: 969114858

  21. {1607,8115,1186,6648,1228,9436,59,9184,899971111,98551743,37649375,564730605,384404672,710498873,279314606,860610481,885352672}

    874733

    Returns: 936298824

  22. {5482,8681,3792,1776,3001,5047,1833,8469,4859,227,8179,8667,9469,6255,3704,518763464,196150923,138392512,862720894,354043649,546965958,466668832,916382920,322111513,164897093,258046233,478762221,254320224,715848039,696058610}

    88718

    Returns: 417265532

  23. {1729,382741977,584975153}

    788523

    Returns: 143617306

  24. {1403,8705,1937,9351,1036,7826,1129,3965,3427,110844166,339394776,588783405,455244165,308476874,38297259,938993625,48555822,930358830}

    641424

    Returns: 854241980

  25. {227,7605,8452,5038,4839,6626,1380,420,8576,8689,9898,6821,7079,7967,885118798,841827056,537716675,60528229,432220403,885642677,39294280,906580383,152334977,970631262,751486328,163311492,51113283,27170075}

    992225

    Returns: 46372808

  26. {8698,7034,9806,2319,1876,8939,216482321,947260758,790613440,619313289,801874772,241424528}

    597343

    Returns: 348234264

  27. {8065,2571,4480,250486268,203774339,185251412,108323207}

    799869

    Returns: 89032792

  28. {2971,7811,5885,5143,4597,7209,7072,7169,9377,5008,3313,8949,6718,8358,6219,9855,991,9854,5240,8450,8985,2712,3975,791618822,566314637,598476329,121455786,60356494,409982268,748704244,875677532,713526955,117009140,207248984,278464284,850951685,689179016,85406597,278706089,518225535,277281652,556727423,277164214,59527890,853102626,770433886,36761398}

    733279

    Returns: 836732968

  29. {9850,9841,514,8889,6423,7280,5583,1941,867,5547,7801,7164,1923,162436279,685673046,853477237,335928758,496677900,296635186,886027272,996606818,601537993,64630433,566849099,128623132,605919246,568066185}

    780716

    Returns: 820754868

  30. {3803,9705,1851,1578,1188,2096,293,6779,7338,3288,4620,4516,888,4058,4454,554,9889,8584,799204786,409247176,622912090,489252810,807062354,367555596,917129098,37007570,456590271,19815169,974817239,488226199,871902484,421877145,282858592,778927101,483314943,121797354,131959586}

    162636

    Returns: 586973320

  31. {6263,1530,9701,5509,9753,7257,7257,8120,9712,8352,2844,8706,4109,6394,8331,7367,2170,7933,6918,9848,7973,2869,6981,6224,8550,7593,8165,6170,6552,428,6191,2625,636,4921}

    85377744

    Returns: 0

  32. {9863,8485,7364,3302,4711,7237,1877,432,9930,398,676,492,4191,9345,8135,8426,1630,4031,2728,9127,1744,7335,4105,4761,9750,5621,257,933,5573,1614,2491,4510,7120,7406,5696,4050,328,6720,3498,6825,2597,8650,7357,4185,3094}

    994719311

    Returns: 0

  33. {9307,6510,2755,353,5666,6784,8739,802,9691,1331,7338,8196,6657,5964,2012,9428,43,7107,969,6213,9002,4511,2481,4659,6572,3332,815,4848,565,3198,3626,8439,932,8019,8488,152,9188,9914,4180,6996,1751,1751,4914,5563,1135,2274}

    888581008

    Returns: 0

  34. {4831,9141,5558,7679,4727,8504,598,409,4894,3989,9239,7086,94,7189,2721,3212,8747,2388,5711,9210,5888,8669,3104,3474,1901,7675,5106,6184,953,4371,1788,9303,7411,1906,2111,5401,7997,143,8586,1861,7048,3925,5732,1159,5387,5220,6401,3416}

    241418522

    Returns: 0

  35. {9875,3062,5007,3603,9269,9366}

    659481683

    Returns: 0

  36. {8,536870912,67108864,536870912,1048576,33554432,4096,8388608,16777216,32,1024,8388608,33554432,1024,33554432,32768,32768,16,262144,8388608,8}

    587136519

    Returns: 527418386

  37. {2048,65536,16777216,8,1024,134217728,536870912,33554432,524288,536870912,1048576,134217728,134217728,32768,128,8192,64,32,4096,4,32768,8,8192,8,134217728}

    377520761

    Returns: 274971703

  38. {64,131072,67108864,536870912,16384,256}

    226846018

    Returns: 814705443

  39. {32768,1,64}

    957482162

    Returns: 0

  40. {1,1,16,64,524288,134217728,16,536870912,4194304,32768,8192,4194304,65536,4096,8,128,134217728,8388608,1,128,67108864,65536,524288,262144,2048,128,67108864,1024,8192,268435456,16777216,1,131072,262144,1,16,16,1048576,512,32768,262144,2097152,2048,524288,2048}

    130019382

    Returns: 96760314

  41. {8,33,8197,268435462,4103,262146,132,8197,536870919,67108866,133,8388608,268435462,2097159,134217735,262144,524288,1030,2097155,524291,268435456,16777219,520}

    517512818

    Returns: 664937040

  42. {2052,19,33554441,32775,257,259,536870917,521,260,9,2097158,16777223,4101,4,6,8193,16388,130,16387,2051,32774,518,67108873,8388616,134217732,134,262149,16388,512,8388611,16391,11}

    62300693

    Returns: 102114118

  43. {4194312,16777219,262146,16391,268435462,2048,4104,264,268435461,524297,14,536870918,64,4194304,21,2097153,536870918,1030,11,40,7,524295,134217734,135,4194308,67108871,512}

    64206050

    Returns: 554721734

  44. {4099,1048576,66,68,32775,133,259,1026,20,2050,33554432,11,131073,2,32,67108866,268435464,72,67108872,16387,8194,2051,268435463,11,4194306,4096,8388616,536870914,12,66,131075,8,65536,33554437,268435460,65541,32772,16777219,260,2097161,132,68}

    524643867

    Returns: 603955493

  45. {261,524297}

    562105038

    Returns: 0

  46. {131072,262,134217733,24,4194310,536870914,67108865,129,8,4,131075,33554440,32776,1031,524296,9,67108872,16777216,536870919,268435457,67108870,256,1048580,4194310,268435457,268435462}

    8689

    Returns: 45337384

  47. {268435463,131080,16777216,8201,524292,2052,8,268435461}

    3313

    Returns: 689779058

  48. {8193,16777225,8388611,16389,72,16385,4194307,536870917,33554439,65541,512,16,4194313,4194304,70,4,4194312,32774,131081,33554433,131074,4104,2097157,16390,32770,16777216,135,32770,268435463,131081,33554439,131,8200,13,32777,515,39,536870912,262152,268435459,16777217,3,13,13}

    2268

    Returns: 89627732

  49. {1048580,524290,1048583,8,33554435,256,8196,1033,70,6,65544,131080,67108869,4194308,65542,33554436,8197,32777,524291,514,134217737,65539,262149,134217731,265,16389,7,16,1033,9,2097156,16777219,67,35,134217729,257,4194305,67108867,516,1048578,4101,4194310,8199,16777224,2057,8199}

    7520

    Returns: 517560626

  50. {1048579,524295,11,37,520,514,2048,1029,2097152,20,134217736,8198,16387,65543,268435460,65539,1033,32770}

    214

    Returns: 285788049

  51. {17,12,536870916,7,9,536870919,536870918}

    50

    Returns: 338073470

  52. {1,2,4,8,16,32,64,128,256,512,1024}

    97

    Returns: 82151814

  53. {1,2,4,8,16,32,64,128,256,512,1024}

    1826

    Returns: 9845550

  54. {1,2,4,8,16,32,64,128,256,512,1024}

    125

    Returns: 82151814

  55. {1,2,4,8,16,32,64,128,256,512,1024}

    2021

    Returns: 270

  56. {1000000000,1000000000,1000000000,1000000000,1000000000,1000000000,1000000000,1000000000,1000000000,1000000000,1000000000,1000000000,1000000000,1000000000,1000000000,1000000000,1000000000,1000000000,1000000000,1000000000,1000000000,1000000000,1000000000,1000000000,1000000000,1000000000,1000000000,1000000000,1000000000,1000000000,1000000000,1000000000,1000000000,1000000000,1000000000,1000000000,1000000000,1000000000,1000000000,1000000000,1000000000,1000000000,1000000000,1000000000,1000000000,1000000000,1000000000,1000000000,1000000000,1000000000}

    1000000000

    Returns: 211657237

  57. {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

    Returns: 949480669

  58. {101886204,452529170,5471075,266575351,312275885,674545447,647776722,867717535,956069693,357994180,737701848,421700883,769986776,72177789,726627322,25313682,351836334,533533199,688517481,552818997,753476314,345899712,115709927,456940822,113370094,13144087,712026626,828646127,753094442,51831799,461615018,122587732,922809531,702873880,176208314,84290976,60842784,595168807,758216184,872906489,738710892,20375268,485243273,107070176,544419943,62531517,369106988,863315589,544570927,248037003}

    515325951

    Returns: 274604464

  59. {101886204,452529170,5471075,266575351,312275885,674545447,647776722,867717535,956069693,357994180,737701848,421700883,769986776,72177789,726627322,25313682,351836334,533533199,688517481,552818997,753476314,345899712,115709927,456940822,113370094,13144087,712026626,828646127,753094442,51831799,461615018,122587732,922809531,702873880,176208314,84290976,60842784,595168807,758216184,872906489,738710892,20375268,485243273,107070176,544419943,62531517,369106988,863315589,544570927,248037003}

    515325952

    Returns: 926267495

  60. {101886204,452529170,5471075,266575351,312275885,674545447,647776722,867717535,956069693,357994180,737701848,421700883,769986776,72177789,726627322,25313682,351836334,533533199,688517481,552818997,753476314,345899712,115709927,456940822,113370094,13144087,712026626,828646127,753094442,51831799,461615018,122587732,922809531,702873880,176208314,84290976,60842784,595168807,758216184,872906489,738710892,20375268,485243273,107070176,544419943,62531517,369106988,863315589,544570927,248037003}

    515325953

    Returns: 926267495

  61. {101886204,452529170,5471075,266575351,312275885,674545447,647776722,867717535,956069693,357994180,737701848,421700883,769986776,72177789,726627322,25313682,351836334,533533199,688517481,552818997,753476314,345899712,115709927,456940822,113370094,13144087,712026626,828646127,753094442,51831799,461615018,122587732,922809531,702873880,176208314,84290976,60842784,595168807,758216184,872906489,738710892,20375268,485243273,107070176,544419943,62531517,369106988,863315589,544570927,248037003}

    515341279

    Returns: 784432293

  62. {101886204,452529170,5471075,266575351,312275885,674545447,647776722,867717535,956069693,357994180,737701848,421700883,769986776,72177789,726627322,25313682,351836334,533533199,688517481,552818997,753476314,345899712,115709927,456940822,113370094,13144087,712026626,828646127,753094442,51831799,461615018,122587732,922809531,702873880,176208314,84290976,60842784,595168807,758216184,872906489,738710892,20375268,485243273,107070176,544419943,62531517,369106988,863315589,544570927,248037003}

    515341280

    Returns: 388543346

  63. {101886204,452529170,5471075,266575351,312275885,674545447,647776722,867717535,956069693,357994180,737701848,421700883,769986776,72177789,726627322,25313682,351836334,533533199,688517481,552818997,753476314,345899712,115709927,456940822,113370094,13144087,712026626,828646127,753094442,51831799,461615018,122587732,922809531,702873880,176208314,84290976,60842784,595168807,758216184,872906489,738710892,20375268,485243273,107070176,544419943,62531517,369106988,863315589,544570927,248037003}

    515341281

    Returns: 388543346

  64. {101886204,452529170,5471075,266575351,312275885,674545447,647776722,867717535,956069693,357994180,737701848,421700883,769986776,72177789,726627322,25313682,351836334,533533199,688517481,552818997,753476314,345899712,115709927,456940822,113370094,13144087,712026626,828646127,753094442,51831799,461615018,122587732,922809531,702873880,176208314,84290976,60842784,595168807,758216184,872906489,738710892,20375268,485243273,107070176,544419943,62531517,369106988,863315589,544570927,248037003}

    515899391

    Returns: 233079467

  65. {101886204,452529170,5471075,266575351,312275885,674545447,647776722,867717535,956069693,357994180,737701848,421700883,769986776,72177789,726627322,25313682,351836334,533533199,688517481,552818997,753476314,345899712,115709927,456940822,113370094,13144087,712026626,828646127,753094442,51831799,461615018,122587732,922809531,702873880,176208314,84290976,60842784,595168807,758216184,872906489,738710892,20375268,485243273,107070176,544419943,62531517,369106988,863315589,544570927,248037003}

    515899392

    Returns: 69864305

  66. {101886204,452529170,5471075,266575351,312275885,674545447,647776722,867717535,956069693,357994180,737701848,421700883,769986776,72177789,726627322,25313682,351836334,533533199,688517481,552818997,753476314,345899712,115709927,456940822,113370094,13144087,712026626,828646127,753094442,51831799,461615018,122587732,922809531,702873880,176208314,84290976,60842784,595168807,758216184,872906489,738710892,20375268,485243273,107070176,544419943,62531517,369106988,863315589,544570927,248037003}

    515899393

    Returns: 69864305

  67. {101886204,452529170,5471075,266575351,312275885,674545447,647776722,867717535,956069693,357994180,737701848,421700883,769986776,72177789,726627322,25313682,351836334,533533199,688517481,552818997,753476314,345899712,115709927,456940822,113370094,13144087,712026626,828646127,753094442,51831799,461615018,122587732,922809531,702873880,176208314,84290976,60842784,595168807,758216184,872906489,738710892,20375268,485243273,107070176,544419943,62531517,369106988,863315589,544570927,248037003}

    515341311

    Returns: 388543346

  68. {101886204,452529170,5471075,266575351,312275885,674545447,647776722,867717535,956069693,357994180,737701848,421700883,769986776,72177789,726627322,25313682,351836334,533533199,688517481,552818997,753476314,345899712,115709927,456940822,113370094,13144087,712026626,828646127,753094442,51831799,461615018,122587732,922809531,702873880,176208314,84290976,60842784,595168807,758216184,872906489,738710892,20375268,485243273,107070176,544419943,62531517,369106988,863315589,544570927,248037003}

    515341312

    Returns: 843103801

  69. {101886204,452529170,5471075,266575351,312275885,674545447,647776722,867717535,956069693,357994180,737701848,421700883,769986776,72177789,726627322,25313682,351836334,533533199,688517481,552818997,753476314,345899712,115709927,456940822,113370094,13144087,712026626,828646127,753094442,51831799,461615018,122587732,922809531,702873880,176208314,84290976,60842784,595168807,758216184,872906489,738710892,20375268,485243273,107070176,544419943,62531517,369106988,863315589,544570927,248037003}

    515341313

    Returns: 843103801

  70. {101886204,452529170,5471075,266575351,312275885,674545447,647776722,867717535,956069693,357994180,737701848,421700883,769986776,72177789,726627322,25313682,351836334,533533199,688517481,552818997,753476314,345899712,115709927,456940822,113370094,13144087,712026626,828646127,753094442,51831799,461615018,122587732,922809531,702873880,176208314,84290976,60842784,595168807,758216184,872906489,738710892,20375268,485243273,107070176,544419943,62531517,369106988,863315589,544570927,248037003}

    536870911

    Returns: 418619086

  71. {101886204,452529170,5471075,266575351,312275885,674545447,647776722,867717535,956069693,357994180,737701848,421700883,769986776,72177789,726627322,25313682,351836334,533533199,688517481,552818997,753476314,345899712,115709927,456940822,113370094,13144087,712026626,828646127,753094442,51831799,461615018,122587732,922809531,702873880,176208314,84290976,60842784,595168807,758216184,872906489,738710892,20375268,485243273,107070176,544419943,62531517,369106988,863315589,544570927,248037003}

    536870912

    Returns: 520072943

  72. {101886204,452529170,5471075,266575351,312275885,674545447,647776722,867717535,956069693,357994180,737701848,421700883,769986776,72177789,726627322,25313682,351836334,533533199,688517481,552818997,753476314,345899712,115709927,456940822,113370094,13144087,712026626,828646127,753094442,51831799,461615018,122587732,922809531,702873880,176208314,84290976,60842784,595168807,758216184,872906489,738710892,20375268,485243273,107070176,544419943,62531517,369106988,863315589,544570927,248037003}

    536870913

    Returns: 520072943

  73. {257,17,4098,3,1026,513,128,513,512,2097154,6,8388608,4097,1048577,536870912,33554432,8388609,2,513,134217728,4194306,524289,512,4098,65536,8388610,256,8194,67108865,1025,258,65537,32770,64,514,8192,258,1026,2097153,33554432,1048577,8192,1048578,524289,134217730,128,5,134217730,9,134217729}

    618135551

    Returns: 360005702

  74. {257,17,4098,3,1026,513,128,513,512,2097154,6,8388608,4097,1048577,536870912,33554432,8388609,2,513,134217728,4194306,524289,512,4098,65536,8388610,256,8194,67108865,1025,258,65537,32770,64,514,8192,258,1026,2097153,33554432,1048577,8192,1048578,524289,134217730,128,5,134217730,9,134217729}

    618135552

    Returns: 30441083

  75. {257,17,4098,3,1026,513,128,513,512,2097154,6,8388608,4097,1048577,536870912,33554432,8388609,2,513,134217728,4194306,524289,512,4098,65536,8388610,256,8194,67108865,1025,258,65537,32770,64,514,8192,258,1026,2097153,33554432,1048577,8192,1048578,524289,134217730,128,5,134217730,9,134217729}

    618135553

    Returns: 30441083

  76. {257,17,4098,3,1026,513,128,513,512,2097154,6,8388608,4097,1048577,536870912,33554432,8388609,2,513,134217728,4194306,524289,512,4098,65536,8388610,256,8194,67108865,1025,258,65537,32770,64,514,8192,258,1026,2097153,33554432,1048577,8192,1048578,524289,134217730,128,5,134217730,9,134217729}

    617657423

    Returns: 119925216

  77. {257,17,4098,3,1026,513,128,513,512,2097154,6,8388608,4097,1048577,536870912,33554432,8388609,2,513,134217728,4194306,524289,512,4098,65536,8388610,256,8194,67108865,1025,258,65537,32770,64,514,8192,258,1026,2097153,33554432,1048577,8192,1048578,524289,134217730,128,5,134217730,9,134217729}

    617657424

    Returns: 275385286

  78. {257,17,4098,3,1026,513,128,513,512,2097154,6,8388608,4097,1048577,536870912,33554432,8388609,2,513,134217728,4194306,524289,512,4098,65536,8388610,256,8194,67108865,1025,258,65537,32770,64,514,8192,258,1026,2097153,33554432,1048577,8192,1048578,524289,134217730,128,5,134217730,9,134217729}

    617657425

    Returns: 275385286

  79. {257,17,4098,3,1026,513,128,513,512,2097154,6,8388608,4097,1048577,536870912,33554432,8388609,2,513,134217728,4194306,524289,512,4098,65536,8388610,256,8194,67108865,1025,258,65537,32770,64,514,8192,258,1026,2097153,33554432,1048577,8192,1048578,524289,134217730,128,5,134217730,9,134217729}

    617656319

    Returns: 905075339

  80. {257,17,4098,3,1026,513,128,513,512,2097154,6,8388608,4097,1048577,536870912,33554432,8388609,2,513,134217728,4194306,524289,512,4098,65536,8388610,256,8194,67108865,1025,258,65537,32770,64,514,8192,258,1026,2097153,33554432,1048577,8192,1048578,524289,134217730,128,5,134217730,9,134217729}

    617656320

    Returns: 260847757

  81. {257,17,4098,3,1026,513,128,513,512,2097154,6,8388608,4097,1048577,536870912,33554432,8388609,2,513,134217728,4194306,524289,512,4098,65536,8388610,256,8194,67108865,1025,258,65537,32770,64,514,8192,258,1026,2097153,33554432,1048577,8192,1048578,524289,134217730,128,5,134217730,9,134217729}

    617656321

    Returns: 260847757

  82. {129,8191,511,131073,32,1048575,4097,129,33554433,1,4096,1024,65,536870913,3,134217727,1025,131073,1048577,31,134217728,3,131073,8191,8192,536870912,5,1,262143,2097153,256,129,16777215,65535,536870911,131071,3,16,17,16383,131072,65535,262143,2097151,16777216,67108863,63,2049,65535,4}

    10000

    Returns: 209630900

  83. {2097154,67108865,268435458,10,510,5,16777214,5,1025,262146,31,131073,64,257,16777214,17,4098,16777215,8,65,8388606,4096,131074,4194302,268435458,62,524287,4194306,18,33554432,6,8388606,3,4097,262145,262145,8192,32768,16777215,258,16382,65538,2,4095,268435457,524290,4194306,1023,268435457,1}

    1

    Returns: 658384319

  84. {2097154,67108865,268435458,10,510,5,16777214,5,1025,262146,31,131073,64,257,16777214,17,4098,16777215,8,65,8388606,4096,131074,4194302,268435458,62,524287,4194306,18,33554432,6,8388606,3,4097,262145,262145,8192,32768,16777215,258,16382,65538,2,4095,268435457,524290,4194306,1023,268435457,1}

    2

    Returns: 658384319

  85. {2097154,67108865,268435458,10,510,5,16777214,5,1025,262146,31,131073,64,257,16777214,17,4098,16777215,8,65,8388606,4096,131074,4194302,268435458,62,524287,4194306,18,33554432,6,8388606,3,4097,262145,262145,8192,32768,16777215,258,16382,65538,2,4095,268435457,524290,4194306,1023,268435457,1}

    67108863

    Returns: 658384319

  86. {2097154,67108865,268435458,10,510,5,16777214,5,1025,262146,31,131073,64,257,16777214,17,4098,16777215,8,65,8388606,4096,131074,4194302,268435458,62,524287,4194306,18,33554432,6,8388606,3,4097,262145,262145,8192,32768,16777215,258,16382,65538,2,4095,268435457,524290,4194306,1023,268435457,1}

    67108864

    Returns: 975261648

  87. {2097154,67108865,268435458,10,510,5,16777214,5,1025,262146,31,131073,64,257,16777214,17,4098,16777215,8,65,8388606,4096,131074,4194302,268435458,62,524287,4194306,18,33554432,6,8388606,3,4097,262145,262145,8192,32768,16777215,258,16382,65538,2,4095,268435457,524290,4194306,1023,268435457,1}

    67108865

    Returns: 975261648

  88. {1}

    1

    Returns: 1

  89. {1}

    1000000000

    Returns: 0

  90. {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

    Returns: 949480669

  91. {2, 3 }

    2

    Returns: 3

  92. {4, 5, 7, 11 }

    6

    Returns: 240

  93. {568009990, 542735597, 645908749, 752768536, 653764760, 833336658, 269071274, 995959114, 310052894, 836031447, 756808487, 270944827, 142281859, 245661296, 266491299, 55046012, 29849169, 940779440, 805171592, 550865647, 207200307, 52803613, 17263202, 459483495, 799825063, 651572789, 438353994, 674045338, 470144527, 603283731, 221424667, 767983253, 879504051, 219414107, 252219204, 65873916, 101717416, 214284432, 705984353, 172718243, 749873911, 219566331, 161695605, 766779452, 810328685, 396912548, 338193606, 521057834, 217798399, 381237629 }

    12345678

    Returns: 31465681

  94. {46016589, 163620012, 268461354, 332016596, 183955406, 668530749, 192106820, 98879012, 349925101, 293216409, 859414974, 357815191, 288220876, 730216404, 85720621, 660510182, 916314965, 49337504, 93217192, 4780114, 185924032, 941711038, 298578400, 296665544, 113321974, 687127301, 144629234, 211505717, 230354997, 19448406, 980512979, 195018641, 260223769, 89119046, 141210624, 635527541, 81284635, 445321037, 436619737, 292727968, 724827570, 675619907, 217158126, 322104202, 213111953, 969429501, 72713435, 839016825, 97387310, 28448495 }

    254411119

    Returns: 32867672

  95. {1, 1, 1 }

    1

    Returns: 4


This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2024, TopCoder, Inc. All rights reserved.
This problem was used for: