title: Making Elements Of Two Arrays Same With Minimum Incrementdecrement
signature: makingElementsOfTwoArraysSameWithMinimumIncrementdecrement :: [Integer] -> [Integer] -> Integer -> Integer
  makingElementsOfTwoArraysSameWithMinimumIncrementdecrement a b 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 -> Integer -> String
  driver a b n expected = do
      if (validateSolution (PLACEHOLDER_FN_NAME a b n) expected)
          then "PASSED"
      else "FAILED"
  
  main = do
      printf "TEST-0...%s\n" (driver ([1, 6, 6, 7, 10, 11, 13, 18, 19, 19, 19, 31, 34, 37, 37, 40, 41, 41, 47, 47, 53, 54, 55, 55, 56, 56, 60, 60, 62, 62, 66, 73, 75, 76, 78, 81, 81, 85, 88, 90, 91, 92, 93, 95, 97, 98]) ([2, 2, 4, 7, 8, 8, 8, 8, 8, 9, 9, 12, 15, 16, 21, 25, 26, 27, 29, 34, 34, 35, 38, 40, 40, 44, 44, 47, 48, 54, 58, 61, 63, 64, 66, 69, 69, 70, 73, 74, 75, 76, 79, 80, 80, 93]) (23) (263) )
  
      printf "TEST-1...%s\n" (driver ([-32, -12, -6, 62, 78, 86]) ([-86, -60, 20, 32, 50, 52]) (4) (158) )
  
      printf "TEST-2...%s\n" (driver ([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1]) ([0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) (14) (4) )
  
      printf "TEST-3...%s\n" (driver ([74, 76]) ([16, 98]) (1) (58) )
  
      printf "TEST-4...%s\n" (driver ([-92, -90, -88, -84, -76, -54, -44, -42, -38, -30, 34, 42]) ([-80, -54, -34, 12, 14, 16, 16, 46, 50, 64, 84, 92]) (8) (506) )
  
      printf "TEST-5...%s\n" (driver ([0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) ([0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) (14) (0) )
  
      printf "TEST-6...%s\n" (driver ([4, 5, 6, 13, 16, 24, 36, 40, 40, 44, 47, 52, 58, 58, 59, 63, 66, 67, 69, 70, 74, 77, 81, 88, 89, 90, 94, 96]) ([1, 7, 10, 17, 21, 22, 22, 27, 36, 37, 39, 46, 52, 53, 56, 59, 65, 67, 70, 75, 78, 78, 79, 89, 89, 94, 96, 97]) (24) (105) )
  
      printf "TEST-7...%s\n" (driver ([-54, -36, -36, -16, -12, -10, -8, -2, 10, 22, 36, 40, 44, 50, 54, 66, 84, 92, 98]) ([-92, -76, -74, -62, -58, -26, -18, -10, -10, -10, -6, 22, 26, 50, 62, 78, 84, 86, 86]) (16) (392) )
  
      printf "TEST-8...%s\n" (driver ([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) ([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) (36) (5) )
  
      printf "TEST-9...%s\n" (driver ([3, 7, 8, 15, 19, 24, 26, 30, 32, 34, 37, 42, 43, 43, 55, 55, 55, 63, 64, 64, 76, 81, 88, 94]) ([3, 4, 11, 17, 17, 22, 28, 44, 63, 63, 65, 66, 69, 74, 80, 80, 81, 81, 81, 86, 90, 91, 96, 98]) (22) (354) )
  
source_py: def making_elements_of_two_arrays_same_with_minimum_incrementdecrement(a, b, n):
      a.sort(reverse=False)
      b.sort(reverse=False)
      result = 0
      for i in range(0, n, 1):
          if (a[i] > b[i]):
              result = (result + abs((a[i] - b[i])))
          elif (a[i] < b[i]):
              result = (result + abs((a[i] - b[i])))
      return result
source_cpp: int making_elements_of_two_arrays_same_with_minimum_incrementdecrement(vector<int> a, vector<int> b, int n) {
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    int result = 0;
    for ( int i = 0;
    i < n;
    ++ i ) {
      result = result + abs ( a [ i ] - b [ i ] );
    }
    return result;
  }