static void majority ( int a [ ] , int p , int q , int size ) {
  int start = 0 , ends = q ;
  int [ ] arr = new int [ p ] ;
  int k = 0 ;
  while ( k < p ) {
    int one = 0 ;
    for ( int j = start ;
    j < ends ;
    j ++ ) {
      if ( a [ j ] == 1 ) {
        one ++ ;
      }
    }
    start = ends ;
    ends = ends + q ;
    arr [ k ] = one ;
    k ++ ;
  }
  start = 0 ;
  ends = q ;
  boolean found = false ;
  while ( ends > 0 ) {
    int dist_one = 0 ;
    for ( int i = 0 ;
    i < p ;
    i ++ ) if ( arr [ i ] > q / 2 ) dist_one ++ ;
    if ( dist_one > p / 2 ) {
      found = true ;
      System . out . println ( "Yes" ) ;
      return ;
    }
    start -- ;
    ends -- ;
    if ( start < 0 ) start = size + start ;
    int st = start , en = ends , l = 0 ;
    while ( en < size ) {
      if ( a [ st % size ] != a [ en % size ] ) {
        if ( a [ st % size ] == 1 ) arr [ l ] ++ ;
        else arr [ l ] -- ;
      }
      l ++ ;
      st = ( st + q ) ;
      en = en + q ;
    }
  }
  if ( found == false ) {
    System . out . println ( "No" ) ;
  }
}

static void majority ( int a [ ] , int p , int q , int size ) { int start = 0 , ends = q ; int [ ] arr = new int [ p ] ; int k = 0 ; while ( k < p ) { int one = 0 ; for ( int j = start ; j < ends ; j ++ ) { if ( a [ j ] == 1 ) { one ++ ; } } start = ends ; ends = ends + q ; arr [ k ] = one ; k ++ ; } start = 0 ; ends = q ; boolean found = false ; while ( ends > 0 ) { int dist_one = 0 ; for ( int i = 0 ; i < p ; i ++ ) if ( arr [ i ] > q / 2 ) dist_one ++ ; if ( dist_one > p / 2 ) { found = true ; System . out . println ( " Yes " ) ; return ; } start -- ; ends -- ; if ( start < 0 ) start = size + start ; int st = start , en = ends , l = 0 ; while ( en < size ) { if ( a [ st % size ] != a [ en % size ] ) { if ( a [ st % size ] == 1 ) arr [ l ] ++ ; else arr [ l ] -- ; } l ++ ; st = ( st + q ) ; en = en + q ; } } if ( found == false ) { System . out . println ( " No " ) ; } }
(method_declaration (modifiers) type: (void_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)) (formal_parameter type: (integral_type) name: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal)) declarator: (variable_declarator name: (identifier) value: (identifier))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (identifier))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (while_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (identifier))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal))) consequence: (block (expression_statement (update_expression (identifier))))))) (expression_statement (assignment_expression left: (identifier) right: (identifier))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (identifier)))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier))) (expression_statement (update_expression (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))) (expression_statement (assignment_expression left: (identifier) right: (identifier))) (local_variable_declaration type: (boolean_type) declarator: (variable_declarator name: (identifier) value: (false))) (while_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (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: (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) consequence: (expression_statement (update_expression (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (true))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal)))) (return_statement))) (expression_statement (update_expression (identifier))) (expression_statement (update_expression (identifier))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (identifier))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (identifier)) declarator: (variable_declarator name: (identifier) value: (identifier)) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (while_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (identifier))) right: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (identifier))))) consequence: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (identifier))) right: (decimal_integer_literal))) consequence: (expression_statement (update_expression (array_access array: (identifier) index: (identifier)))) alternative: (expression_statement (update_expression (array_access array: (identifier) index: (identifier))))))) (expression_statement (update_expression (identifier))) (expression_statement (assignment_expression left: (identifier) right: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (identifier)))))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (false))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal))))))))