static int countSubArrayProductLessThanK ( ArrayList < Integer > a , long k ) {
  int n = a . size ( ) ;
  long p = 1 ;
  int res = 0 ;
  for ( int start = 0 , end = 0 ;
  end < n ;
  end ++ ) {
    p *= a . get ( end ) ;
    while ( start < end && p >= k ) p /= a . get ( start ++ ) ;
    if ( p < k ) {
      int len = end - start + 1 ;
      res += len ;
    }
  }
  return res ;
}

static int countSubArrayProductLessThanK ( ArrayList < Integer > a , long k ) { int n = a . size ( ) ; long p = 1 ; int res = 0 ; for ( int start = 0 , end = 0 ; end < n ; end ++ ) { p *= a . get ( end ) ; while ( start < end && p >= k ) p /= a . get ( start ++ ) ; if ( p < k ) { int len = end - start + 1 ; res += len ; } } return res ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (generic_type (type_identifier) (type_arguments (type_identifier))) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (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)) 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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))) (while_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (binary_expression left: (identifier) right: (identifier)))) body: (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (update_expression (identifier))))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal)))) (expression_statement (assignment_expression left: (identifier) right: (identifier))))))) (return_statement (identifier))))