title: Permute Two Arrays Sum Every Pair Greater Equal K
signature: permuteTwoArraysSumEveryPairGreaterEqualK(a, b, n, k) {
test_code: import 'dart:convert';
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  bool validateSolution(bool actual, bool expected){
      return actual.toString() == expected.toString();
  }
  
  String driver(a, b, n, k, bool expected){
      try
      {
          if (validateSolution(PLACEHOLDER_FN_NAME(a, b, n, k), expected)){
              return "PASSED";
          }
          return "FAILED";
      }catch(exception_object){
          return exception_object.runtimeType.toString();
      }
  }
  
  int main() {
  
      print("TEST-0...${driver(
          [99, 97, 90, 88, 87, 70, 52, 52, 43, 40, 27, 25, 16, 12, 9], [4, 7, 11, 20, 34, 35, 36, 44, 46, 71, 72, 78, 85, 85, 91], 10, 7, 
          true)
      }");
  
      print("TEST-1...${driver(
          [94, 92, 92, 88, 74, 72, 70, 56, 42, 42, 30, 30, 20, 18, 14, 12, 10, 8, 6, -14, -26, -28, -42, -44, -48, -68, -74, -74, -76, -78, -80, -84, -86, -90, -90, -90, -92, -94, -96, -96, -98, -98], [-98, -86, -84, -80, -80, -78, -76, -76, -74, -72, -56, -50, -48, -44, -44, -42, -32, -32, -32, -22, -20, -18, -14, 8, 16, 16, 18, 24, 30, 40, 44, 50, 60, 62, 62, 68, 70, 76, 84, 94, 94, 96], 40, 38, 
          false)
      }");
  
      print("TEST-2...${driver(
          [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, 1, 1, 1, 1, 1, 1], 11, 15, 
          false)
      }");
  
      print("TEST-3...${driver(
          [97, 77, 75, 72, 71, 70, 69, 65, 59, 55, 51, 48, 47, 42, 35, 31, 26, 18, 16, 15, 15, 13, 11, 6, 3, 2], [4, 11, 12, 12, 14, 15, 20, 21, 36, 37, 38, 44, 45, 46, 48, 51, 60, 62, 65, 73, 78, 79, 81, 88, 89, 98], 25, 16, 
          true)
      }");
  
      print("TEST-4...${driver(
          [94, 92, 90, 90, 84, 84, 74, 72, 68, 58, 56, 56, 54, 52, 36, 32, 18, 18, 16, 16, 4, 2, -2, -4, -4, -20, -34, -40, -42, -46, -48, -52, -52, -52, -64, -66, -70, -72], [-94, -76, -74, -56, -54, -50, -46, -38, -26, -24, -24, -22, -16, -10, -6, -4, -4, 0, 0, 6, 12, 12, 18, 20, 38, 50, 52, 52, 54, 64, 64, 72, 72, 72, 76, 90, 96, 96], 26, 30, 
          false)
      }");
  
      print("TEST-5...${driver(
          [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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 13, 13, 
          false)
      }");
  
      print("TEST-6...${driver(
          [98, 96, 96, 94, 93, 92, 87, 82, 80, 80, 80, 79, 72, 72, 66, 66, 64, 58, 53, 48, 44, 37, 34, 32, 23, 21, 18, 17, 8], [11, 15, 17, 19, 23, 23, 26, 27, 36, 43, 46, 47, 55, 59, 63, 66, 77, 79, 79, 82, 85, 86, 86, 91, 91, 94, 94, 97, 99], 20, 14, 
          true)
      }");
  
      print("TEST-7...${driver(
          [94, 80, 78, 62, 52, 50, 32, 28, 24, 24, 22, 18, 18, 14, 14, 10, 10, -8, -14, -14, -16, -20, -22, -28, -38, -48, -50, -66, -78, -78, -80, -82, -88, -88, -98], [-96, -82, -80, -80, -66, -54, -46, -44, -40, -30, -16, -14, 2, 6, 12, 20, 24, 32, 36, 38, 42, 46, 52, 56, 62, 66, 70, 88, 88, 90, 90, 96, 96, 98, 98], 31, 24, 
          false)
      }");
  
      print("TEST-8...${driver(
          [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, 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], 31, 30, 
          false)
      }");
  
      print("TEST-9...${driver(
          [92, 91, 85, 75, 72, 67, 65, 58, 53, 45, 39, 33, 31, 13, 10, 10], [7, 12, 19, 21, 28, 34, 39, 40, 41, 69, 71, 71, 74, 78, 91, 92], 14, 8, 
          true)
      }");
  
      return 0;
  }
source_py: def permute_two_arrays_sum_every_pair_greater_equal_k(a, b, n, k):
      a.sort(reverse=True)
      b.sort()
      for i in range(n):
          if ((a[i] + b[i]) < k):
              return False
      return True
source_cpp: bool permute_two_arrays_sum_every_pair_greater_equal_k(vector<int> a, vector<int> b, int n, int k) {
    sort(a.begin(), a.end());
    sort(b.begin(), b.end(), greater < int > ( ) );
    for ( int i = 0;
    i < n;
    i ++ ) if ( a [ i ] + b [ i ] < k ) return false;
    return true;
  }