title: Minimum Cost Make Array Size 1 Removing Larger Pairs
signature: minimumCostMakeArraySize1RemovingLargerPairs :: [Integer] -> Integer -> Integer
  minimumCostMakeArraySize1RemovingLargerPairs a n = 
test_code: import Text.Printf
  import Control.Exception (catch, SomeException)
  import Data.Typeable
  import qualified Data.List as List
  import qualified Data.Map as Map
  import qualified Data.Set as Set
  
  -- SOLUTION CODE
  -- ============================================
  
  PLACEHOLDER_CODE_BODY
  
  -- TESTING CODE 
  -- ============================================
  validateSolution :: Integer -> Integer -> Bool
  validateSolution actual expected = do
      actual == expected
  
  
  driver :: [Integer] -> Integer -> Integer -> String
  driver a n expected = do
      if (validateSolution (PLACEHOLDER_FN_NAME a n) expected)
          then "PASSED"
      else "FAILED"
  
  main = do
      printf "TEST-0...%s\n" (driver ([1, 2, 3, 4, 7, 8, 10, 10, 16, 20, 22, 22, 23, 23, 23, 27, 29, 32, 35, 39, 41, 46, 51, 53, 54, 59, 59, 60, 61, 69, 70, 70, 79, 79, 81, 84, 90, 91, 98]) (25) (24) )
  
      printf "TEST-1...%s\n" (driver ([-6, 10]) (1) (0) )
  
      printf "TEST-2...%s\n" (driver ([0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) (15) (0) )
  
      printf "TEST-3...%s\n" (driver ([20, 61, 92, 45, 75, 26, 83, 5, 85, 27, 39, 88, 36, 39, 83, 41, 56, 77, 39, 69, 72, 98, 39, 15, 29, 69, 64, 92, 96, 49, 59, 62, 53, 82, 40, 37, 29, 41]) (23) (110) )
  
      printf "TEST-4...%s\n" (driver ([-88, -60, -60, -58, -56, -56, -46, -44, -40, -38, -32, -28, -22, -18, -12, -4, -2, 10, 24, 24, 28, 38, 42, 46, 54, 64, 72, 74, 78, 96, 96]) (26) (-2200) )
  
      printf "TEST-5...%s\n" (driver ([0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1]) (39) (0) )
  
      printf "TEST-6...%s\n" (driver ([1, 4, 6, 9, 10, 12, 17, 17, 18, 21, 22, 26, 26, 31, 32, 33, 34, 39, 42, 43, 45, 46, 48, 50, 53, 53, 54, 55, 60, 61, 62, 63, 63, 64, 70, 70, 70, 71, 71, 78, 86, 88, 91, 92, 95, 95, 96, 97, 99]) (28) (27) )
  
      printf "TEST-7...%s\n" (driver ([-42, 44, -80, -60, 48, 66, 54, -76, 26, -74, -10, 46, -50, 42, -26, -24, -14, 36, -2, -26, 16, -10, 20, -88, -78]) (19) (-1584) )
  
      printf "TEST-8...%s\n" (driver ([0, 0, 0, 0, 1, 1, 1, 1, 1, 1]) (5) (0) )
  
      printf "TEST-9...%s\n" (driver ([65, 32, 66, 82, 86, 98, 15, 33, 57, 3, 73, 45, 90, 82, 33, 99, 44, 76, 50, 89, 5, 7, 64]) (22) (63) )
  
source_py: def minimum_cost_make_array_size_1_removing_larger_pairs(a, n):
      return ((n - 1) * min(a))
source_cpp: int minimum_cost_make_array_size_1_removing_larger_pairs(vector<int> a, int n) {
    return ( n - 1 ) * ( * min_element(a.begin(), a.end()) );
  }