title: Basic And Extended Euclidean Algorithms
signature: basic_and_extended_euclidean_algorithms <- function(a, b) {
test_code: 
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  validate_solution <- function(actual, expected) {
      toString(actual)==toString(expected)
  }
  
  driver <- function(a, b, expected){
      if (validate_solution(PLACEHOLDER_FN_NAME(a, b), expected)){
          "PASSED"
      } else{
          "FAILED"
      }
  }
  
  main <- function() {
      cat(sprintf("TEST-0...%s\n",driver(
          46L, 89L, 
          1L
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          26L, 82L, 
          2L
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          40L, 12L, 
          4L
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          58L, 4L, 
          2L
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          25L, 44L, 
          1L
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          2L, 87L, 
          1L
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          8L, 65L, 
          1L
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          21L, 87L, 
          3L
      )))
  
      cat(sprintf("TEST-8...%s\n",driver(
          82L, 10L, 
          2L
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          17L, 61L, 
          1L
      )))
  
  }
  
  main()
source_py: def basic_and_extended_euclidean_algorithms(a, b):
      if (a == 0):
          return b
      return basic_and_extended_euclidean_algorithms((b % a), a)
source_cpp: int basic_and_extended_euclidean_algorithms(int a, int b) {
    if ( a == 0 ) return b;
    return basic_and_extended_euclidean_algorithms ( b % a, a );
  }