title: K Th Digit Raised Power B
signature: double kThDigitRaisedPowerB(int a, int b, int k) {
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(double actual, double expected){
      return abs(actual - expected) < 1e-09;
  }
  
  string driver(int a, int b, int k, double expected){
      try
      {
          if (validateSolution(PLACEHOLDER_FN_NAME(a, b, k), 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(11, 2, 1, 1.0); 
      cout << "TEST-" << 0 << "..."
           <<  result
           << "\n";
  
      result = driver(41, 3, 3, 9.210000000000036); 
      cout << "TEST-" << 1 << "..."
           <<  result
           << "\n";
  
      result = driver(5, 4, 3, 6.25); 
      cout << "TEST-" << 2 << "..."
           <<  result
           << "\n";
  
      result = driver(1, 2, 4, 0.001); 
      cout << "TEST-" << 3 << "..."
           <<  result
           << "\n";
  
      result = driver(5, 2, 3, 0.25); 
      cout << "TEST-" << 4 << "..."
           <<  result
           << "\n";
  
      result = driver(66, 5, 8, 5.233257599999973); 
      cout << "TEST-" << 5 << "..."
           <<  result
           << "\n";
  
      result = driver(7, 10, 3, 2.489999999757856); 
      cout << "TEST-" << 6 << "..."
           <<  result
           << "\n";
  
      result = driver(77, 30, 10, 4.0); 
      cout << "TEST-" << 7 << "..."
           <<  result
           << "\n";
  
      result = driver(60, 50, 1, 0.0); 
      cout << "TEST-" << 8 << "..."
           <<  result
           << "\n";
  
      return 0;
  }
source_py: def k_th_digit_raised_power_b(a, b, k):
      p = (a ** b)
      count = 0
      while ((p > 0) and (count < k)):
          rem = (p % 10)
          count = (count + 1)
          if (count == k):
              return rem
          p = (p / 10)
source_cpp: int k_th_digit_raised_power_b(int a, int b, int k) {
    int p = pow ( a, b );
    int count = 0;
    while ( p > 0 && count < k ) {
      int rem = p % 10;
      count ++;
      if ( count == k ) return rem;
      p = p / 10;
    }
    return 0;
  }