public static String solve ( int N , long K , int [ ] times ) {
  String result = "" ;
  int time = times [ N ] ;
  if ( K < time ) {
    result = "OFF" ;
  }
  else if ( K == time ) {
    result = "ON" ;
  }
  else {
    long remain = K - time ;
    if ( remain % ( time + 1 ) == 0 ) {
      result = "ON" ;
    }
    else {
      result = "OFF" ;
    }
  }
  return result ;
}

public static String solve ( int N , long K , int [ ] times ) { String result = " " ; int time = times [ N ] ; if ( K < time ) { result = " OFF " ; } else if ( K == time ) { result = " ON " ; } else { long remain = K - time ; if ( remain % ( time + 1 ) == 0 ) { result = " ON " ; } else { result = " OFF " ; } } return result ; }
(method_declaration (modifiers) type: (type_identifier) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (array_type element: (integral_type) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (string_literal))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (array_access array: (identifier) index: (identifier)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (string_literal)))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (string_literal)))) alternative: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (identifier)))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal)))) right: (decimal_integer_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (string_literal)))) alternative: (block (expression_statement (assignment_expression left: (identifier) right: (string_literal)))))))) (return_statement (identifier))))