title: Middle Of Three Using Minimum Comparisons
signature: int middleOfThreeUsingMinimumComparisons(int a, int b, int c) {
test_code: #include <algorithm>
  #include <assert.h>
  #include <cstdlib>
  #include <iostream>
  #include <map>
  #include <set>
  #include <string>
  #include <tuple> 
  #include <unordered_map>
  #include <vector>
  #include <math.h>
  #include <cmath>
  #include <bits/stdc++.h>
  #include <numeric>
  #include <functional>
  
  using namespace std;
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  bool validateSolution(int actual, int expected){
      return actual == expected;
  }
  
  string driver(int a, int b, int c, int expected){
      try
      {
          if (validateSolution(PLACEHOLDER_FN_NAME(a, b, c), expected)){
              return "PASSED";
          }
          return "FAILED";
      }
      catch (const std::overflow_error& exception_obj)
      {
          return typeid(exception_obj).name();
      }
      catch (const std::runtime_error& exception_obj)
      {
          return typeid(exception_obj).name();
      }
      catch (const std::exception& exception_obj)
      {
          return typeid(exception_obj).name();
      }
      catch (...)
      {
          return "UNK_ERROR";
      }
  }
  
  int main() {
      string result = "";
  
      result = driver(56, 5, 82, 56); 
      cout << "TEST-" << 0 << "..."
           <<  result
           << "\n";
  
      result = driver(56, 60, 17, 56); 
      cout << "TEST-" << 1 << "..."
           <<  result
           << "\n";
  
      result = driver(36, 56, 51, 51); 
      cout << "TEST-" << 2 << "..."
           <<  result
           << "\n";
  
      result = driver(71, 54, 6, 54); 
      cout << "TEST-" << 3 << "..."
           <<  result
           << "\n";
  
      result = driver(3, 70, 81, 70); 
      cout << "TEST-" << 4 << "..."
           <<  result
           << "\n";
  
      result = driver(84, 57, 47, 57); 
      cout << "TEST-" << 5 << "..."
           <<  result
           << "\n";
  
      result = driver(30, 80, 85, 80); 
      cout << "TEST-" << 6 << "..."
           <<  result
           << "\n";
  
      result = driver(82, 54, 32, 54); 
      cout << "TEST-" << 7 << "..."
           <<  result
           << "\n";
  
      result = driver(90, 70, 55, 70); 
      cout << "TEST-" << 8 << "..."
           <<  result
           << "\n";
  
      result = driver(38, 4, 5, 5); 
      cout << "TEST-" << 9 << "..."
           <<  result
           << "\n";
  
      return 0;
  }
source_py: def middle_of_three_using_minimum_comparisons(a, b, c):
      if (((a < b) and (b < c)) or ((c < b) and (b < a))):
          return b
      if (((b < a) and (a < c)) or ((c < a) and (a < b))):
          return a
      else:
          return c
source_cpp: int middle_of_three_using_minimum_comparisons(int a, int b, int c) {
    if ( ( a < b && b < c ) || ( c < b && b < a ) ) return b;
    else if ( ( b < a && a < c ) || ( c < a && a < b ) ) return a;
    else return c;
  }