title: Distributing M Items Circle Size N Starting K Th Position
signature: function distributingMItemsCircleSizeNStartingKThPosition($n, $m, $k) {
test_code: <?php
  
  
  // SOLUTION CODE 
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  function validateSolution($actual, $expected){
      return serialize($actual) == serialize($expected);
  }
  
  function driver($n, $m, $k, $expected){
      try{
        if (validateSolution(PLACEHOLDER_FN_NAME($n, $m, $k), $expected)){
          return "PASSED";
        }
        return "FAILED";
      }
      catch (Exception $exception_obj) {
        return get_class($exception_obj);
      }
  }
  
  function main(){
      printf("TEST-0...%s\n",driver(
        19, 14, 34, 
        9));
      
      printf("TEST-1...%s\n",driver(
        23, 51, 5, 
        9));
      
      printf("TEST-2...%s\n",driver(
        92, 10, 24, 
        33));
      
      printf("TEST-3...%s\n",driver(
        9, 50, 34, 
        2));
      
      printf("TEST-4...%s\n",driver(
        20, 67, 20, 
        6));
      
      printf("TEST-5...%s\n",driver(
        68, 25, 40, 
        64));
      
      printf("TEST-6...%s\n",driver(
        66, 30, 24, 
        53));
      
      printf("TEST-7...%s\n",driver(
        77, 22, 32, 
        53));
      
      printf("TEST-8...%s\n",driver(
        90, 1, 71, 
        71));
      
      printf("TEST-9...%s\n",driver(
        26, 34, 54, 
        9));
      
  }
  
  main();
  ?>
source_py: def distributing_m_items_circle_size_n_starting_k_th_position(n, m, k):
      if (m <= ((n - k) + 1)):
          return ((m + k) - 1)
      m = (m - ((n - k) + 1))
      if ((m % n) == 0):
          return n
      else:
          return (m % n)
source_cpp: int distributing_m_items_circle_size_n_starting_k_th_position(int n, int m, int k) {
    if ( m <= n - k + 1 ) return m + k - 1;
    m = m - ( n - k + 1 );
    return ( m % n == 0 ) ? n : ( m % n );
  }