title: Permute Two Arrays Sum Every Pair Greater Equal K
signature: def permute_two_arrays_sum_every_pair_greater_equal_k(a, b, n, k):
test_code: import array
  import bisect
  import collections
  import datetime
  import functools
  import heapq
  import itertools
  import math
  import queue
  import re
  import string
  import sys
  from typing import Any, Dict, List, Optional, Set
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  def validate_solution(actual, expected):
      return actual == expected
  
  def driver(a, b, n, k, expected):
      try:
          if validate_solution(PLACEHOLDER_FN_NAME(
              a, b, n, k),
              expected
          ):
              return "PASSED"
          return "FAILED"
      except Exception as exception_obj:
          return type(exception_obj).__name__
      
  if __name__ == "__main__":
      result = 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(f"TEST-0...{result}")
  
      result = 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(f"TEST-1...{result}")
  
      result = 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(f"TEST-2...{result}")
  
      result = 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(f"TEST-3...{result}")
  
      result = 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(f"TEST-4...{result}")
  
      result = 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(f"TEST-5...{result}")
  
      result = 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(f"TEST-6...{result}")
  
      result = 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(f"TEST-7...{result}")
  
      result = 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(f"TEST-8...{result}")
  
      result = 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)
      print(f"TEST-9...{result}")
  
      sys.exit(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;
  }