static int subsetPairNotDivisibleByK ( int arr [ ] , int N , int K ) {
  int f [ ] = new int [ K ] ;
  Arrays . fill ( f , 0 ) ;
  for ( int i = 0 ;
  i < N ;
  i ++ ) f [ arr [ i ] % K ] ++ ;
  if ( K % 2 == 0 ) f [ K / 2 ] = Math . min ( f [ K / 2 ] , 1 ) ;
  int res = Math . min ( f [ 0 ] , 1 ) ;
  for ( int i = 1 ;
  i <= K / 2 ;
  i ++ ) res += Math . max ( f [ i ] , f [ K - i ] ) ;
  return res ;
}

static int subsetPairNotDivisibleByK ( int arr [ ] , int N , int K ) { int f [ ] = new int [ K ] ; Arrays . fill ( f , 0 ) ; for ( int i = 0 ; i < N ; i ++ ) f [ arr [ i ] % K ] ++ ; if ( K % 2 == 0 ) f [ K / 2 ] = Math . min ( f [ K / 2 ] , 1 ) ; int res = Math . min ( f [ 0 ] , 1 ) ; for ( int i = 1 ; i <= K / 2 ; i ++ ) res += Math . max ( f [ i ] , f [ K - i ] ) ; return res ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier) dimensions: (dimensions)) (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) dimensions: (dimensions) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (identifier))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (decimal_integer_literal)))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (expression_statement (update_expression (array_access array: (identifier) index: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier)))))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal))) consequence: (expression_statement (assignment_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) (decimal_integer_literal)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (decimal_integer_literal)) (decimal_integer_literal))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal))) update: (update_expression (identifier)) body: (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (identifier)) (array_access array: (identifier) index: (binary_expression left: (identifier) right: (identifier)))))))) (return_statement (identifier))))