Statistics

Problem Statement for "FunnyGames"

Problem Statement

In a popular TV show, three teams, A, B and C, play some funny games. There are several different games that can be used for the show and for each of them we know beforehand the number of points each team will get. For the i-th game the number of points received by teams A, B and C will be A[i], B[i] and C[i], correspondingly.


The show consists of several games. A team's score is defined as the total number of points received in all games used for the show. The winner of the show is the team that has a strictly greater score than each of the other teams. The director wants to choose at least k games for the next show so that team A will be the winner. The order of the chosen games does not matter. Return the number of ways this is possible.

Definition

Class:
FunnyGames
Method:
countWays
Parameters:
int[], int[], int[], int
Returns:
long
Method signature:
long countWays(int[] A, int[] B, int[] C, int k)
(be sure your method is public)

Constraints

  • A will contain between 2 and 34 elements, inclusive.
  • A, B and C will all contain the same number of elements.
  • Each element of A will be between 1 and 1,000,000,000, inclusive.
  • Each element of B will be between 1 and 1,000,000,000, inclusive.
  • Each element of C will be between 1 and 1,000,000,000, inclusive.
  • k will be between 1 and min(7, number of elements in A), inclusive.

Examples

  1. {1,1,2}

    {1,1,1}

    {1,1,1}

    2

    Returns: 3

    The set of chosen games can be {0,2}, {1,2} or {0,1,2}.

  2. {1,2,2}

    {2,1,2}

    {2,2,1}

    1

    Returns: 1

    The second and the third games should be chosen.

  3. {1000000000,1,1,1}

    {1,1,1,1}

    {1,1,1,1}

    3

    Returns: 4

  4. {2,3,4,5}

    {2,3,4,5}

    {1,2,3,5}

    1

    Returns: 0

  5. {1000,2000,3000,1000,2000,3000}

    {2000,3000,1000,3000,1000,2000}

    {3000,1000,2000,2000,3000,1000}

    2

    Returns: 14

  6. {401853343,732873717}

    {795255254,641278350}

    {871207479,224455919}

    2

    Returns: 0

  7. {58,82}

    {79,76}

    {27,81}

    1

    Returns: 1

  8. {3,3,5}

    {1,4,5}

    {4,1,2}

    2

    Returns: 3

  9. {1,3,2}

    {1,2,1}

    {3,2,2}

    1

    Returns: 2

  10. {38868702,489722381,324268659}

    {179628409,455303670,324887859}

    {82001992,397827376,113482265}

    2

    Returns: 1

  11. {463790519,957574746,939104308,540534265}

    {422323424,21837705,941343072,282007822}

    {83999660,928652616,199388547,729022835}

    1

    Returns: 12

  12. {4,3,5,5}

    {1,5,3,5}

    {1,3,1,3}

    1

    Returns: 10

  13. {2,3,2,1,3}

    {2,3,3,1,2}

    {1,2,2,3,1}

    1

    Returns: 7

  14. {2,1,1,1,2,1}

    {2,1,2,2,1,2}

    {2,1,2,2,1,2}

    2

    Returns: 3

  15. {2,2,2,4,4,4,5}

    {3,5,1,1,3,5,1}

    {3,5,4,1,2,4,3}

    7

    Returns: 1

  16. {2,1,4,4,4,2,2,4}

    {1,1,1,2,3,4,2,1}

    {4,2,2,2,2,1,1,2}

    3

    Returns: 193

  17. {668661930,902815595,825662455,5062390,996360253,891007352,886427009,45086327,959350557,644188511}

    {334133325,208228494,252722896,356929137,598950668,324429695,658626153,87096564,580357545,898626959}

    {298404468,754915617,333458369,498883749,565413857,600567658,920438564,702841866,48761868,197812052}

    2

    Returns: 890

  18. {42144752,45375244,522231,11834530,2015217,20200657,48365057,131929,61767164,21663723,56207051,6242051,65944159}

    {66118592,10579598,7741102,4792435,61526793,11884179,23057193,64813710,21059240,59365365,62370687,45061908,29834467}

    {10299483,25813974,28949504,51393422,45825519,54026343,62605471,6188449,58985512,5700560,12881688,27585694,43069385}

    6

    Returns: 542

  19. {890261037,912140128,669758626,412454182,946228029,589754775,897838490,287276474,541595455,32353005,385408058,57861704,680060856,216939126,6210013}

    {51362894,73393457,692712426,168587694,626949099,340547227,738108950,348793318,61660084,328265879,952853388,216520027,971744649,212435076,269267555}

    {685618561,735610513,361463145,37423127,298633895,638219156,418747543,68462585,509869942,564346948,84359169,750022056,795730744,139407983,239360840}

    4

    Returns: 22151

  20. {11860239,820956393,161072322,913084200,310132614,908564695,337806388,689463770,158798579,270939620,424426229,768357006,754564598,955109426,671938877,195044725,123648005,324535817}

    {546984724,958128976,256866189,263533177,230547321,407426184,96337268,48762019,270210122,197962771,211917883,336599677,173171936,167755745,94821240,899412982,300307531,359655517}

    {111304663,765713444,887939953,446261045,681657169,791559194,487319259,261976574,36432170,518512217,863248689,675836298,892897627,925046325,557098379,446198577,382956207,601230200}

    7

    Returns: 24738

  21. {614764655,130322569,210661170,703287309,205502957,890490780,211640838,326360142,572813469,541715162,761333079,433170420,572733964,933311615,629689969,583811490,871293964,298606185,372166622}

    {753974080,382673593,398315599,245769011,855437188,481651252,242852523,511466668,654613038,384541347,230732096,923974606,155100431,398228715,881860617,15468499,114892907,90555926,683230837}

    {629238483,903030497,370073624,977621102,431008180,282731439,618448011,976975053,421685648,232838279,897682945,599490183,595881347,246577320,171534491,38605184,121667865,193846264,977215255}

    5

    Returns: 257174

  22. {2,3,3,3,2,1,2,3,2,2,2,1,2,2,3,3,3,3,1,1}

    {1,3,2,3,2,1,2,2,3,3,1,1,3,2,3,3,2,3,3,2}

    {3,3,2,1,1,1,3,2,1,2,2,3,2,1,1,2,2,3,1,2}

    2

    Returns: 274069

  23. {97154,69741,70898,79220,88051,98276,80156,66154,66482,18831,76738,73313,53765,46138,49148,65585,19708,93987,28406,28185,36433,96135,35065}

    {46997,11170,68256,79203,74716,87604,10925,78283,22825,10833,3351,34461,31949,92048,32080,80162,92330,40651,22842,94874,38898,93715,10412}

    {3025,33345,40674,39146,76790,9089,97092,86887,29665,55300,89159,97281,66126,54601,21213,92050,37195,83080,42924,43961,54754,93331,53409}

    6

    Returns: 6190597

  24. {972377,720214,178546,256367,891315,631407,869355,984972,92647,73736,992578,440432,511440,836745,722271,970609,658119,862157,891792,270911,631707,346426,126550,3975}

    {465825,933185,99779,464553,190684,490208,661310,741415,43893,882816,357596,24001,32618,594936,222631,255426,303469,489701,303020,628887,235469,625604,644533,48951}

    {450601,913149,522004,168588,606872,45003,943654,858318,744395,399880,347290,78230,244099,333889,101072,788915,928783,371581,450519,731947,191797,955327,856043,817489}

    7

    Returns: 11286750

  25. {90,46,97,61,16,72,6,26,59,34,55,74,59,47,31,80,84,30,88,11,97,44,94,64,88,67}

    {59,70,11,18,99,60,91,19,89,88,93,23,12,9,18,28,77,95,83,11,77,35,12,75,1,35}

    {78,16,5,45,69,46,32,57,80,56,26,53,76,31,57,53,82,54,54,3,75,49,81,79,84,6}

    4

    Returns: 50271316

  26. {328617,97482,447688,988488,545610,18599,285738,871067,189126,128078,935450,245699,570085,441050,17426,159604,998715,825289,12909,350645,933818,886430,216582,442388,685340,338221,473138}

    {386231,946482,231376,744701,977266,237489,854084,40415,243028,960492,309627,632191,18768,377156,774148,817428,886500,516070,241685,983777,195476,930482,660619,613361,550523,558860,394581}

    {197335,463310,799759,805200,943173,659687,742767,16586,678981,876601,168127,83029,835620,663574,527067,542700,553859,467213,312194,669200,666202,758660,196388,989615,669843,305321,441933}

    1

    Returns: 8806041

  27. {14,17,14,11,5,12,9,9,11,5,10,3,3,13,7,16,9,15,7,13,2,12,3,16,12,4,9,14}

    {13,10,9,2,9,16,16,15,13,1,6,5,1,16,3,9,14,14,9,15,12,1,3,1,14,9,13,12}

    {4,15,16,1,2,13,16,6,12,16,13,13,3,11,1,4,3,7,7,13,12,14,12,5,7,5,10,1}

    3

    Returns: 155497900

  28. {130240082,835366202,784222723,992739376,887776236,337462437,732497463,573498231,270048958,509724716,238950253,303048381,504740168,53814829,963180953,724198457,333161335,39978242,566256295,464433475,990367617,513423245,820894509,203551979,300762317,684942428,893687782,775897426,432475720}

    {902843407,921137495,480078446,297343313,434180142,234195622,908660629,633044009,659800621,588183145,173270337,51350433,394866835,635417542,193350097,277618894,247758466,98297300,834787827,860098512,386779177,873830161,327336311,654169359,375061669,336776931,121107858,909050774,80635247}

    {268928984,871164330,680208864,604677878,291813471,495309835,433963485,481601656,792410933,464503876,713454307,230761259,554328178,919755983,631695826,818176825,929688221,106170757,231987679,121748749,702438611,704354471,156315977,476968715,574224215,510534379,158533148,708092503,446293639}

    1

    Returns: 318817427

  29. {761433832,167977264,704313437,955589496,166269190,718428416,534270764,655287661,406520705,35908662,787252320,802007036,568410886,55304313,722804862,6247656,121309058,265155985,236192962,430861941,796298536,477001196,260648337,651527694,410772582,175279623,287005966,850288241,993646026,459217326}

    {619324204,175275648,868517003,617911560,815502689,181003294,540927032,942007202,159612760,453684732,183881773,915287933,507627734,897013072,816694390,385286836,224244216,868192690,851869623,45730972,781437201,35894162,190824995,108491929,728283856,508364419,404190237,927102317,765547674,704707959}

    {662665083,407741108,336593058,89478512,617100657,517518437,487505987,862493349,680666097,760469529,977867517,298314909,302606972,835344953,199995175,772908477,690216226,940729208,787199720,998842959,198407574,640917515,968931522,532959444,409188355,511578514,556352558,207591460,415788839,205376373}

    2

    Returns: 80050481

  30. {81659919,392483807,431273216,905309764,771861366,959421915,181314248,481134233,256946796,821177063,289663560,537900808,624967563,158766878,753692289,398804447,605449631,915832225,968380218,424240002,868385465,666027219,70305322,346872472,682895400,329030079,187184984,28673470,280043751,697229843,50627748}

    {49879485,851804378,656617871,895142457,906513264,66099617,517425892,419315506,808188685,3556492,261496948,464944314,492835760,293519268,397880957,153513091,766475330,171537305,350538260,452146056,591828051,343817228,707693133,954634502,364738624,401381340,901317844,114654217,145348083,964449871,432421054}

    {659160089,861278938,121463266,555142298,386543889,766837120,85100073,22291753,723673448,706109111,408044078,137268317,908280334,359079397,878792082,302724347,41035288,72254712,358199039,133332968,880707777,437636231,684887780,180177721,517500862,986173902,68237540,652682849,136349409,588735635,903605868}

    3

    Returns: 858600734

  31. {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,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}

    4

    Returns: 0

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

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

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

    2

    Returns: 865776271

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

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

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

    5

    Returns: 682457197

  34. {734676044,846115185,344485092,819331951,170196157,16899359,968494346,937023882,882932318,187822662,184465310,58605001,483173833,296003506,217043803,805140547,611538887,940780840,318432915,762525597,379224696,426249244,739819170,84631935,45185329,850783589,104385704,792501813,310477390,122157462,122341778,964184158}

    {863870884,478771178,194229495,606062789,599355030,372605667,118567136,962173977,513136317,541879690,505039319,887967373,578547435,141805443,202819839,380582156,106325674,82541053,6450730,266676060,195643959,246005190,544522950,361472136,801029521,227275987,135042980,8156802,920747273,604891367,497308649,73247920}

    {839812773,306409292,7030726,392615848,266686469,804229600,569372159,447893245,913030202,53451018,809097211,532518080,426399087,630270054,990313512,273335187,598637818,761821302,721561543,51651889,795799087,600986669,397577470,276830552,266463883,763668749,828251086,610156586,119562271,763730918,472589412,679315016}

    3

    Returns: 1120854503

  35. {833684521,276585791,633273982,708847050,869643678,761723797,388208087,791127821,711672803,165209941,793397775,49786923,546255149,808956757,369160398,410174690,140730124,535222512,545521927,675209543,505672051,474227808,402351579,696724747,396687882,147110558,754313035,259906686,435064545,825733735,583524634,497241746,559062009}

    {17759904,738897323,82332696,58706994,214628480,704981638,851396158,337970992,99610998,552089869,467898817,968258110,814543533,335078952,629597736,885099185,593513227,441318668,134042839,811605980,583681111,995349335,286550262,892006649,273696454,615085855,580067539,210000478,335489568,699872579,34581462,186816399,856997644}

    {666309749,696336203,546806749,118316581,447391365,696180413,945783673,359216584,190339112,734780576,506038682,493221512,451212679,840342855,101105552,913924642,982788707,532933330,166266774,825416482,808942682,831067772,729910062,552028450,229685374,769297100,526006398,861835768,859992882,71391011,82257689,59942460,435396007}

    1

    Returns: 3350071585

  36. {1,1,3,3,3,1,1,2,3,2,1,2,1,1,2,1,3,1,1,2,1,2,3,2,2,3,3,1,1,1,3,1,3}

    {3,1,2,1,2,2,2,1,1,3,3,1,1,2,1,3,2,2,3,3,2,1,2,1,2,1,3,2,1,1,3,3,2}

    {3,2,1,3,2,2,2,1,3,1,3,3,2,1,2,2,2,3,1,2,3,2,2,3,2,3,2,1,1,3,2,2,1}

    4

    Returns: 658576315

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

    {7,6,1,8,6,1,5,4,7,6,5,2,5,1,4,4,7,6,5,8,3,7,2,1,1,8,2,8,4,2,7,5,7}

    {7,1,1,7,2,8,1,2,1,3,8,1,5,2,3,5,4,7,8,1,2,8,4,8,7,7,2,1,8,4,1,5,2}

    7

    Returns: 3257729092

  38. {3,3,2,3,2,3,3,1,1,1,1,1,3,2,1,3,3,3,3,1,1,3,2,2,2,3,1,3,1,1,1,3,2,1}

    {2,3,3,3,3,3,1,3,3,1,3,2,2,3,3,1,1,1,3,3,1,2,1,3,2,2,1,2,1,1,2,1,2,2}

    {2,1,1,1,3,2,3,3,3,3,2,2,2,2,2,3,3,2,2,3,3,2,3,1,1,2,1,2,1,3,2,3,2,3}

    1

    Returns: 2354294664

  39. {1,1,1,4,4,2,1,3,1,4,2,3,4,4,2,1,2,3,3,3,2,3,3,2,2,3,3,1,2,2,3,3,4,2}

    {1,1,3,3,2,1,1,2,3,3,2,4,2,1,2,2,3,1,1,1,3,3,2,3,1,1,1,1,4,1,1,3,1,1}

    {3,2,1,1,2,1,3,1,1,2,4,1,3,4,1,2,4,4,4,2,1,1,1,2,4,3,1,2,3,3,3,4,2,2}

    2

    Returns: 12194480984

  40. {2,2,2,1,2,1,1,2,1,2,1,2,1,2,2,2,1,2,1,2,1,1,2,2,2,2,2,2,1,1,2,1,2,1}

    {1,2,2,2,1,1,2,2,1,2,2,1,1,1,2,1,2,2,2,1,1,1,1,2,1,2,2,1,2,2,2,1,1,2}

    {2,1,1,1,2,2,2,2,2,2,1,1,2,2,1,2,1,2,1,2,1,1,2,1,2,2,2,2,2,1,1,2,1,1}

    3

    Returns: 5814199213

  41. {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,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}

    4

    Returns: 0

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

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

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

    1

    Returns: 5079700518

  43. {64,40,61,5,48,66,15,46,39,100,90,63,100,22,82,68,97,6,80,31,18,31,65,64,64,3,54,98,63,44,55,47,94,91}

    {12,57,71,43,93,49,73,25,68,20,76,44,62,68,56,27,56,100,59,89,51,80,23,17,24,30,1,63,50,12,60,84,61,76}

    {79,26,84,70,1,20,5,72,46,71,58,15,32,100,45,5,38,82,46,77,20,23,75,49,82,13,31,30,41,26,79,93,38,31}

    2

    Returns: 11676837576

  44. {74,106,367,500,662,210,410,175,778,639,523,3,911,316,16,211,173,24,748,766,819,178,48,117,577,76,604,93,308,643,62,85,413,485}

    {289,836,593,738,687,78,801,549,72,928,451,724,162,58,160,939,32,915,930,359,420,908,481,523,305,488,495,502,63,363,655,34,767,486}

    {337,504,900,12,395,385,29,672,745,639,801,423,959,147,428,981,150,113,897,899,274,769,52,85,29,546,232,975,954,428,190,409,689,78}

    3

    Returns: 117537929

  45. {4023,4529,334,4157,9693,2291,9043,2753,4914,9651,4433,4435,9447,3389,7613,9965,294,3568,236,3997,7818,9279,5187,3697,9812,3032,9299,2388,6547,6249,1210,2879,4168}

    {977,2267,6942,6116,5546,2297,1566,7469,7286,3571,4672,9845,2320,3865,9477,360,3265,5612,9427,6572,44,5933,1989,6899,2419,5241,3267,6739,3227,661,9400,7116,2291}

    {11,8706,6258,5710,7084,7778,9785,7758,3137,1000,8750,2078,4259,482,1375,2235,5940,2692,6740,4375,2586,9368,3262,6250,2815,7916,7316,7885,5088,8194,2370,5375,4921}

    4

    Returns: 3916320271

  46. {72250,22992,81780,54381,83645,45845,11420,18409,67658,66204,99657,96314,41935,93070,69918,89462,60524,21286,13587,60662,7108,39996,58141,60057,58519,87288,81618,79834,66068,2461,77619,97846,47187,85752}

    {81427,1561,27342,73963,79560,94491,85981,85767,57072,35013,2602,72539,79096,98876,20359,26841,8670,58661,97935,93710,61168,14077,60343,53700,58407,13100,56797,26216,72296,68768,56659,73236,39294,5693}

    {79576,82471,79784,74177,33329,28179,50531,27887,70579,24738,9217,98704,86056,15217,31647,74652,7210,95699,91056,19021,4525,21751,22895,7059,23977,2497,63029,81087,23704,96298,37808,42001,97889,12958}

    5

    Returns: 12430706062

  47. {211083,403685,712873,410988,968348,849211,936924,497571,760258,752964,98558,276123,439223,159649,789342,3155,368062,251721,231585,631992,623108,526440,890423,298200,543401,804502,469745,72363,625637,446077,895544,16449,830542,996626}

    {408337,23984,482078,489529,186429,520410,862975,857486,568447,689069,790205,352976,941421,737254,6578,63622,994743,992266,541304,135677,805401,218348,283239,63583,512804,946643,169326,692650,10863,150848,229337,954629,248615,497430}

    {592668,36617,210432,323994,610643,798511,143589,60231,23175,605863,56738,374078,509176,633629,577001,212161,218153,788656,290202,946971,812660,668615,582690,261117,753670,449461,384455,913917,567021,297362,550794,710387,367636,821599}

    6

    Returns: 10268300828

  48. {4166689,9175572,595582,4718198,4519909,2244083,3711449,1979313,2550261,3307024,3590517,2142674,9800945,4429743,6678235,7859375,8840065,4452276,6909299,1447869,496708,9455503,9924164,8974502,3172517,6833876,5959132,1930739,1240703,2260926,5632461,4365575,2555903}

    {2714023,8245494,3567224,5689435,6212749,5581622,8784799,1143331,7687508,6209133,7203926,9814996,3802323,1544897,608994,909132,1261009,3065745,1008773,9765864,487618,3164148,2147773,9444079,5317357,985046,5134609,6396389,807454,8379426,2255582,2907936,4775969}

    {6771820,7605818,4545817,5512861,3149529,9004105,2585982,5475636,7795435,1579445,5697603,1357571,9803598,4843084,4469276,1443857,7764745,6329751,7035590,9658710,8709348,9028292,3037075,8511597,5737295,7339617,254345,3285494,9181000,1058536,8574447,7924724,8244714}

    7

    Returns: 386177150

  49. {695729884,84042635,811528693,623128758,995350244,804223280,47321554,793526352,140942191,971189003,858463443,172636631,384116310,646195459,424012432,444817642,991087380,596997556,234690666,218701849,114392112,333152974,112333236,789440297,98203400,184565303,419268873,366728678,211590713,576357004,471861129,538230994,802014389,940400564}

    {713363120,348437602,150013814,567296424,357747707,669469597,266200608,833118857,860201347,748873319,750038877,784575587,731591276,323510145,27449943,465347653,859648630,384393347,770896758,780302162,970295353,320649167,656945013,602231665,433206776,995869133,917672500,219681568,322172690,479624481,191724889,838645785,188898452,714555609}

    {640320172,514620148,656655249,794397738,217613766,655600967,758457465,840667455,914785629,111937230,625000323,899234606,690229463,713741386,735159559,153820070,758921009,942130462,210119546,696004257,516400934,426155048,145724996,166904148,267913063,442488233,726746567,883541860,383977768,580287531,344226996,230238643,299210380,614563924}

    1

    Returns: 1710422893

  50. {441081013,723103813,724141549,218885923,938016863,937381282,234509005,510510423,465397487,596486580,544878277,615758148,939990304,100021178,603070897,425674946,949161837,851896445,130470186,571698827,229119359,803075509,724007287,290739102,618274132,417813139,578490517,767909964,169139563,627092501,36333052,556530004,434611450,182172467}

    {865127248,346067240,87151655,957231922,227873277,431355663,458840406,176432357,444459268,889106039,673415967,43202486,986803784,563218133,432567697,929166201,396492226,830933809,972329704,36161417,76831,241463912,175335327,889496340,219671019,311662741,209705741,538785890,443241837,740757827,671179631,245311120,759451557,385218309}

    {139983755,628276958,681170653,280638570,147975643,384067823,18875431,405882747,66578305,683562812,804387525,527246153,240322507,921773247,747504873,403402719,930920154,320210769,445146773,172005047,163425565,7288574,6941841,236909435,401182208,561912779,55912535,497420328,537146151,932785286,395709668,424411737,984372367,485816732}

    2

    Returns: 11737578376

  51. {629970168,860088960,299638234,636373918,438123465,875802632,282400117,864450399,760105762,716832330,958117784,301755195,65770194,499519505,233414271,789694468,913249181,286921068,398779534,975189508,562893690,588566175,626583863,375465156,284992003,872202900,932459889,858530,827141480,260370094,343873950,92524934,508674947,8871301}

    {251574193,281893444,970856876,389052179,501724587,430356241,794155438,707628797,753001818,134916295,426356179,147897874,747418494,807146186,734226841,87335967,840196642,980004073,237075796,680407907,936227353,456368316,711428205,141885802,589660255,741310496,672289466,231773339,201710904,789275670,858845606,243858755,51536127,770804910}

    {161752226,366518505,795639089,967961979,147843285,968518833,976696665,36052334,978438071,812733682,932741972,642676779,355834092,661435920,506756182,132625740,53714210,588051702,238123879,302412542,666010497,247965884,534931858,484873856,631635670,52153125,92977794,64195837,170837322,712038931,915796522,404532237,235131013,980298086}

    3

    Returns: 7094742811

  52. {641689021,549164393,957765024,402637009,307904928,961972795,118935007,875743534,465353036,831071814,335771627,728843746,602290980,147110385,809696250,310443319,340897465,25132602,643140131,201321354,487637620,663913808,737207833,76253017,818071332,851199687,150850056,318342621,836094499,577538205,378194011,370521554,384283615,428487508}

    {608431601,480562669,680739093,648375049,34777382,771077948,872652331,619987645,839891026,480284871,538000382,304107049,642813980,139070241,840325901,536162897,233667870,641494271,374404029,767889422,727686542,14501037,63864284,496954051,220395819,737930986,16276150,36275587,134637909,805558234,791756398,418589242,712455621,738555789}

    {725216340,546548932,689811917,945234137,282099332,941293709,778322173,933601905,696176687,519200322,432492843,67365097,171219097,818642891,340163644,812912688,344669176,684394797,562005556,831541724,856431813,610697604,252901856,513527930,492825548,358746312,486357325,446801607,438757240,406436183,825231991,599258266,356843589,390000804}

    4

    Returns: 3278907680

  53. {659782336,755963885,607709481,806858745,250938535,858446337,522356909,133755457,633770709,484567035,568926932,747685405,788160841,465569175,510388663,489533180,546659970,469354771,962839286,995432581,593459706,195490401,206039604,484083128,365783455,138356434,731637612,627750663,173891107,138860918,166032733,262032959,962345107,221624342}

    {354335250,885138411,227389113,365969680,764345655,525087899,656210344,713156026,281961661,101951702,126240209,189671610,729040018,194371251,636528859,593110528,248908265,459507053,513831143,736845011,212540042,726605523,45054995,328646691,342822129,926168925,747483465,919856429,806638486,856979621,266431677,623230578,665404033,568567734}

    {690277536,238856461,525635373,439079480,914673876,148582054,580431513,466449016,978877037,544256309,615121483,685051411,342610447,851359009,260492319,371476416,133710878,767674248,81486313,399478518,765925153,303708503,816923954,976954549,587001001,830680812,947334014,85529608,444163449,502522789,865079284,530360621,692597439,648646457}

    5

    Returns: 3487367123

  54. {483370168,361973650,167818951,782606602,912939329,831211164,230718365,797330247,211898103,27888085,399964203,574714397,886186678,897979824,220932093,122962901,725588696,477448780,719850465,995441701,562597406,212375658,824657588,658633453,748521141,690148005,528882365,418296954,183119354,451041625,125551831,606392869,689766359,96017173}

    {447023478,673347299,745254359,571558910,752367744,378865306,79801719,572062618,870776896,41469820,919121629,632008666,158764678,234334118,847557477,146116058,508959651,226779693,999209882,202054241,573049333,627185788,934046664,585756541,36434229,787282276,733823055,362364206,426015187,861451428,339340111,177503822,518611733,81575235}

    {163778715,428210052,242607569,127381075,945594766,398803304,461569429,72833382,531096533,735220046,146578640,415478194,259246195,403716589,793775257,134636566,676148107,940551721,804856910,887442705,253811323,657370309,893891792,634660664,585890579,475459465,853565832,541833685,602487831,836176090,475691399,780589799,980302287,506948852}

    6

    Returns: 4426749512

  55. {170813236,72206247,912662251,248191095,782275322,965750257,71610006,56229549,416743499,151882633,465059125,371776897,741121592,960808090,393118094,537061456,504378796,691724817,748652449,693555089,995138830,524176601,743055522,36245526,291842540,428496865,878421706,517378723,472241592,768437227,454258936,805265511,602411120,158242678}

    {259450937,87880203,626220048,55726594,326206433,424790872,951101702,65075044,826847239,269161423,83768165,458357005,674692789,970643962,970180345,501463911,573017316,893363168,175553304,728026914,788150110,276203055,656701374,595654163,544164079,3984823,770341034,597695958,478366492,701745265,852574814,48047663,718923849,655561893}

    {324293971,420658800,236847085,111921974,152283442,529881558,581979886,768318573,496534665,369717652,341596995,519213823,726461980,198539134,662682973,4840692,627310117,28177722,778658694,918926943,683780665,164690154,219791036,348184683,398293201,597243317,707490336,989091040,314823248,828293963,691307188,279129671,175919934,464108048}

    7

    Returns: 7971004472

  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,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}

    1

    Returns: 0

  57. {1000000000,1000000000,1000000000,999999999,1000000000,1000000000,999999999,1000000000,999999999,999999999,1000000000,1000000000,1000000000,1000000000,999999999,999999999,999999999,999999999,999999999,999999999,999999999,1000000000,1000000000,1000000000,999999999,1000000000,999999999,999999999,1000000000,1000000000,1000000000,999999999,999999999,999999999}

    {1000000000,1000000000,999999999,1000000000,999999999,999999999,1000000000,1000000000,1000000000,1000000000,1000000000,1000000000,1000000000,1000000000,999999999,1000000000,1000000000,1000000000,1000000000,1000000000,999999999,1000000000,1000000000,1000000000,999999999,999999999,1000000000,999999999,999999999,999999999,999999999,999999999,999999999,999999999}

    {999999999,999999999,999999999,1000000000,999999999,1000000000,1000000000,1000000000,1000000000,999999999,1000000000,1000000000,1000000000,1000000000,1000000000,999999999,999999999,999999999,999999999,999999999,999999999,1000000000,999999999,1000000000,999999999,999999999,999999999,1000000000,999999999,1000000000,1000000000,1000000000,999999999,1000000000}

    2

    Returns: 1944622076

  58. {1000000000,999999998,1000000000,999999992,999999998,999999992,999999993,999999993,999999995,999999993,999999992,999999999,999999999,999999993,999999992,999999999,999999993,999999993,999999996,999999994,999999996,999999991,999999998,999999991,999999993,999999992,999999998,999999991,999999999,999999995,999999998,999999998,999999995,999999998}

    {999999998,999999998,999999996,1000000000,999999993,999999991,999999999,999999993,999999999,999999997,999999996,999999992,1000000000,999999995,999999999,999999992,999999999,999999993,999999991,999999996,999999995,999999991,999999998,999999998,999999994,999999996,999999999,999999999,999999994,999999999,999999993,999999991,999999994,999999995}

    {999999991,999999991,999999993,1000000000,999999993,999999995,999999998,999999997,999999995,1000000000,999999991,1000000000,1000000000,999999992,999999995,999999997,999999994,999999997,999999992,999999994,999999995,999999994,999999998,999999994,999999998,999999995,999999997,999999994,999999999,999999991,1000000000,999999995,999999992,999999994}

    3

    Returns: 3047432883

  59. {999999930,999999975,999999906,999999983,999999965,999999925,999999976,999999941,999999981,999999994,999999939,999999945,999999956,999999943,999999909,999999928,999999933,999999949,999999933,999999988,999999901,999999922,999999992,999999994,999999990,999999949,999999944,999999954,999999954,999999988,999999902,999999937,999999902,999999998}

    {999999931,999999945,999999976,999999925,999999938,999999953,999999976,999999903,999999910,999999908,999999974,999999977,999999939,999999956,999999951,999999942,999999962,999999998,999999975,999999945,999999910,999999922,999999924,999999902,999999962,999999938,999999984,999999909,999999915,999999960,999999984,999999978,999999955,999999999}

    {999999917,999999914,999999930,999999995,999999943,999999996,999999983,999999949,999999988,999999915,1000000000,999999937,999999926,999999973,999999973,999999918,1000000000,999999979,999999907,999999941,999999994,999999962,999999902,999999960,999999995,999999931,999999977,999999902,999999946,999999962,999999946,999999913,999999954,999999952}

    4

    Returns: 6209058887

  60. {999991791,999998069,999997338,999992179,999993439,999999063,999999758,999998869,999992996,999995987,999998790,999993293,999990124,999997567,999990758,999990396,999990255,999993107,999999570,999998034,999997090,999995489,999999840,999997343,999999687,999994639,999993877,999999618,999993437,999993620,999992156,999999138,999992967,999994590}

    {999997805,999995790,999992424,999999636,999995911,999996009,999992077,999993426,999993842,999993495,999997325,999990162,999998210,999990502,999995228,999994959,999996570,999999208,999999930,999997261,999993955,999996829,999990417,999996420,999996521,999993593,999992189,999995446,999993365,999990583,999997896,999996748,999990867,999993064}

    {999999483,999995695,999991085,999998282,999993942,999999929,999991627,999991692,999998151,999993553,999992180,999994226,999992398,999991270,999993530,999992563,999995667,999990370,999995367,999995398,999998952,999990661,999998763,999999156,999996843,999997569,999993343,999994282,999996186,999999600,999992249,999997887,999993666,999994928}

    5

    Returns: 10466555727

  61. {925219784,913373449,961179602,984305621,906546349,910773173,929807017,988111094,964153412,979926996,949907666,974123133,995540873,970737910,930384792,995386702,958034443,918208438,983939867,975673451,922769524,993040073,982970319,904771133,943984686,963677226,919972049,976908593,991982066,923925425,952048423,924246970,915106864,945491454}

    {934414978,972188591,978036483,915735773,989468485,983944678,985388193,946384620,904893229,958537014,966650694,977280322,947832663,979814582,969248725,959647825,956734176,995933402,919867740,924583424,926715835,922470108,918990597,913017288,903382037,971557128,956349542,919687849,935768341,962653154,927754297,989347594,906173441,946528568}

    {936968026,991936266,939316399,954838290,971556731,957467985,988084949,916849023,962808339,903672895,965464758,979766078,976057403,936930254,936897272,982148416,957503608,926057670,983335820,901490403,991465026,977874908,928920248,928296201,961855166,955105330,972636672,991466632,900771677,970731582,977734132,919382782,961937228,914269448}

    6

    Returns: 6351106515

  62. {999999605,999999294,999999319,999999020,999999481,999999775,999999372,999999908,999999887,999999162,999999965,999999729,999999998,999999470,999999050,999999236,999999349,999999504,999999650,999999276,999999664,999999812,999999425,999999614,999999043,999999058,999999269,999999525,999999323,999999745,999999460,999999581,999999211,999999577}

    {999955049,999947884,999999390,999910241,999966852,999982572,999968465,999907282,999951440,999942166,999932004,999907231,999986331,999992066,999954374,999938251,999985901,999971184,999978477,999963184,999976506,999967966,999992632,999941543,999962071,999903205,999986419,999984310,999995654,999901232,999905718,999927415,999959788,999933914}

    {999939794,999923197,999997368,999961871,999994009,999982247,999909155,999935686,999968237,999912887,999937342,999912510,999998659,999946134,999983492,999968800,999965579,999941871,999946549,999980115,999917115,999914206,999972974,999943901,999957046,999942182,999900644,999994920,999922297,999959229,999926655,999928446,999918947,999953187}

    7

    Returns: 17178193068

  63. {999999993,999999994,999999992,1000000000,999999993,999999993,999999996,999999991,1000000000,999999995,999999994,999999992,999999994,999999995,999999993,999999998,999999993,999999999,999999995,999999997,999999994,999999998,999999999,1000000000,1000000000,999999998,999999999,999999996,999999997,999999998,999999991,999999992,999999994,999999995}

    {993475273,995376802,998796837,999463110,995108164,997113530,994884784,997282006,996338068,993656146,992640679,992542570,995606587,995729277,996851020,999360794,992047155,996749747,994483488,990731176,994760908,995297181,999798704,991303943,990457335,993130046,993347019,995809319,995346141,997034625,993046417,994562620,994281194,995415581}

    {999523247,999575792,990451905,996544531,994514864,992038967,992180727,993995987,991057720,994789939,996599368,997364040,997898042,990504691,990171044,993423976,992688189,990320528,995384174,999446729,996587285,993327539,997392745,995918618,990158334,992835193,996384130,999530475,990943254,998051631,994838647,994715880,993474230,991434362}

    7

    Returns: 17178193068

  64. {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}

    {999999999,1000000000,999999999,999999999,999999999,999999999,1000000000,1000000000,1000000000,1000000000,1000000000,999999999,1000000000,999999999,999999999,1000000000,1000000000,1000000000,1000000000,1000000000,1000000000,1000000000,999999999,999999999,1000000000,1000000000,1000000000,999999999,999999999,1000000000,999999999,999999999,999999999}

    {999999999,1000000000,1000000000,1000000000,1000000000,999999999,999999999,999999999,999999999,999999999,1000000000,1000000000,999999999,1000000000,1000000000,999999999,1000000000,1000000000,999999999,1000000000,1000000000,999999999,1000000000,999999999,999999999,999999999,1000000000,999999999,1000000000,1000000000,999999999,1000000000,1000000000}

    1

    Returns: 8589410560

  65. {1000000000,1000000000,999999999,999999999,1000000000,999999999,1000000000,1000000000,1000000000,1000000000,1000000000,999999999,1000000000,999999999,1000000000,999999999,1000000000,1000000000,999999999,1000000000,999999999,999999999,999999999,999999999,1000000000,999999999,999999999,1000000000,1000000000,1000000000,999999999,1000000000,1000000000}

    {1000000000,1000000000,999999999,1000000000,999999999,1000000000,999999999,999999999,999999999,999999999,1000000000,1000000000,999999999,1000000000,999999999,1000000000,999999999,999999999,999999999,999999999,1000000000,1000000000,999999999,1000000000,999999999,1000000000,1000000000,1000000000,1000000000,999999999,999999999,1000000000,1000000000}

    {999999999,1000000000,1000000000,1000000000,999999999,999999999,1000000000,999999999,999999999,999999999,1000000000,1000000000,999999999,999999999,1000000000,1000000000,999999999,1000000000,1000000000,1000000000,1000000000,999999999,1000000000,1000000000,999999999,999999999,1000000000,999999999,1000000000,999999999,999999999,1000000000,1000000000}

    2

    Returns: 3529420792

  66. {999036646,999236019,999747545,999495195,999447226,999311606,999375659,999719511,999546971,999997209,999926094,999813147,999904285,999320950,999808391,999245885,999525798,999404353,999570585,999211497,999636666,999441430,999962873,999781218,999395555,999307311,999547058,999137444,999288956,999887925,999556242,999364136,999415324}

    {999991952,999994178,999991487,999994712,999993523,999997972,999999532,999998452,999990101,999994930,999996735,999997637,999996824,999995009,999998855,999992677,999996984,999997705,999998629,999990601,999996987,999991290,999991319,999999081,999997751,999997929,999999727,999998220,999991967,999992589,999993283,999990334,999997320}

    {999998766,999994739,999990306,999997607,999998669,999992297,999993274,999990465,999992371,999995326,999990998,999997767,999993371,999998739,999999063,999996658,999996030,999993245,999992892,999999824,999992269,999998655,999996446,999995987,999995132,999991841,999996569,999998567,999998248,999994623,999994613,999990243,999994616}

    3

    Returns: 0

  67. {922520367,969675025,955988354,907361181,982802776,913452908,928194812,927326794,926841039,936196104,993714523,967405630,975815057,996235763,911230481,926963626,903561657,960829551,934237861,923325122,936821744,979979468,963416009,936893849,984604390,900861656,905178374,907287634,901179876,939404014,933415154,906231104,986893286}

    {969328994,964746721,962870561,996130697,938928921,979412968,932442249,912650832,924331693,910602320,903478371,998637997,977733074,998114406,972052696,950241374,916232183,911313052,950566349,907245820,930325095,905239099,905452095,941872551,993592641,976624850,918316323,908578069,910768022,934241924,969465426,989789650,925366093}

    {999389918,991865074,949702650,934007774,965937281,927971135,922283267,966491872,977231028,909616395,937429608,994677802,949704932,937338906,979370218,948087174,998931501,989139091,986270374,983244437,987146847,987327298,908765548,996499865,935252591,980641023,997992753,957619457,975356978,978554764,999535395,935065045,970642200}

    6

    Returns: 14025987

  68. {999999946,999999192,999999381,999999798,999999765,999999853,999999955,999999796,999999766,999999665,999999487,999999525,999999479,999999014,999999910,999999990,999999777,999999657,999999374,999999213,999999274,999999396,999999764,999999873,999999879,999999922,999999275,999999310,999999068,999999668,999999301,999999119,999999911}

    {999993078,999997595,999994198,999999842,999991544,999993423,999998414,999994087,999991264,999996346,999992728,999994183,999993196,999993441,999994573,999996368,999998767,999991412,999996150,999999001,999996675,999995092,999998304,999991483,999999466,999995213,999994527,999995261,999999184,999997923,999991709,999993916,999994877}

    {999999606,999997304,999998710,999994492,999992205,999990374,999997397,999993332,999992278,999994793,999992776,999997388,999993559,999995611,999997376,999991029,999993154,999999918,999995824,999993066,999998127,999995683,999990847,999994364,999999958,999999927,999993565,999999931,999991885,999994809,999998060,999994896,999999051}

    7

    Returns: 8588542750

  69. {930212988,912736470,917359190,964824505,947753830,900986917,978507021,996560916,924550420,985592479,994194443,939960958,902794073,900921845,976901149,932871922,959186861,964635551,956980103,915521270,984467018,954459712,922229580,984520943,919860000,907674212,916710747,953313234,907877047,933612708,929417626,967967544,962833891,954864940}

    {930207684,912728602,917351628,964815720,947748080,900983757,978498446,996557895,924542619,985592371,994186535,939960848,902791426,900920578,976900114,932866424,959181147,964629964,956971324,915516980,984462622,954455931,922225808,984516136,919858606,907670154,916703047,953309806,907875693,933605762,929417301,967966153,962831553,954863117}

    {930137062,912711283,917326688,964804988,947750259,900965556,978497366,996533822,924456406,985572985,994186322,939949183,902713018,900882924,976880515,932817938,959116826,964568517,956893713,915518922,984415395,954406017,922227231,984516238,919855736,907608334,916663473,953223692,907854297,933592774,929381971,967931792,962819746,954859650}

    1

    Returns: 17179869183

  70. {718363706, 301821325, 22580993, 401267988, 451031757, 52701269, 491774213, 902340282, 603036990, 373317112, 816081384, 840776819, 990717274, 971031453, 97764255, 305249690, 550361294, 350070857, 503421528, 83011238, 826682531, 895474921, 21584617, 936487124, 482230962, 211132218, 875763532, 93499375, 687625090, 72189505, 993227581, 869855367, 380900329, 982592351 }

    {231521567, 603643033, 201316095, 81660777, 998066908, 761151082, 17179704, 483675690, 876708688, 596146437, 526870865, 301371220, 294001384, 909255772, 691043866, 323713725, 8576250, 696318266, 278991063, 372405786, 677967044, 51955604, 336643544, 371887519, 74159623, 270884027, 802976409, 134641003, 551452693, 595906739, 848827375, 548337408, 639803553, 517212901 }

    {762671115, 79953872, 841233337, 428566851, 667540771, 102828712, 620971909, 139867077, 496417421, 691045061, 927357259, 386721123, 588306064, 191170084, 13635426, 412342748, 146777132, 166194702, 523277552, 802367035, 247699507, 885160784, 310993337, 686601380, 882803055, 587202841, 291395483, 3556875, 812307681, 245380324, 43479843, 400257065, 806775460, 56175891 }

    7

    Returns: 13133031813


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: