title: Making Elements Of Two Arrays Same With Minimum Incrementdecrement
signature: def makingElementsOfTwoArraysSameWithMinimumIncrementdecrement(a: List[Int], b: List[Int], n: Int) = {
test_code: import scala.collection.mutable.HashMap
  import scala.collection.immutable.HashSet
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  
  // TESTING CODE 
  // ============================================
  def validateSolution(actual: Int , expected: Int): Boolean = {
      actual.toString == expected.toString
  }
  
  def driver(a: List[Int], b: List[Int], n: Int, expected: Int): String = {
      try {
          if (validateSolution(PLACEHOLDER_FN_NAME(a, b, n),expected)) {
              "PASSED"
          } else{
              "FAILED"
          }
      }catch{
          case e: Exception => {e.getClass.getName}
      }
  
  }
  object QuestionEvaluator extends App {
  
      println(s"TEST-0...${driver(
        List(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), List(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    
      )}")   
  
  
      println(s"TEST-1...${driver(
        List(-32, -12, -6, 62, 78, 86), List(-86, -60, 20, 32, 50, 52), 4, 
        158    
      )}")   
  
  
      println(s"TEST-2...${driver(
        List(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1), List(0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), 14, 
        4    
      )}")   
  
  
      println(s"TEST-3...${driver(
        List(74, 76), List(16, 98), 1, 
        58    
      )}")   
  
  
      println(s"TEST-4...${driver(
        List(-92, -90, -88, -84, -76, -54, -44, -42, -38, -30, 34, 42), List(-80, -54, -34, 12, 14, 16, 16, 46, 50, 64, 84, 92), 8, 
        506    
      )}")   
  
  
      println(s"TEST-5...${driver(
        List(0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), List(0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), 14, 
        0    
      )}")   
  
  
      println(s"TEST-6...${driver(
        List(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), List(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    
      )}")   
  
  
      println(s"TEST-7...${driver(
        List(-54, -36, -36, -16, -12, -10, -8, -2, 10, 22, 36, 40, 44, 50, 54, 66, 84, 92, 98), List(-92, -76, -74, -62, -58, -26, -18, -10, -10, -10, -6, 22, 26, 50, 62, 78, 84, 86, 86), 16, 
        392    
      )}")   
  
  
      println(s"TEST-8...${driver(
        List(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), List(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    
      )}")   
  
  
      println(s"TEST-9...${driver(
        List(3, 7, 8, 15, 19, 24, 26, 30, 32, 34, 37, 42, 43, 43, 55, 55, 55, 63, 64, 64, 76, 81, 88, 94), List(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;
  }