static boolean check ( long [ ] a ) {
  int n = a . length ;
  long sum = 0 ;
  for ( int i = 0 ;
  i < n ;
  i ++ ) {
    sum += a [ i ] ;
  }
  if ( sum % ( ( long ) n * ( n + 1 ) / 2 ) != 0 ) {
    return false ;
  }
  else {
    long step = sum / ( ( long ) n * ( n + 1 ) / 2 ) ;
    long count = 0 ;
    for ( int i = 0 ;
    i < n - 1 ;
    i ++ ) {
      if ( ( a [ i ] - a [ i + 1 ] + step ) % n != 0 || a [ i ] - a [ i + 1 ] + step < 0 ) {
        return false ;
      }
      count += ( a [ i ] - a [ i + 1 ] + step ) / n ;
    }
    if ( ( a [ n - 1 ] - a [ 0 ] + step ) % n != 0 || a [ n - 1 ] - a [ 0 ] + step < 0 ) {
      return false ;
    }
    else {
      count += ( a [ n - 1 ] - a [ 0 ] + step ) / n ;
    }
    return count == step ;
  }
}

static boolean check ( long [ ] a ) { int n = a . length ; long sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { sum += a [ i ] ; } if ( sum % ( ( long ) n * ( n + 1 ) / 2 ) != 0 ) { return false ; } else { long step = sum / ( ( long ) n * ( n + 1 ) / 2 ) ; long count = 0 ; for ( int i = 0 ; i < n - 1 ; i ++ ) { if ( ( a [ i ] - a [ i + 1 ] + step ) % n != 0 || a [ i ] - a [ i + 1 ] + step < 0 ) { return false ; } count += ( a [ i ] - a [ i + 1 ] + step ) / n ; } if ( ( a [ n - 1 ] - a [ 0 ] + step ) % n != 0 || a [ n - 1 ] - a [ 0 ] + step < 0 ) { return false ; } else { count += ( a [ n - 1 ] - a [ 0 ] + step ) / n ; } return count == step ; } }
(method_declaration (modifiers) type: (boolean_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (integral_type) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (field_access object: (identifier) field: (identifier)))) (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: (block (expression_statement (assignment_expression left: (identifier) right: (array_access array: (identifier) index: (identifier)))))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (parenthesized_expression (binary_expression left: (binary_expression left: (cast_expression type: (integral_type) value: (identifier)) right: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal)))) right: (decimal_integer_literal)))) right: (decimal_integer_literal))) consequence: (block (return_statement (false))) alternative: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (parenthesized_expression (binary_expression left: (binary_expression left: (cast_expression type: (integral_type) value: (identifier)) right: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal)))) right: (decimal_integer_literal)))))) (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: (binary_expression left: (identifier) right: (decimal_integer_literal))) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (binary_expression left: (parenthesized_expression (binary_expression left: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal)))) right: (identifier))) right: (identifier)) right: (decimal_integer_literal)) right: (binary_expression left: (binary_expression left: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal)))) right: (identifier)) right: (decimal_integer_literal)))) consequence: (block (return_statement (false)))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (parenthesized_expression (binary_expression left: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal)))) right: (identifier))) right: (identifier)))))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (binary_expression left: (parenthesized_expression (binary_expression left: (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (array_access array: (identifier) index: (decimal_integer_literal))) right: (identifier))) right: (identifier)) right: (decimal_integer_literal)) right: (binary_expression left: (binary_expression left: (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (array_access array: (identifier) index: (decimal_integer_literal))) right: (identifier)) right: (decimal_integer_literal)))) consequence: (block (return_statement (false))) alternative: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (parenthesized_expression (binary_expression left: (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (array_access array: (identifier) index: (decimal_integer_literal))) right: (identifier))) right: (identifier)))))) (return_statement (binary_expression left: (identifier) right: (identifier)))))))