title: Making Elements Of Two Arrays Same With Minimum Incrementdecrement
signature: making_elements_of_two_arrays_same_with_minimum_incrementdecrement <- function(a, b, n) {
test_code: 
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  validate_solution <- function(actual, expected) {
      toString(actual)==toString(expected)
  }
  
  driver <- function(a, b, n, expected){
      if (validate_solution(PLACEHOLDER_FN_NAME(a, b, n), expected)){
          "PASSED"
      } else{
          "FAILED"
      }
  }
  
  main <- function() {
      cat(sprintf("TEST-0...%s\n",driver(
          list(1L, 6L, 6L, 7L, 10L, 11L, 13L, 18L, 19L, 19L, 19L, 31L, 34L, 37L, 37L, 40L, 41L, 41L, 47L, 47L, 53L, 54L, 55L, 55L, 56L, 56L, 60L, 60L, 62L, 62L, 66L, 73L, 75L, 76L, 78L, 81L, 81L, 85L, 88L, 90L, 91L, 92L, 93L, 95L, 97L, 98L), list(2L, 2L, 4L, 7L, 8L, 8L, 8L, 8L, 8L, 9L, 9L, 12L, 15L, 16L, 21L, 25L, 26L, 27L, 29L, 34L, 34L, 35L, 38L, 40L, 40L, 44L, 44L, 47L, 48L, 54L, 58L, 61L, 63L, 64L, 66L, 69L, 69L, 70L, 73L, 74L, 75L, 76L, 79L, 80L, 80L, 93L), 23L, 
          263L
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          list(-32L, -12L, -6L, 62L, 78L, 86L), list(-86L, -60L, 20L, 32L, 50L, 52L), 4L, 
          158L
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          list(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L), list(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), 14L, 
          4L
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          list(74L, 76L), list(16L, 98L), 1L, 
          58L
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          list(-92L, -90L, -88L, -84L, -76L, -54L, -44L, -42L, -38L, -30L, 34L, 42L), list(-80L, -54L, -34L, 12L, 14L, 16L, 16L, 46L, 50L, 64L, 84L, 92L), 8L, 
          506L
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          list(0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), list(0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), 14L, 
          0L
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          list(4L, 5L, 6L, 13L, 16L, 24L, 36L, 40L, 40L, 44L, 47L, 52L, 58L, 58L, 59L, 63L, 66L, 67L, 69L, 70L, 74L, 77L, 81L, 88L, 89L, 90L, 94L, 96L), list(1L, 7L, 10L, 17L, 21L, 22L, 22L, 27L, 36L, 37L, 39L, 46L, 52L, 53L, 56L, 59L, 65L, 67L, 70L, 75L, 78L, 78L, 79L, 89L, 89L, 94L, 96L, 97L), 24L, 
          105L
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          list(-54L, -36L, -36L, -16L, -12L, -10L, -8L, -2L, 10L, 22L, 36L, 40L, 44L, 50L, 54L, 66L, 84L, 92L, 98L), list(-92L, -76L, -74L, -62L, -58L, -26L, -18L, -10L, -10L, -10L, -6L, 22L, 26L, 50L, 62L, 78L, 84L, 86L, 86L), 16L, 
          392L
      )))
  
      cat(sprintf("TEST-8...%s\n",driver(
          list(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), list(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), 36L, 
          5L
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          list(3L, 7L, 8L, 15L, 19L, 24L, 26L, 30L, 32L, 34L, 37L, 42L, 43L, 43L, 55L, 55L, 55L, 63L, 64L, 64L, 76L, 81L, 88L, 94L), list(3L, 4L, 11L, 17L, 17L, 22L, 28L, 44L, 63L, 63L, 65L, 66L, 69L, 74L, 80L, 80L, 81L, 81L, 81L, 86L, 90L, 91L, 96L, 98L), 22L, 
          354L
      )))
  
  }
  
  main()
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;
  }