public static void solve ( int n , int m , int k ) {
  if ( m == 0 ) {
    System . out . println ( 0 ) ;
  }
  else if ( m < ( n / k ) ) {
    System . out . println ( m ) ;
  }
  else {
    int val = m - ( n / k ) ;
    m -= ( n / k ) ;
    int left = ceil ( m , ( k - 1 ) ) ;
    System . out . println ( ( n / k ) - left ) ;
  }
}

public static void solve ( int n , int m , int k ) { if ( m == 0 ) { System . out . println ( 0 ) ; } else if ( m < ( n / k ) ) { System . out . println ( m ) ; } else { int val = m - ( n / k ) ; m -= ( n / k ) ; int left = ceil ( m , ( k - 1 ) ) ; System . out . println ( ( n / k ) - left ) ; } }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (decimal_integer_literal))))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier))))) alternative: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (parenthesized_expression (binary_expression left: (identifier) right: (identifier)))))) (expression_statement (assignment_expression left: (identifier) right: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation name: (identifier) arguments: (argument_list (identifier) (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) right: (identifier))))))))))