title: Distributing M Items Circle Size N Starting K Th Position
signature: class Solution {
  
      public Integer distributingMItemsCircleSizeNStartingKThPosition(Integer n, Integer m, Integer k) {
test_code: import static java.util.Map.entry;  
  import java.util.*;
  import java.lang.*;
  // TESTING CODE 
  // ============================================
  class QuestionEvaluator {
      public static String validateSolution(Integer n, Integer m, Integer k, Integer expected){
          try{
              Driver driver = new Driver();
              if (driver.run(n, m, k,expected)){
                  return "PASSED";
              }
              return "FAILED";
              
          } catch (Exception exception_obj){
              return exception_obj.getClass().getSimpleName();
          }
  
      }
      public static void main(String[] args) {
          String result;
          result = validateSolution(19, 14, 34, 9);
          System.out.println(String.format("%s%s","TEST-0...",result));    
      
          result = validateSolution(23, 51, 5, 9);
          System.out.println(String.format("%s%s","TEST-1...",result));    
      
          result = validateSolution(92, 10, 24, 33);
          System.out.println(String.format("%s%s","TEST-2...",result));    
      
          result = validateSolution(9, 50, 34, 2);
          System.out.println(String.format("%s%s","TEST-3...",result));    
      
          result = validateSolution(20, 67, 20, 6);
          System.out.println(String.format("%s%s","TEST-4...",result));    
      
          result = validateSolution(68, 25, 40, 64);
          System.out.println(String.format("%s%s","TEST-5...",result));    
      
          result = validateSolution(66, 30, 24, 53);
          System.out.println(String.format("%s%s","TEST-6...",result));    
      
          result = validateSolution(77, 22, 32, 53);
          System.out.println(String.format("%s%s","TEST-7...",result));    
      
          result = validateSolution(90, 1, 71, 71);
          System.out.println(String.format("%s%s","TEST-8...",result));    
      
          result = validateSolution(26, 34, 54, 9);
          System.out.println(String.format("%s%s","TEST-9...",result));    
      
      }
  }
  
  class Driver{
      public boolean run(Integer n, Integer m, Integer k, Integer expected){
  
          PLACEHOLDER_CLS_NAME sol = new PLACEHOLDER_CLS_NAME();
          return validateSolution(sol.PLACEHOLDER_FN_NAME(n, m, k),expected);
      }
      
      public boolean validateSolution(Integer actual, Integer expected){
          return actual.equals(expected);
      }
  }
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
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 );
  }