private static String solve ( int H , int W , int N , int [ ] A ) {
  List < Integer > numbers = new ArrayList < > ( ) ;
  for ( int i = 0 ;
  i < N ;
  i ++ ) {
    int n = i + 1 ;
    int a = A [ i ] ;
    for ( int j = 0 ;
    j < a ;
    j ++ ) {
      numbers . add ( n ) ;
    }
  }
  StringJoiner j = new StringJoiner ( "\n" ) ;
  for ( int h = 0 ;
  h < H ;
  h ++ ) {
    int start = h * W ;
    int end = h * W + W ;
    List < Integer > line = new ArrayList < > ( numbers . subList ( start , end ) ) ;
    if ( h % 2 == 1 ) {
      Collections . reverse ( line ) ;
    }
    StringJoiner j2 = new StringJoiner ( " " ) ;
    line . forEach ( i -> j2 . add ( i . toString ( ) ) ) ;
    j . add ( j2 . toString ( ) ) ;
  }
  return j . toString ( ) ;
}

private static String solve ( int H , int W , int N , int [ ] A ) { List < Integer > numbers = new ArrayList < > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { int n = i + 1 ; int a = A [ i ] ; for ( int j = 0 ; j < a ; j ++ ) { numbers . add ( n ) ; } } StringJoiner j = new StringJoiner ( " \n " ) ; for ( int h = 0 ; h < H ; h ++ ) { int start = h * W ; int end = h * W + W ; List < Integer > line = new ArrayList < > ( numbers . subList ( start , end ) ) ; if ( h % 2 == 1 ) { Collections . reverse ( line ) ; } StringJoiner j2 = new StringJoiner ( " ▁ " ) ; line . forEach ( i -> j2 . add ( i . toString ( ) ) ) ; j . add ( j2 . toString ( ) ) ; } return j . toString ( ) ; }
(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: (integral_type) name: (identifier)) (formal_parameter type: (array_type element: (integral_type) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (generic_type (type_identifier) (type_arguments (type_identifier))) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (generic_type (type_identifier) (type_arguments)) arguments: (argument_list)))) (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: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (decimal_integer_literal)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (array_access array: (identifier) index: (identifier)))) (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: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (string_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: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (identifier)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (identifier)))) (local_variable_declaration type: (generic_type (type_identifier) (type_arguments (type_identifier))) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (generic_type (type_identifier) (type_arguments)) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (identifier))))))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal))) consequence: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (string_literal))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (lambda_expression parameters: (identifier) body: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))))))) (return_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))