code
stringlengths
31
2.27k
tokenized_code
stringlengths
30
1.69k
sexp
stringlengths
115
9.43k
public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; Task solver = new Task ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }
public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; Task solver = new Task ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (field_access object: (identifier) field: (identifier)))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (field_access object: (identifier) field: (identifier)))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_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 (identifier))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal) (identifier) (identifier)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))
public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int l = sc . nextInt ( ) ; int state = 0 ; if ( n + m == l ) state += 1 ; if ( n - m == l ) state += 2 ; String ans = "!" ; switch ( state ) { case 0 : break ; case 1 : ans = "+" ; break ; case 2 : ans = "-" ; break ; case 3 : ans = "?" ; break ; } System . out . println ( ans ) ; }
public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int l = sc . nextInt ( ) ; int state = 0 ; if ( n + m == l ) state += 1 ; if ( n - m == l ) state += 2 ; String ans = " ! " ; switch ( state ) { case 0 : break ; case 1 : ans = " + " ; break ; case 2 : ans = " - " ; break ; case 3 : ans = " ? " ; break ; } System . out . println ( ans ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) (throws (type_identifier)) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (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))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (identifier))) consequence: (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal)))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (identifier))) consequence: (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal)))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (string_literal))) (switch_expression condition: (parenthesized_expression (identifier)) body: (switch_block (switch_block_statement_group (switch_label (decimal_integer_literal)) (break_statement)) (switch_block_statement_group (switch_label (decimal_integer_literal)) (expression_statement (assignment_expression left: (identifier) right: (string_literal))) (break_statement)) (switch_block_statement_group (switch_label (decimal_integer_literal)) (expression_statement (assignment_expression left: (identifier) right: (string_literal))) (break_statement)) (switch_block_statement_group (switch_label (decimal_integer_literal)) (expression_statement (assignment_expression left: (identifier) right: (string_literal))) (break_statement)))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier))))))
public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String [ ] line = scanner . nextLine ( ) . split ( " " , 3 ) ; int a = Integer . parseInt ( line [ 0 ] ) ; int b = Integer . parseInt ( line [ 1 ] ) ; int c = Integer . parseInt ( line [ 2 ] ) ; if ( a + b == c && a - b != c ) { System . out . println ( "+" ) ; } else if ( a + b != c && a - b == c ) { System . out . println ( "-" ) ; } else if ( a + b == c && a - b == c ) { System . out . println ( "?" ) ; } else { System . out . println ( "!" ) ; } }
public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String [ ] line = scanner . nextLine ( ) . split ( " ▁ " , 3 ) ; int a = Integer . parseInt ( line [ 0 ] ) ; int b = Integer . parseInt ( line [ 1 ] ) ; int c = Integer . parseInt ( line [ 2 ] ) ; if ( a + b == c && a - b != c ) { System . out . println ( " + " ) ; } else if ( a + b != c && a - b == c ) { System . out . println ( " - " ) ; } else if ( a + b == c && a - b == c ) { System . out . println ( " ? " ) ; } else { System . out . println ( " ! " ) ; } }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (local_variable_declaration type: (array_type element: (type_identifier) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) name: (identifier) arguments: (argument_list (string_literal) (decimal_integer_literal))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (decimal_integer_literal)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (decimal_integer_literal)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (decimal_integer_literal)))))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (identifier)) right: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (identifier)))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal))))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (identifier)) right: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (identifier)))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal))))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (identifier)) right: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (identifier)))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal))))) alternative: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal))))))))))
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } if ( a [ 0 ] + a [ 1 ] == a [ 2 ] && a [ 0 ] - a [ 1 ] == a [ 2 ] ) { System . out . println ( "?" ) ; } else if ( a [ 0 ] + a [ 1 ] == a [ 2 ] ) { System . out . println ( "+" ) ; } else if ( a [ 0 ] - a [ 1 ] == a [ 2 ] ) { System . out . println ( "-" ) ; } else { System . out . println ( "!" ) ; } }
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } if ( a [ 0 ] + a [ 1 ] == a [ 2 ] && a [ 0 ] - a [ 1 ] == a [ 2 ] ) { System . out . println ( " ? " ) ; } else if ( a [ 0 ] + a [ 1 ] == a [ 2 ] ) { System . out . println ( " + " ) ; } else if ( a [ 0 ] - a [ 1 ] == a [ 2 ] ) { System . out . println ( " - " ) ; } else { System . out . println ( " ! " ) ; } }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (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 (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: (decimal_integer_literal)) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (binary_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (array_access array: (identifier) index: (decimal_integer_literal))) right: (array_access array: (identifier) index: (decimal_integer_literal))) right: (binary_expression left: (binary_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (array_access array: (identifier) index: (decimal_integer_literal))) right: (array_access array: (identifier) index: (decimal_integer_literal))))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal))))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (array_access array: (identifier) index: (decimal_integer_literal))) right: (array_access array: (identifier) index: (decimal_integer_literal)))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal))))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (array_access array: (identifier) index: (decimal_integer_literal))) right: (array_access array: (identifier) index: (decimal_integer_literal)))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal))))) alternative: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal))))))))))
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int tmp = ( B - 1 ) / A ; System . out . println ( tmp + 1 ) ; }
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int tmp = ( B - 1 ) / A ; System . out . println ( tmp + 1 ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (identifier)))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)))))))
public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; Task solver = new Task ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }
public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; Task solver = new Task ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (field_access object: (identifier) field: (identifier)))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (field_access object: (identifier) field: (identifier)))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_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 (identifier))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal) (identifier) (identifier)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))
static int nextInt ( ) { return Integer . parseInt ( sc . next ( ) ) ; }
static int nextInt ( ) { return Integer . parseInt ( sc . next ( ) ) ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters) body: (block (return_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))))
static int [ ] nextIntArray ( int n ) { return IntStream . range ( 0 , n ) . map ( i -> nextInt ( ) ) . toArray ( ) ; }
static int [ ] nextIntArray ( int n ) { return IntStream . range ( 0 , n ) . map ( i -> nextInt ( ) ) . toArray ( ) ; }
(method_declaration (modifiers) type: (array_type element: (integral_type) dimensions: (dimensions)) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier))) body: (block (return_statement (method_invocation object: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal) (identifier))) name: (identifier) arguments: (argument_list (lambda_expression parameters: (identifier) body: (method_invocation name: (identifier) arguments: (argument_list))))) name: (identifier) arguments: (argument_list)))))
static int max ( int ... ar ) { Arrays . sort ( ar ) ; return ar [ ar . length - 1 ] ; }
static int max ( int ... ar ) { Arrays . sort ( ar ) ; return ar [ ar . length - 1 ] ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (spread_parameter (integral_type) (variable_declarator name: (identifier)))) body: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) (return_statement (array_access array: (identifier) index: (binary_expression left: (field_access object: (identifier) field: (identifier)) right: (decimal_integer_literal))))))
static int min ( int ... ar ) { Arrays . sort ( ar ) ; return ar [ 0 ] ; }
static int min ( int ... ar ) { Arrays . sort ( ar ) ; return ar [ 0 ] ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (spread_parameter (integral_type) (variable_declarator name: (identifier)))) body: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) (return_statement (array_access array: (identifier) index: (decimal_integer_literal)))))
public static void main ( String [ ] args ) { int a = nextInt ( ) , b = nextInt ( ) ; out . println ( ( int ) Math . ceil ( ( double ) b / ( double ) a ) ) ; }
public static void main ( String [ ] args ) { int a = nextInt ( ) , b = nextInt ( ) ; out . println ( ( int ) Math . ceil ( ( double ) b / ( double ) a ) ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation name: (identifier) arguments: (argument_list))) declarator: (variable_declarator name: (identifier) value: (method_invocation name: (identifier) arguments: (argument_list)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (cast_expression type: (integral_type) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (cast_expression type: (floating_point_type) value: (identifier)) right: (cast_expression type: (floating_point_type) value: (identifier)))))))))))
public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int a = Integer . parseInt ( scan . next ( ) ) ; int b = Integer . parseInt ( scan . next ( ) ) ; int ans = 0 ; if ( b % a == 0 ) { ans = b / a ; } else if ( a > b ) { ans = 1 ; } else { ans = b / a + 1 ; } PrintWriter out = new PrintWriter ( System . out ) ; out . println ( ans ) ; out . flush ( ) ; scan . close ( ) ; }
public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int a = Integer . parseInt ( scan . next ( ) ) ; int b = Integer . parseInt ( scan . next ( ) ) ; int ans = 0 ; if ( b % a == 0 ) { ans = b / a ; } else if ( a > b ) { ans = 1 ; } else { ans = b / a + 1 ; } PrintWriter out = new PrintWriter ( System . out ) ; out . println ( ans ) ; out . flush ( ) ; scan . close ( ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) name: (identifier) dimensions: (dimensions))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (identifier))))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal)))) alternative: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal))))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))
public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; double a = scan . nextInt ( ) ; double b = Integer . parseInt ( scan . next ( ) ) ; double box = b / a ; double calc = b % a ; int result = 0 ; if ( calc == 0 ) { result = ( int ) box ; System . out . println ( result ) ; } else { box = Math . ceil ( box ) ; result = ( int ) box ; System . out . println ( result ) ; } }
public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; double a = scan . nextInt ( ) ; double b = Integer . parseInt ( scan . next ( ) ) ; double box = b / a ; double calc = b % a ; int result = 0 ; if ( calc == 0 ) { result = ( int ) box ; System . out . println ( result ) ; } else { box = Math . ceil ( box ) ; result = ( int ) box ; System . out . println ( result ) ; } }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (local_variable_declaration type: (floating_point_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (floating_point_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))) (local_variable_declaration type: (floating_point_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (identifier)))) (local_variable_declaration type: (floating_point_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: (decimal_integer_literal))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (cast_expression type: (integral_type) value: (identifier)))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier))))) alternative: (block (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (cast_expression type: (integral_type) value: (identifier)))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier))))))))
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; final String S = sc . next ( ) ; sc . close ( ) ; int mNum = 0 ; for ( char c : S . toCharArray ( ) ) { if ( c == 'M' ) mNum ++ ; } int [ ] m = new int [ mNum ] ; int at = S . length ( ) - 1 ; int current = 0 ; int mIndex = mNum - 1 ; while ( mIndex >= 0 ) { char c = S . charAt ( at ) ; if ( c == 'M' ) { m [ mIndex ] = current ; mIndex -- ; } else if ( c == '+' ) { current ++ ; } else if ( c == '-' ) { current -- ; } at -- ; } Arrays . sort ( m ) ; int ans = 0 ; for ( int i = 0 ; i < mNum / 2 ; i ++ ) ans -= m [ i ] ; for ( int i = mNum / 2 ; i < mNum ; i ++ ) ans += m [ i ] ; System . out . println ( ans ) ; }
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; final String S = sc . next ( ) ; sc . close ( ) ; int mNum = 0 ; for ( char c : S . toCharArray ( ) ) { if ( c == ' M ' ) mNum ++ ; } int [ ] m = new int [ mNum ] ; int at = S . length ( ) - 1 ; int current = 0 ; int mIndex = mNum - 1 ; while ( mIndex >= 0 ) { char c = S . charAt ( at ) ; if ( c == ' M ' ) { m [ mIndex ] = current ; mIndex -- ; } else if ( c == ' + ' ) { current ++ ; } else if ( c == ' - ' ) { current -- ; } at -- ; } Arrays . sort ( m ) ; int ans = 0 ; for ( int i = 0 ; i < mNum / 2 ; i ++ ) ans -= m [ i ] ; for ( int i = mNum / 2 ; i < mNum ; i ++ ) ans += m [ i ] ; System . out . println ( ans ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (local_variable_declaration (modifiers) type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (enhanced_for_statement type: (integral_type) name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (character_literal))) consequence: (expression_statement (update_expression (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: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal)))) (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: (binary_expression left: (identifier) right: (decimal_integer_literal)))) (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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (character_literal))) consequence: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier))) (expression_statement (update_expression (identifier)))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (character_literal))) consequence: (block (expression_statement (update_expression (identifier)))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (character_literal))) consequence: (block (expression_statement (update_expression (identifier))))))) (expression_statement (update_expression (identifier))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (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: (binary_expression left: (identifier) right: (decimal_integer_literal))) update: (update_expression (identifier)) body: (expression_statement (assignment_expression left: (identifier) right: (array_access array: (identifier) index: (identifier))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (decimal_integer_literal)))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (expression_statement (assignment_expression left: (identifier) right: (array_access array: (identifier) index: (identifier))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier))))))
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; final String S = sc . next ( ) ; sc . close ( ) ; int mNum = 0 ; for ( char c : S . toCharArray ( ) ) { if ( c == 'M' ) mNum ++ ; } int [ ] m = new int [ mNum ] ; int at = S . length ( ) - 1 ; int current = 0 ; int mIndex = mNum - 1 ; while ( mIndex >= 0 ) { char c = S . charAt ( at ) ; if ( c == 'M' ) { m [ mIndex ] = current ; mIndex -- ; } else if ( c == '+' ) { current ++ ; } else if ( c == '-' ) { current -- ; } at -- ; } Arrays . sort ( m ) ; int ans = 0 ; for ( int i = 0 ; i < mNum / 2 ; i ++ ) ans -= m [ i ] ; for ( int i = mNum / 2 ; i < mNum ; i ++ ) ans += m [ i ] ; System . out . println ( ans ) ; }
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; final String S = sc . next ( ) ; sc . close ( ) ; int mNum = 0 ; for ( char c : S . toCharArray ( ) ) { if ( c == ' M ' ) mNum ++ ; } int [ ] m = new int [ mNum ] ; int at = S . length ( ) - 1 ; int current = 0 ; int mIndex = mNum - 1 ; while ( mIndex >= 0 ) { char c = S . charAt ( at ) ; if ( c == ' M ' ) { m [ mIndex ] = current ; mIndex -- ; } else if ( c == ' + ' ) { current ++ ; } else if ( c == ' - ' ) { current -- ; } at -- ; } Arrays . sort ( m ) ; int ans = 0 ; for ( int i = 0 ; i < mNum / 2 ; i ++ ) ans -= m [ i ] ; for ( int i = mNum / 2 ; i < mNum ; i ++ ) ans += m [ i ] ; System . out . println ( ans ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (local_variable_declaration (modifiers) type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (enhanced_for_statement type: (integral_type) name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (character_literal))) consequence: (expression_statement (update_expression (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: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal)))) (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: (binary_expression left: (identifier) right: (decimal_integer_literal)))) (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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (character_literal))) consequence: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier))) (expression_statement (update_expression (identifier)))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (character_literal))) consequence: (block (expression_statement (update_expression (identifier)))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (character_literal))) consequence: (block (expression_statement (update_expression (identifier))))))) (expression_statement (update_expression (identifier))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (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: (binary_expression left: (identifier) right: (decimal_integer_literal))) update: (update_expression (identifier)) body: (expression_statement (assignment_expression left: (identifier) right: (array_access array: (identifier) index: (identifier))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (decimal_integer_literal)))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (expression_statement (assignment_expression left: (identifier) right: (array_access array: (identifier) index: (identifier))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier))))))
public static void main ( String [ ] args ) { new Main ( ) . solve ( ) ; }
public static void main ( String [ ] args ) { new Main ( ) . solve ( ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (expression_statement (method_invocation object: (object_creation_expression type: (type_identifier) arguments: (argument_list)) name: (identifier) arguments: (argument_list)))))
public static void main ( String args [ ] ) { new Main ( ) . run ( ) ; }
public static void main ( String args [ ] ) { new Main ( ) . run ( ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) name: (identifier) dimensions: (dimensions))) body: (block (expression_statement (method_invocation object: (object_creation_expression type: (type_identifier) arguments: (argument_list)) name: (identifier) arguments: (argument_list)))))
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( sc . hasNext ( ) ) { String a = sc . next ( ) ; String b = sc . next ( ) ; char ach = a . charAt ( 0 ) ; char bch = b . charAt ( 0 ) ; if ( ach > bch ) { System . out . println ( ">" ) ; } else if ( ach < bch ) { System . out . println ( "<" ) ; } else { System . out . println ( "=" ) ; } } }
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( sc . hasNext ( ) ) { String a = sc . next ( ) ; String b = sc . next ( ) ; char ach = a . charAt ( 0 ) ; char bch = b . charAt ( 0 ) ; if ( ach > bch ) { System . out . println ( " > " ) ; } else if ( ach < bch ) { System . out . println ( " < " ) ; } else { System . out . println ( " = " ) ; } } }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (while_statement condition: (parenthesized_expression (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (type_identifier) 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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal))))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal))))) alternative: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal)))))))))))
public static void main ( String [ ] args ) { A ( ) ; }
public static void main ( String [ ] args ) { A ( ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (expression_statement (method_invocation name: (identifier) arguments: (argument_list)))))
public static void A ( ) { Scanner sc = new Scanner ( System . in ) ; String s1 = sc . next ( ) ; String s2 = sc . next ( ) ; if ( s1 . compareTo ( s2 ) < 0 ) System . out . println ( "<" ) ; else if ( s1 . compareTo ( s2 ) == 0 ) System . out . println ( "=" ) ; else System . out . println ( ">" ) ; }
public static void A ( ) { Scanner sc = new Scanner ( System . in ) ; String s1 = sc . next ( ) ; String s2 = sc . next ( ) ; if ( s1 . compareTo ( s2 ) < 0 ) System . out . println ( " < " ) ; else if ( s1 . compareTo ( s2 ) == 0 ) System . out . println ( " = " ) ; else System . out . println ( " > " ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (decimal_integer_literal))) consequence: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal)))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (decimal_integer_literal))) consequence: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal)))) alternative: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal))))))))
public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String X = sc . next ( ) ; String Y = sc . next ( ) ; sc . close ( ) ; if ( X . equals ( Y ) ) { System . out . println ( "=" ) ; } else if ( X . compareTo ( Y ) < 0 ) { System . out . println ( "<" ) ; } else { System . out . println ( ">" ) ; } }
public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String X = sc . next ( ) ; String Y = sc . next ( ) ; sc . close ( ) ; if ( X . equals ( Y ) ) { System . out . println ( " = " ) ; } else if ( X . compareTo ( Y ) < 0 ) { System . out . println ( " < " ) ; } else { System . out . println ( " > " ) ; } }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) (throws (type_identifier)) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) (if_statement condition: (parenthesized_expression (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal))))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (decimal_integer_literal))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal))))) alternative: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal)))))))))
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String x = sc . next ( ) ; String y = sc . next ( ) ; byte [ ] x_byte = x . getBytes ( ) ; byte [ ] y_byte = y . getBytes ( ) ; if ( x_byte [ 0 ] > y_byte [ 0 ] ) { System . out . println ( ">" ) ; } else if ( x_byte [ 0 ] < y_byte [ 0 ] ) { System . out . println ( "<" ) ; } else { System . out . println ( "=" ) ; } }
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String x = sc . next ( ) ; String y = sc . next ( ) ; byte [ ] x_byte = x . getBytes ( ) ; byte [ ] y_byte = y . getBytes ( ) ; if ( x_byte [ 0 ] > y_byte [ 0 ] ) { System . out . println ( " > " ) ; } else if ( x_byte [ 0 ] < y_byte [ 0 ] ) { System . out . println ( " < " ) ; } else { System . out . println ( " = " ) ; } }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (array_access array: (identifier) index: (decimal_integer_literal)))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal))))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (array_access array: (identifier) index: (decimal_integer_literal)))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal))))) alternative: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal)))))))))
public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; char X = sc . next ( ) . charAt ( 0 ) ; char Y = sc . next ( ) . charAt ( 0 ) ; int num = X - Y ; System . out . println ( num < 0 ? "<" : ( num > 0 ) ? ">" : "=" ) ; }
public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; char X = sc . next ( ) . charAt ( 0 ) ; char Y = sc . next ( ) . charAt ( 0 ) ; int num = X - Y ; System . out . println ( num < 0 ? " < " : ( num > 0 ) ? " > " : " = " ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) (throws (type_identifier)) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) name: (identifier) arguments: (argument_list (decimal_integer_literal))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) name: (identifier) arguments: (argument_list (decimal_integer_literal))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (identifier)))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (ternary_expression condition: (binary_expression left: (identifier) right: (decimal_integer_literal)) consequence: (string_literal) alternative: (ternary_expression condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (string_literal) alternative: (string_literal))))))))
public static long process ( TestCase testCase ) { final int N = testCase . N ; final long X = testCase . X ; return countNumPatty ( N , X ) ; }
public static long process ( TestCase testCase ) { final int N = testCase . N ; final long X = testCase . X ; return countNumPatty ( N , X ) ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) name: (identifier))) body: (block (local_variable_declaration (modifiers) type: (integral_type) declarator: (variable_declarator name: (identifier) value: (field_access object: (identifier) field: (identifier)))) (local_variable_declaration (modifiers) type: (integral_type) declarator: (variable_declarator name: (identifier) value: (field_access object: (identifier) field: (identifier)))) (return_statement (method_invocation name: (identifier) arguments: (argument_list (identifier) (identifier))))))
private static long countNumPatty ( int N , long X ) { if ( X == 0 ) { return 0L ; } final long burgerLength = burgerLength ( N ) ; boolean isWholeBurgerEaten = X >= burgerLength ; if ( isWholeBurgerEaten ) { return numPatty ( N ) ; } else { boolean isOnlyTopSliceRemaining = X == burgerLength - 1 ; final long oneSmallerLayerLength = burgerLength ( N - 1 ) ; final long oneSmallerLayerPatty = numPatty ( N - 1 ) ; if ( isOnlyTopSliceRemaining ) { return numPatty ( N ) ; } else { boolean canFinishHalfBurger = X >= ( burgerLength - FIRST_SLICE_IS_BUN - oneSmallerLayerLength ) ; if ( canFinishHalfBurger ) { return oneSmallerLayerPatty + MIDDLE_PATTY + countNumPatty ( N - 1 , X - FIRST_SLICE_IS_BUN - oneSmallerLayerLength - MIDDLE_PATTY ) ; } else { boolean canFinishOneSmallerLayer = ( X - FIRST_SLICE_IS_BUN ) >= ( FIRST_SLICE_IS_BUN + oneSmallerLayerLength ) ; if ( canFinishOneSmallerLayer ) { return oneSmallerLayerPatty ; } else { boolean canEatSomePatty = X > FIRST_SLICE_IS_BUN ; if ( canEatSomePatty ) { return countNumPatty ( N - 1 , X - FIRST_SLICE_IS_BUN ) ; } else { return 0L ; } } } } } }
private static long countNumPatty ( int N , long X ) { if ( X == 0 ) { return 0L ; } final long burgerLength = burgerLength ( N ) ; boolean isWholeBurgerEaten = X >= burgerLength ; if ( isWholeBurgerEaten ) { return numPatty ( N ) ; } else { boolean isOnlyTopSliceRemaining = X == burgerLength - 1 ; final long oneSmallerLayerLength = burgerLength ( N - 1 ) ; final long oneSmallerLayerPatty = numPatty ( N - 1 ) ; if ( isOnlyTopSliceRemaining ) { return numPatty ( N ) ; } else { boolean canFinishHalfBurger = X >= ( burgerLength - FIRST_SLICE_IS_BUN - oneSmallerLayerLength ) ; if ( canFinishHalfBurger ) { return oneSmallerLayerPatty + MIDDLE_PATTY + countNumPatty ( N - 1 , X - FIRST_SLICE_IS_BUN - oneSmallerLayerLength - MIDDLE_PATTY ) ; } else { boolean canFinishOneSmallerLayer = ( X - FIRST_SLICE_IS_BUN ) >= ( FIRST_SLICE_IS_BUN + oneSmallerLayerLength ) ; if ( canFinishOneSmallerLayer ) { return oneSmallerLayerPatty ; } else { boolean canEatSomePatty = X > FIRST_SLICE_IS_BUN ; if ( canEatSomePatty ) { return countNumPatty ( N - 1 , X - FIRST_SLICE_IS_BUN ) ; } else { return 0L ; } } } } } }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (return_statement (decimal_integer_literal)))) (local_variable_declaration (modifiers) type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation name: (identifier) arguments: (argument_list (identifier))))) (local_variable_declaration type: (boolean_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (identifier)))) (if_statement condition: (parenthesized_expression (identifier)) consequence: (block (return_statement (method_invocation name: (identifier) arguments: (argument_list (identifier))))) alternative: (block (local_variable_declaration type: (boolean_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal))))) (local_variable_declaration (modifiers) type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)))))) (local_variable_declaration (modifiers) type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)))))) (if_statement condition: (parenthesized_expression (identifier)) consequence: (block (return_statement (method_invocation name: (identifier) arguments: (argument_list (identifier))))) alternative: (block (local_variable_declaration type: (boolean_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (identifier)))))) (if_statement condition: (parenthesized_expression (identifier)) consequence: (block (return_statement (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)) (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (identifier)) right: (identifier))))))) alternative: (block (local_variable_declaration type: (boolean_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) right: (parenthesized_expression (binary_expression left: (identifier) right: (identifier)))))) (if_statement condition: (parenthesized_expression (identifier)) consequence: (block (return_statement (identifier))) alternative: (block (local_variable_declaration type: (boolean_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (identifier)))) (if_statement condition: (parenthesized_expression (identifier)) consequence: (block (return_statement (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)) (binary_expression left: (identifier) right: (identifier)))))) alternative: (block (return_statement (decimal_integer_literal))))))))))))))
private static long burgerLength ( int layer ) { return ( long ) Math . pow ( 2 , layer + 2 ) - 3L ; }
private static long burgerLength ( int layer ) { return ( long ) Math . pow ( 2 , layer + 2 ) - 3L ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier))) body: (block (return_statement (binary_expression left: (cast_expression type: (integral_type) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal) (binary_expression left: (identifier) right: (decimal_integer_literal))))) right: (decimal_integer_literal)))))
private static long numPatty ( int layer ) { return ( long ) Math . pow ( 2 , layer + 1 ) - 1L ; }
private static long numPatty ( int layer ) { return ( long ) Math . pow ( 2 , layer + 1 ) - 1L ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier))) body: (block (return_statement (binary_expression left: (cast_expression type: (integral_type) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal) (binary_expression left: (identifier) right: (decimal_integer_literal))))) right: (decimal_integer_literal)))))
public static void main ( String [ ] args ) { TestCase testCase = readFromInput ( ) ; final long result = process ( testCase ) ; output ( result ) ; }
public static void main ( String [ ] args ) { TestCase testCase = readFromInput ( ) ; final long result = process ( testCase ) ; output ( result ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (method_invocation name: (identifier) arguments: (argument_list)))) (local_variable_declaration (modifiers) type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation name: (identifier) arguments: (argument_list (identifier))))) (expression_statement (method_invocation name: (identifier) arguments: (argument_list (identifier))))))
private static TestCase readFromInput ( ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; long X = sc . nextLong ( ) ; sc . close ( ) ; return new TestCase ( N , X ) ; }
private static TestCase readFromInput ( ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; long X = sc . nextLong ( ) ; sc . close ( ) ; return new TestCase ( N , X ) ; }
(method_declaration (modifiers) type: (type_identifier) name: (identifier) parameters: (formal_parameters) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) (return_statement (object_creation_expression type: (type_identifier) arguments: (argument_list (identifier) (identifier))))))
private static void output ( long result ) { System . out . println ( result ) ; }
private static void output ( long result ) { System . out . println ( result ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier))) body: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier))))))
public static void main ( String [ ] $ ) { Scanner sc = new Scanner ( in ) ; int n = sc . nextInt ( ) ; long x = sc . nextLong ( ) ; long [ ] a = new long [ 51 ] ; a [ 0 ] = 1 ; long [ ] p = new long [ 51 ] ; p [ 0 ] = 1 ; for ( int i = 0 ; i < 50 ; i ++ ) { a [ i + 1 ] = 2 * a [ i ] + 3 ; p [ i + 1 ] = 2 * p [ i ] + 1 ; } out . println ( f ( a , p , n , x ) ) ; }
public static void main ( String [ ] $ ) { Scanner sc = new Scanner ( in ) ; int n = sc . nextInt ( ) ; long x = sc . nextLong ( ) ; long [ ] a = new long [ 51 ] ; a [ 0 ] = 1 ; long [ ] p = new long [ 51 ] ; p [ 0 ] = 1 ; for ( int i = 0 ; i < 50 ; i ++ ) { a [ i + 1 ] = 2 * a [ i ] + 3 ; p [ i + 1 ] = 2 * p [ i ] + 1 ; } out . println ( f ( a , p , n , x ) ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (identifier))))) (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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (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 (decimal_integer_literal))))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (decimal_integer_literal))) (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 (decimal_integer_literal))))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (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: (decimal_integer_literal)) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (binary_expression left: (binary_expression left: (decimal_integer_literal) right: (array_access array: (identifier) index: (identifier))) right: (decimal_integer_literal)))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (binary_expression left: (binary_expression left: (decimal_integer_literal) right: (array_access array: (identifier) index: (identifier))) right: (decimal_integer_literal)))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation name: (identifier) arguments: (argument_list (identifier) (identifier) (identifier) (identifier))))))))
static long f ( long [ ] a , long [ ] p , int n , long x ) { if ( x == 1 ) return n > 0 ? 0 : 1 ; if ( x == 3 + 2 * a [ n - 1 ] ) return p [ n - 1 ] * 2 + 1 ; if ( x == a [ n - 1 ] + 2 ) return p [ n - 1 ] + 1 ; if ( 1 < x && x <= a [ n - 1 ] + 1 ) return f ( a , p , n - 1 , x - 1 ) ; return p [ n - 1 ] + 1 + f ( a , p , n - 1 , x - a [ n - 1 ] - 2 ) ; }
static long f ( long [ ] a , long [ ] p , int n , long x ) { if ( x == 1 ) return n > 0 ? 0 : 1 ; if ( x == 3 + 2 * a [ n - 1 ] ) return p [ n - 1 ] * 2 + 1 ; if ( x == a [ n - 1 ] + 2 ) return p [ n - 1 ] + 1 ; if ( 1 < x && x <= a [ n - 1 ] + 1 ) return f ( a , p , n - 1 , x - 1 ) ; return p [ n - 1 ] + 1 + f ( a , p , n - 1 , x - a [ n - 1 ] - 2 ) ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (integral_type) dimensions: (dimensions)) name: (identifier)) (formal_parameter type: (array_type element: (integral_type) dimensions: (dimensions)) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (return_statement (ternary_expression condition: (binary_expression left: (identifier) right: (decimal_integer_literal)) consequence: (decimal_integer_literal) alternative: (decimal_integer_literal)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (binary_expression left: (decimal_integer_literal) right: (binary_expression left: (decimal_integer_literal) right: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))))))) consequence: (return_statement (binary_expression left: (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (decimal_integer_literal)) right: (decimal_integer_literal)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (decimal_integer_literal)))) consequence: (return_statement (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (decimal_integer_literal)))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (decimal_integer_literal) right: (identifier)) right: (binary_expression left: (identifier) right: (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (decimal_integer_literal))))) consequence: (return_statement (method_invocation name: (identifier) arguments: (argument_list (identifier) (identifier) (binary_expression left: (identifier) right: (decimal_integer_literal)) (binary_expression left: (identifier) right: (decimal_integer_literal)))))) (return_statement (binary_expression left: (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (decimal_integer_literal)) right: (method_invocation name: (identifier) arguments: (argument_list (identifier) (identifier) (binary_expression left: (identifier) right: (decimal_integer_literal)) (binary_expression left: (binary_expression left: (identifier) right: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal)))) right: (decimal_integer_literal))))))))
public static long getNumPatties ( int level ) { return pow ( 2 , level + 1 ) - 1 ; }
public static long getNumPatties ( int level ) { return pow ( 2 , level + 1 ) - 1 ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier))) body: (block (return_statement (binary_expression left: (method_invocation name: (identifier) arguments: (argument_list (decimal_integer_literal) (binary_expression left: (identifier) right: (decimal_integer_literal)))) right: (decimal_integer_literal)))))
public static long getHeight ( int level ) { return pow ( 2 , level + 2 ) - 3 ; }
public static long getHeight ( int level ) { return pow ( 2 , level + 2 ) - 3 ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier))) body: (block (return_statement (binary_expression left: (method_invocation name: (identifier) arguments: (argument_list (decimal_integer_literal) (binary_expression left: (identifier) right: (decimal_integer_literal)))) right: (decimal_integer_literal)))))
static long pow ( int a , int b ) { long product = 1 ; while ( b > 0 ) { product *= a ; b -- ; } return product ; }
static long pow ( int a , int b ) { long product = 1 ; while ( b > 0 ) { product *= a ; b -- ; } return product ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (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))) (while_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) body: (block (expression_statement (assignment_expression left: (identifier) right: (identifier))) (expression_statement (update_expression (identifier))))) (return_statement (identifier))))
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; long X = sc . nextLong ( ) ; System . out . println ( countPatties ( N , X ) ) ; }
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; long X = sc . nextLong ( ) ; System . out . println ( countPatties ( N , X ) ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (method_invocation name: (identifier) arguments: (argument_list (identifier) (identifier))))))))
public static long countPatties ( int level , long x ) { if ( x == 0 ) { return 0 ; } else if ( level == 0 ) { return 1 ; } else if ( x >= Burger . getHeight ( level ) - level ) { return Burger . getNumPatties ( level ) ; } if ( x < Burger . getHeight ( level - 1 ) + 2 ) { return countPatties ( level - 1 , x - 1 ) ; } else { return Burger . getNumPatties ( level - 1 ) + 1 + countPatties ( level - 1 , x - Burger . getHeight ( level - 1 ) - 2 ) ; } }
public static long countPatties ( int level , long x ) { if ( x == 0 ) { return 0 ; } else if ( level == 0 ) { return 1 ; } else if ( x >= Burger . getHeight ( level ) - level ) { return Burger . getNumPatties ( level ) ; } if ( x < Burger . getHeight ( level - 1 ) + 2 ) { return countPatties ( level - 1 , x - 1 ) ; } else { return Burger . getNumPatties ( level - 1 ) + 1 + countPatties ( level - 1 , x - Burger . getHeight ( level - 1 ) - 2 ) ; } }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (return_statement (decimal_integer_literal))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (return_statement (decimal_integer_literal))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (identifier)))) consequence: (block (return_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)))) right: (decimal_integer_literal)))) consequence: (block (return_statement (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)) (binary_expression left: (identifier) right: (decimal_integer_literal)))))) alternative: (block (return_statement (binary_expression left: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)))) right: (decimal_integer_literal)) right: (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)) (binary_expression left: (binary_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal))))) right: (decimal_integer_literal))))))))))
private static void solve ( ) { int n = nextInt ( ) ; long x = nextLong ( ) ; long [ ] l = new long [ n + 1 ] ; long [ ] p = new long [ n + 1 ] ; l [ 0 ] = 1 ; p [ 0 ] = 1 ; for ( int i = 1 ; i <= n ; i ++ ) { l [ i ] = 2 * l [ i - 1 ] + 3 ; p [ i ] = 2 * p [ i - 1 ] + 1 ; } System . out . println ( get ( n , x , l , p ) ) ; }
private static void solve ( ) { int n = nextInt ( ) ; long x = nextLong ( ) ; long [ ] l = new long [ n + 1 ] ; long [ ] p = new long [ n + 1 ] ; l [ 0 ] = 1 ; p [ 0 ] = 1 ; for ( int i = 1 ; i <= n ; i ++ ) { l [ i ] = 2 * l [ i - 1 ] + 3 ; p [ i ] = 2 * p [ i - 1 ] + 1 ; } System . out . println ( get ( n , x , l , p ) ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation name: (identifier) arguments: (argument_list)))) (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 (binary_expression left: (identifier) right: (decimal_integer_literal)))))) (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 (binary_expression left: (identifier) right: (decimal_integer_literal)))))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (decimal_integer_literal))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (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: (array_access array: (identifier) index: (identifier)) right: (binary_expression left: (binary_expression left: (decimal_integer_literal) right: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal)))) right: (decimal_integer_literal)))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (binary_expression left: (binary_expression left: (decimal_integer_literal) right: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal)))) right: (decimal_integer_literal)))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (method_invocation name: (identifier) arguments: (argument_list (identifier) (identifier) (identifier) (identifier))))))))
private static long get ( int n , long x , long [ ] l , long [ ] p ) { if ( n == 0 ) { return 1 ; } if ( x == 1 ) { return 0 ; } x -- ; if ( x <= l [ n - 1 ] ) { return get ( n - 1 , x , l , p ) ; } x -= l [ n - 1 ] ; if ( x == 1 ) { return p [ n - 1 ] + 1 ; } x -- ; if ( x == l [ n - 1 ] + 1 ) { x -- ; } return p [ n - 1 ] + 1 + get ( n - 1 , x , l , p ) ; }
private static long get ( int n , long x , long [ ] l , long [ ] p ) { if ( n == 0 ) { return 1 ; } if ( x == 1 ) { return 0 ; } x -- ; if ( x <= l [ n - 1 ] ) { return get ( n - 1 , x , l , p ) ; } x -= l [ n - 1 ] ; if ( x == 1 ) { return p [ n - 1 ] + 1 ; } x -- ; if ( x == l [ n - 1 ] + 1 ) { x -- ; } return p [ n - 1 ] + 1 + get ( n - 1 , x , l , p ) ; }
(method_declaration (modifiers) type: (integral_type) 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)) (formal_parameter type: (array_type element: (integral_type) dimensions: (dimensions)) name: (identifier))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (return_statement (decimal_integer_literal)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (return_statement (decimal_integer_literal)))) (expression_statement (update_expression (identifier))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))))) consequence: (block (return_statement (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)) (identifier) (identifier) (identifier)))))) (expression_statement (assignment_expression left: (identifier) right: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (return_statement (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (decimal_integer_literal))))) (expression_statement (update_expression (identifier))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (decimal_integer_literal)))) consequence: (block (expression_statement (update_expression (identifier))))) (return_statement (binary_expression left: (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (decimal_integer_literal)) right: (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)) (identifier) (identifier) (identifier)))))))
private static void run ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; out = new PrintWriter ( System . out ) ; solve ( ) ; out . close ( ) ; }
private static void run ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; out = new PrintWriter ( System . out ) ; solve ( ) ; out . close ( ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters) body: (block (expression_statement (assignment_expression left: (identifier) right: (object_creation_expression type: (type_identifier) arguments: (argument_list (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))))) (expression_statement (assignment_expression left: (identifier) right: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (expression_statement (method_invocation name: (identifier) arguments: (argument_list))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))
private static String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { String s ; try { s = br . readLine ( ) ; } catch ( IOException e ) { return null ; } st = new StringTokenizer ( s ) ; } return st . nextToken ( ) ; }
private static String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { String s ; try { s = br . readLine ( ) ; } catch ( IOException e ) { return null ; } st = new StringTokenizer ( s ) ; } return st . nextToken ( ) ; }
(method_declaration (modifiers) type: (type_identifier) name: (identifier) parameters: (formal_parameters) body: (block (while_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (null_literal)) right: (unary_expression operand: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier))) (try_statement body: (block (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))))) (catch_clause (catch_formal_parameter (catch_type (type_identifier)) name: (identifier)) body: (block (return_statement (null_literal))))) (expression_statement (assignment_expression left: (identifier) right: (object_creation_expression type: (type_identifier) arguments: (argument_list (identifier))))))) (return_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))
private static int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }
private static int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters) body: (block (return_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation name: (identifier) arguments: (argument_list)))))))
private static long nextLong ( ) { return Long . parseLong ( next ( ) ) ; }
private static long nextLong ( ) { return Long . parseLong ( next ( ) ) ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters) body: (block (return_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation name: (identifier) arguments: (argument_list)))))))
public static void main ( String [ ] args ) { run ( ) ; }
public static void main ( String [ ] args ) { run ( ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (expression_statement (method_invocation name: (identifier) arguments: (argument_list)))))
public static void main ( String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { int N = scanner . nextInt ( ) ; long X = scanner . nextLong ( ) ; long [ ] as = new long [ N ] ; long [ ] ps = new long [ N ] ; as [ 0 ] = 1 ; ps [ 0 ] = 1 ; for ( int i = 1 ; i < N ; i ++ ) { as [ i ] = as [ i - 1 ] * 2 + 3 ; ps [ i ] = ps [ i - 1 ] * 2 + 1 ; } System . out . println ( f ( N , X , as , ps ) ) ; } }
public static void main ( String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { int N = scanner . nextInt ( ) ; long X = scanner . nextLong ( ) ; long [ ] as = new long [ N ] ; long [ ] ps = new long [ N ] ; as [ 0 ] = 1 ; ps [ 0 ] = 1 ; for ( int i = 1 ; i < N ; i ++ ) { as [ i ] = as [ i - 1 ] * 2 + 3 ; ps [ i ] = ps [ i - 1 ] * 2 + 1 ; } System . out . println ( f ( N , X , as , ps ) ) ; } }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (try_with_resources_statement resources: (resource_specification (resource type: (type_identifier) name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (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: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (identifier))))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (decimal_integer_literal))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (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: (array_access array: (identifier) index: (identifier)) right: (binary_expression left: (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (decimal_integer_literal)) right: (decimal_integer_literal)))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (binary_expression left: (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (decimal_integer_literal)) right: (decimal_integer_literal)))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (method_invocation name: (identifier) arguments: (argument_list (identifier) (identifier) (identifier) (identifier))))))))))
static long f ( int n , long x , long [ ] a , long [ ] p ) { if ( n == 0 ) { return x > 0 ? 1 : 0 ; } long anp = a [ n - 1 ] ; long pnp = p [ n - 1 ] ; if ( x <= anp + 1 ) { return f ( n - 1 , x - 1 , a , p ) ; } if ( x == x + anp ) { return pnp ; } if ( x <= 2 * anp + 2 ) { return pnp + 1 + f ( n - 1 , x - anp - 2 , a , p ) ; } return 2 * pnp + 1 ; }
static long f ( int n , long x , long [ ] a , long [ ] p ) { if ( n == 0 ) { return x > 0 ? 1 : 0 ; } long anp = a [ n - 1 ] ; long pnp = p [ n - 1 ] ; if ( x <= anp + 1 ) { return f ( n - 1 , x - 1 , a , p ) ; } if ( x == x + anp ) { return pnp ; } if ( x <= 2 * anp + 2 ) { return pnp + 1 + f ( n - 1 , x - anp - 2 , a , p ) ; } return 2 * pnp + 1 ; }
(method_declaration (modifiers) type: (integral_type) 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)) (formal_parameter type: (array_type element: (integral_type) dimensions: (dimensions)) name: (identifier))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (return_statement (ternary_expression condition: (binary_expression left: (identifier) right: (decimal_integer_literal)) consequence: (decimal_integer_literal) alternative: (decimal_integer_literal))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (array_access array: (identifier) index: (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: (binary_expression left: (identifier) right: (decimal_integer_literal))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) consequence: (block (return_statement (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)) (binary_expression left: (identifier) right: (decimal_integer_literal)) (identifier) (identifier)))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (identifier)))) consequence: (block (return_statement (identifier)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (binary_expression left: (binary_expression left: (decimal_integer_literal) right: (identifier)) right: (decimal_integer_literal)))) consequence: (block (return_statement (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)) (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal)) (identifier) (identifier))))))) (return_statement (binary_expression left: (binary_expression left: (decimal_integer_literal) right: (identifier)) right: (decimal_integer_literal)))))
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; ArrayList < Integer > odd = new ArrayList < > ( ) ; ArrayList < Integer > even = new ArrayList < > ( ) ; for ( int i = 0 ; i < M ; i ++ ) { int A = sc . nextInt ( ) ; if ( A % 2 == 0 ) even . add ( A ) ; else odd . add ( A ) ; } if ( odd . size ( ) > 2 ) { System . out . println ( "Impossible" ) ; } else { ArrayList < Integer > list = new ArrayList < > ( ) ; if ( odd . size ( ) > 0 ) list . add ( odd . get ( 0 ) ) ; list . addAll ( even ) ; if ( odd . size ( ) > 1 ) list . add ( odd . get ( 1 ) ) ; printList ( list ) ; if ( list . size ( ) == 1 ) { if ( list . get ( 0 ) > 1 ) { list . set ( 0 , list . get ( 0 ) - 1 ) ; list . add ( 1 ) ; } } else { list . set ( 0 , list . get ( 0 ) - 1 ) ; list . set ( list . size ( ) - 1 , list . get ( list . size ( ) - 1 ) - 1 ) ; list . add ( 1 , 2 ) ; if ( list . get ( 0 ) == 0 ) list . remove ( 0 ) ; if ( list . get ( list . size ( ) - 1 ) == 0 ) list . remove ( list . size ( ) - 1 ) ; } System . out . println ( list . size ( ) ) ; printList ( list ) ; } sc . close ( ) ; }
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; ArrayList < Integer > odd = new ArrayList < > ( ) ; ArrayList < Integer > even = new ArrayList < > ( ) ; for ( int i = 0 ; i < M ; i ++ ) { int A = sc . nextInt ( ) ; if ( A % 2 == 0 ) even . add ( A ) ; else odd . add ( A ) ; } if ( odd . size ( ) > 2 ) { System . out . println ( " Impossible " ) ; } else { ArrayList < Integer > list = new ArrayList < > ( ) ; if ( odd . size ( ) > 0 ) list . add ( odd . get ( 0 ) ) ; list . addAll ( even ) ; if ( odd . size ( ) > 1 ) list . add ( odd . get ( 1 ) ) ; printList ( list ) ; if ( list . size ( ) == 1 ) { if ( list . get ( 0 ) > 1 ) { list . set ( 0 , list . get ( 0 ) - 1 ) ; list . add ( 1 ) ; } } else { list . set ( 0 , list . get ( 0 ) - 1 ) ; list . set ( list . size ( ) - 1 , list . get ( list . size ( ) - 1 ) - 1 ) ; list . add ( 1 , 2 ) ; if ( list . get ( 0 ) == 0 ) list . remove ( 0 ) ; if ( list . get ( list . size ( ) - 1 ) == 0 ) list . remove ( list . size ( ) - 1 ) ; } System . out . println ( list . size ( ) ) ; printList ( list ) ; } sc . close ( ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (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)))) (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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal))) consequence: (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) alternative: (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))))) (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal))))) alternative: (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)))) (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal))) consequence: (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal))))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal))) consequence: (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal))))))) (expression_statement (method_invocation name: (identifier) arguments: (argument_list (identifier)))) (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal))) consequence: (block (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal))) right: (decimal_integer_literal))) consequence: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal) (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal))) right: (decimal_integer_literal))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal))))))) alternative: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal) (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal))) right: (decimal_integer_literal))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal)) (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal)))) right: (decimal_integer_literal))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal) (decimal_integer_literal)))) (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal))) right: (decimal_integer_literal))) consequence: (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal))))) (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal)))) right: (decimal_integer_literal))) consequence: (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal)))))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))))) (expression_statement (method_invocation name: (identifier) arguments: (argument_list (identifier)))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))
static void printList ( ArrayList < Integer > list ) { for ( int i = 0 ; i < list . size ( ) ; i ++ ) System . out . print ( list . get ( i ) + ( i == list . size ( ) - 1 ? "\n" : " " ) ) ; }
static void printList ( ArrayList < Integer > list ) { for ( int i = 0 ; i < list . size ( ) ; i ++ ) System . out . print ( list . get ( i ) + ( i == list . size ( ) - 1 ? " \n " : " ▁ " ) ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (generic_type (type_identifier) (type_arguments (type_identifier))) name: (identifier))) body: (block (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) update: (update_expression (identifier)) body: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (parenthesized_expression (ternary_expression condition: (binary_expression left: (identifier) right: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal))) consequence: (string_literal) alternative: (string_literal))))))))))
public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int N = scan . nextInt ( ) ; int M = scan . nextInt ( ) ; List < Integer > odd = new ArrayList < > ( ) ; List < Integer > even = new ArrayList < > ( ) ; for ( int i = 0 ; i < M ; ++ i ) { int a = scan . nextInt ( ) ; if ( a % 2 == 0 ) even . add ( a ) ; else odd . add ( a ) ; } if ( odd . size ( ) > 2 ) { System . out . println ( "Impossible" ) ; return ; } List < Integer > ans = new ArrayList < > ( ) ; if ( odd . size ( ) >= 1 ) { int d = odd . remove ( 0 ) ; System . out . print ( d + " " ) ; while ( d > 1 ) { ans . add ( 2 ) ; d -= 2 ; } } else { int d = even . remove ( 0 ) ; System . out . print ( d + " " ) ; ans . add ( d - 1 ) ; } for ( int i = 0 ; i < even . size ( ) ; ++ i ) { ans . add ( even . get ( i ) ) ; System . out . print ( even . get ( i ) + " " ) ; } if ( odd . size ( ) >= 1 ) { int d = odd . remove ( 0 ) ; System . out . print ( d + " " ) ; while ( d > 0 ) { ans . add ( 2 ) ; d -= 2 ; } } else { ans . add ( 1 ) ; } System . out . println ( ) ; System . out . println ( ans . size ( ) ) ; for ( int i : ans ) System . out . print ( i + " " ) ; System . out . println ( ) ; }
public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int N = scan . nextInt ( ) ; int M = scan . nextInt ( ) ; List < Integer > odd = new ArrayList < > ( ) ; List < Integer > even = new ArrayList < > ( ) ; for ( int i = 0 ; i < M ; ++ i ) { int a = scan . nextInt ( ) ; if ( a % 2 == 0 ) even . add ( a ) ; else odd . add ( a ) ; } if ( odd . size ( ) > 2 ) { System . out . println ( " Impossible " ) ; return ; } List < Integer > ans = new ArrayList < > ( ) ; if ( odd . size ( ) >= 1 ) { int d = odd . remove ( 0 ) ; System . out . print ( d + " ▁ " ) ; while ( d > 1 ) { ans . add ( 2 ) ; d -= 2 ; } } else { int d = even . remove ( 0 ) ; System . out . print ( d + " ▁ " ) ; ans . add ( d - 1 ) ; } for ( int i = 0 ; i < even . size ( ) ; ++ i ) { ans . add ( even . get ( i ) ) ; System . out . print ( even . get ( i ) + " ▁ " ) ; } if ( odd . size ( ) >= 1 ) { int d = odd . remove ( 0 ) ; System . out . print ( d + " ▁ " ) ; while ( d > 0 ) { ans . add ( 2 ) ; d -= 2 ; } } else { ans . add ( 1 ) ; } System . out . println ( ) ; System . out . println ( ans . size ( ) ) ; for ( int i : ans ) System . out . print ( i + " ▁ " ) ; System . out . println ( ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (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)))) (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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal))) consequence: (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) alternative: (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))))) (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal)))) (return_statement))) (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)))) (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal))) consequence: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (string_literal))))) (while_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) body: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal)))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal)))))) alternative: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (string_literal))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) update: (update_expression (identifier)) body: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (string_literal))))))) (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal))) consequence: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (string_literal))))) (while_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) body: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal)))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal)))))) alternative: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal)))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))))) (enhanced_for_statement type: (integral_type) name: (identifier) value: (identifier) body: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (string_literal)))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list)))))
public static void main ( String [ ] $ ) { Scanner sc = new Scanner ( in ) ; int n = sc . nextInt ( ) ; int ans = Integer . MAX_VALUE ; int s1 = n / 6 , s2 = n / 9 ; int [ ] TS = new int [ n + 1 ] ; int [ ] TN = new int [ n + 1 ] ; for ( int i = 0 ; i <= n ; i ++ ) { int temp = i ; while ( temp / 6 > 0 ) { TS [ i ] += temp % 6 ; temp /= 6 ; } TS [ i ] += temp ; temp = i ; while ( temp / 9 > 0 ) { TN [ i ] += temp % 9 ; temp /= 9 ; } TN [ i ] += temp ; } for ( int i = 0 ; i <= s1 ; i ++ ) { int six = 6 * i ; int nine = ( n - six ) - ( n - six ) % 9 ; if ( six + nine <= n && six <= n && nine <= n ) ans = min ( ans , TS [ six ] + TN [ nine ] + ( n - six - nine ) ) ; } out . println ( ans ) ; }
public static void main ( String [ ] $ ) { Scanner sc = new Scanner ( in ) ; int n = sc . nextInt ( ) ; int ans = Integer . MAX_VALUE ; int s1 = n / 6 , s2 = n / 9 ; int [ ] TS = new int [ n + 1 ] ; int [ ] TN = new int [ n + 1 ] ; for ( int i = 0 ; i <= n ; i ++ ) { int temp = i ; while ( temp / 6 > 0 ) { TS [ i ] += temp % 6 ; temp /= 6 ; } TS [ i ] += temp ; temp = i ; while ( temp / 9 > 0 ) { TN [ i ] += temp % 9 ; temp /= 9 ; } TN [ i ] += temp ; } for ( int i = 0 ; i <= s1 ; i ++ ) { int six = 6 * i ; int nine = ( n - six ) - ( n - six ) % 9 ; if ( six + nine <= n && six <= n && nine <= n ) ans = min ( ans , TS [ six ] + TN [ nine ] + ( n - six - nine ) ) ; } out . println ( ans ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (identifier))))) (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: (field_access object: (identifier) field: (identifier)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (decimal_integer_literal))) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (decimal_integer_literal)))) (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 (binary_expression left: (identifier) right: (decimal_integer_literal)))))) (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 (binary_expression left: (identifier) right: (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 (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (identifier))) (while_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal))) body: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier))) (expression_statement (assignment_expression left: (identifier) right: (identifier))) (while_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal))) body: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (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 (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (decimal_integer_literal) right: (identifier)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) right: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) right: (decimal_integer_literal))))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (identifier)) right: (binary_expression left: (identifier) right: (identifier))) right: (binary_expression left: (identifier) right: (identifier)))) consequence: (expression_statement (assignment_expression left: (identifier) right: (method_invocation name: (identifier) arguments: (argument_list (identifier) (binary_expression left: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (identifier))) right: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (identifier))))))))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))))
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int count = n ; for ( int i = 0 ; i <= n ; i ++ ) { int t = i ; int c = 0 ; while ( t > 0 ) { c += t % 6 ; t /= 6 ; } t = n - i ; while ( t > 0 ) { c += t % 9 ; t /= 9 ; } count = Math . min ( count , c ) ; } System . out . println ( count ) ; }
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int count = n ; for ( int i = 0 ; i <= n ; i ++ ) { int t = i ; int c = 0 ; while ( t > 0 ) { c += t % 6 ; t /= 6 ; } t = n - i ; while ( t > 0 ) { c += t % 9 ; t /= 9 ; } count = Math . min ( count , c ) ; } System . out . println ( count ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (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: (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 (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (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: (decimal_integer_literal))) body: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (identifier)))) (while_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) body: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (identifier))))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier))))))
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; Set < Integer > candidates = new TreeSet < > ( ) ; long tmp = 1 ; while ( tmp <= N ) { candidates . add ( ( int ) tmp ) ; tmp *= 6 ; } tmp = 1 ; while ( tmp <= N ) { candidates . add ( ( int ) tmp ) ; tmp *= 9 ; } int INF = 1_000_000 ; int dp [ ] = new int [ N + 1 ] ; Arrays . fill ( dp , INF ) ; dp [ 0 ] = 0 ; for ( int i = 1 ; i <= N ; i ++ ) { for ( int n : candidates ) { if ( i >= n ) { dp [ i ] = Math . min ( dp [ i ] , dp [ i - n ] + 1 ) ; } } } out . println ( dp [ N ] ) ; }
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; Set < Integer > candidates = new TreeSet < > ( ) ; long tmp = 1 ; while ( tmp <= N ) { candidates . add ( ( int ) tmp ) ; tmp *= 6 ; } tmp = 1 ; while ( tmp <= N ) { candidates . add ( ( int ) tmp ) ; tmp *= 9 ; } int INF = 1_000_000 ; int dp [ ] = new int [ N + 1 ] ; Arrays . fill ( dp , INF ) ; dp [ 0 ] = 0 ; for ( int i = 1 ; i <= N ; i ++ ) { for ( int n : candidates ) { if ( i >= n ) { dp [ i ] = Math . min ( dp [ i ] , dp [ i - n ] + 1 ) ; } } } out . println ( dp [ N ] ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (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: (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)))) (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 (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (cast_expression type: (integral_type) value: (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))) (while_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) body: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (cast_expression type: (integral_type) value: (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))))) (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) dimensions: (dimensions) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (binary_expression left: (identifier) right: (decimal_integer_literal)))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (identifier)))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (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 (enhanced_for_statement type: (integral_type) name: (identifier) value: (identifier) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (identifier)) (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (identifier))) right: (decimal_integer_literal)))))))))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (identifier)))))))
public static void main ( String [ ] args ) { int N = sc . nextInt ( ) ; dp = new int [ N + 1 ] ; Arrays . fill ( dp , Integer . MAX_VALUE ) ; dp [ 0 ] = 0 ; calc ( N ) ; System . out . println ( dp [ N ] ) ; }
public static void main ( String [ ] args ) { int N = sc . nextInt ( ) ; dp = new int [ N + 1 ] ; Arrays . fill ( dp , Integer . MAX_VALUE ) ; dp [ 0 ] = 0 ; calc ( N ) ; System . out . println ( dp [ N ] ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) 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)))) (expression_statement (assignment_expression left: (identifier) right: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (binary_expression left: (identifier) right: (decimal_integer_literal)))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (field_access object: (identifier) field: (identifier))))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (decimal_integer_literal))) (expression_statement (method_invocation name: (identifier) arguments: (argument_list (identifier)))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (identifier)))))))
private static void calc ( int n ) { for ( int i = 1 ; i <= n ; i ++ ) { int power = 1 ; int ans = Integer . MAX_VALUE ; while ( 0 <= i - power ) { ans = Math . min ( ans , 1 + dp [ i - power ] ) ; power *= 6 ; } power = 1 ; while ( 0 <= i - power ) { ans = Math . min ( ans , 1 + dp [ i - power ] ) ; power *= 9 ; } dp [ i ] = ans ; } }
private static void calc ( int n ) { for ( int i = 1 ; i <= n ; i ++ ) { int power = 1 ; int ans = Integer . MAX_VALUE ; while ( 0 <= i - power ) { ans = Math . min ( ans , 1 + dp [ i - power ] ) ; power *= 6 ; } power = 1 ; while ( 0 <= i - power ) { ans = Math . min ( ans , 1 + dp [ i - power ] ) ; power *= 9 ; } dp [ i ] = ans ; } }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier))) body: (block (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: (decimal_integer_literal))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (field_access object: (identifier) field: (identifier)))) (while_statement condition: (parenthesized_expression (binary_expression left: (decimal_integer_literal) right: (binary_expression left: (identifier) right: (identifier)))) body: (block (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (binary_expression left: (decimal_integer_literal) right: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (identifier)))))))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))) (while_statement condition: (parenthesized_expression (binary_expression left: (decimal_integer_literal) right: (binary_expression left: (identifier) right: (identifier)))) body: (block (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (binary_expression left: (decimal_integer_literal) right: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (identifier)))))))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier)))))))
public static void main ( String [ ] args ) { final int INF = Integer . MAX_VALUE ; Scanner scn = new Scanner ( System . in ) ; int N = scn . nextInt ( ) ; ArrayList < Integer > coins = new ArrayList < Integer > ( ) ; coins . add ( 1 ) ; for ( int i = 1 ; ; i ++ ) { int buf = ( int ) Math . pow ( 6 , i ) ; if ( buf > N ) break ; coins . add ( buf ) ; } for ( int i = 1 ; ; i ++ ) { int buf = ( int ) Math . pow ( 9 , i ) ; if ( buf > N ) break ; coins . add ( buf ) ; } int [ ] DP = new int [ N + 1 ] ; DP [ 0 ] = 0 ; for ( int i = 1 ; i <= N ; i ++ ) { DP [ i ] = INF ; } int length = coins . size ( ) ; for ( int i = 1 ; i <= N ; i ++ ) { for ( int j = 0 ; j < length ; j ++ ) { int coin = coins . get ( j ) ; if ( i >= coin ) { DP [ i ] = Math . min ( DP [ i ] , DP [ i - coin ] + 1 ) ; } } } System . out . println ( DP [ N ] ) ; }
public static void main ( String [ ] args ) { final int INF = Integer . MAX_VALUE ; Scanner scn = new Scanner ( System . in ) ; int N = scn . nextInt ( ) ; ArrayList < Integer > coins = new ArrayList < Integer > ( ) ; coins . add ( 1 ) ; for ( int i = 1 ; ; i ++ ) { int buf = ( int ) Math . pow ( 6 , i ) ; if ( buf > N ) break ; coins . add ( buf ) ; } for ( int i = 1 ; ; i ++ ) { int buf = ( int ) Math . pow ( 9 , i ) ; if ( buf > N ) break ; coins . add ( buf ) ; } int [ ] DP = new int [ N + 1 ] ; DP [ 0 ] = 0 ; for ( int i = 1 ; i <= N ; i ++ ) { DP [ i ] = INF ; } int length = coins . size ( ) ; for ( int i = 1 ; i <= N ; i ++ ) { for ( int j = 0 ; j < length ; j ++ ) { int coin = coins . get ( j ) ; if ( i >= coin ) { DP [ i ] = Math . min ( DP [ i ] , DP [ i - coin ] + 1 ) ; } } } System . out . println ( DP [ N ] ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration (modifiers) type: (integral_type) declarator: (variable_declarator name: (identifier) value: (field_access object: (identifier) field: (identifier)))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (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: (generic_type (type_identifier) (type_arguments (type_identifier))) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (generic_type (type_identifier) (type_arguments (type_identifier))) arguments: (argument_list)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal)))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) update: (update_expression (identifier)) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (cast_expression type: (integral_type) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal) (identifier)))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (break_statement)) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) update: (update_expression (identifier)) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (cast_expression type: (integral_type) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal) (identifier)))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (break_statement)) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (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 (binary_expression left: (identifier) right: (decimal_integer_literal)))))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (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: (array_access array: (identifier) index: (identifier)) right: (identifier))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) 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 (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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (identifier)) (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (identifier))) right: (decimal_integer_literal)))))))))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (identifier)))))))
public static void main ( String [ ] args ) { new Problem ( ) . solve ( ) ; }
public static void main ( String [ ] args ) { new Problem ( ) . solve ( ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (expression_statement (method_invocation object: (object_creation_expression type: (type_identifier) arguments: (argument_list)) name: (identifier) arguments: (argument_list)))))
public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; }
public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (expression_statement (method_invocation object: (object_creation_expression type: (type_identifier) arguments: (argument_list)) name: (identifier) arguments: (argument_list)))))
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = 0 ; int [ ] [ ] ans ; if ( n % 2 == 0 ) { m = ( n - 2 ) * n / 2 ; ans = new int [ m ] [ 2 ] ; int c = 0 ; for ( int i = 1 ; i < n ; i ++ ) { for ( int j = i + 1 ; j <= n ; j ++ ) { if ( i + j == n + 1 ) continue ; ans [ c ] [ 0 ] = i ; ans [ c ] [ 1 ] = j ; c ++ ; } } } else { int n2 = n - 1 ; m = ( n2 - 2 ) * n2 / 2 + n2 ; ans = new int [ m ] [ 2 ] ; int c = 0 ; for ( int i = 1 ; i < n ; i ++ ) { for ( int j = i + 1 ; j <= n ; j ++ ) { if ( i + j == n ) continue ; ans [ c ] [ 0 ] = i ; ans [ c ] [ 1 ] = j ; c ++ ; } } } System . out . println ( m ) ; for ( int i = 0 ; i < m ; i ++ ) { System . out . println ( ans [ i ] [ 0 ] + " " + ans [ i ] [ 1 ] ) ; } sc . close ( ) ; }
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = 0 ; int [ ] [ ] ans ; if ( n % 2 == 0 ) { m = ( n - 2 ) * n / 2 ; ans = new int [ m ] [ 2 ] ; int c = 0 ; for ( int i = 1 ; i < n ; i ++ ) { for ( int j = i + 1 ; j <= n ; j ++ ) { if ( i + j == n + 1 ) continue ; ans [ c ] [ 0 ] = i ; ans [ c ] [ 1 ] = j ; c ++ ; } } } else { int n2 = n - 1 ; m = ( n2 - 2 ) * n2 / 2 + n2 ; ans = new int [ m ] [ 2 ] ; int c = 0 ; for ( int i = 1 ; i < n ; i ++ ) { for ( int j = i + 1 ; j <= n ; j ++ ) { if ( i + j == n ) continue ; ans [ c ] [ 0 ] = i ; ans [ c ] [ 1 ] = j ; c ++ ; } } } System . out . println ( m ) ; for ( int i = 0 ; i < m ; i ++ ) { System . out . println ( ans [ i ] [ 0 ] + " ▁ " + ans [ i ] [ 1 ] ) ; } sc . close ( ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (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: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (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 (assignment_expression left: (identifier) right: (binary_expression left: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (identifier)) right: (decimal_integer_literal)))) (expression_statement (assignment_expression left: (identifier) right: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (identifier)) dimensions: (dimensions_expr (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: (identifier)) update: (update_expression (identifier)) body: (block (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (decimal_integer_literal)))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) consequence: (continue_statement)) (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (decimal_integer_literal)) right: (identifier))) (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (decimal_integer_literal)) right: (identifier))) (expression_statement (update_expression (identifier)))))))) alternative: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (decimal_integer_literal)))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (binary_expression left: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (identifier)) right: (decimal_integer_literal)) right: (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (identifier)) dimensions: (dimensions_expr (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: (identifier)) update: (update_expression (identifier)) body: (block (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (decimal_integer_literal)))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (identifier))) consequence: (continue_statement)) (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (decimal_integer_literal)) right: (identifier))) (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (decimal_integer_literal)) right: (identifier))) (expression_statement (update_expression (identifier))))))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (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: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (decimal_integer_literal)) right: (string_literal)) right: (array_access array: (array_access array: (identifier) index: (identifier)) index: (decimal_integer_literal)))))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))
public static void main ( String [ ] args ) { Main ins = new Main ( ) ; ins . makeGroups ( ) ; ins . show ( ) ; }
public static void main ( String [ ] args ) { Main ins = new Main ( ) ; ins . makeGroups ( ) ; ins . show ( ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))
public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int num = sc . nextInt ( ) ; System . out . println ( num * ( num - 1 ) / 2 - num / 2 ) ; for ( int i = 1 ; i <= num ; i ++ ) { for ( int j = 1 ; j < i ; j ++ ) { if ( i + j == num / 2 * 2 + 1 ) { continue ; } System . out . println ( i + " " + j ) ; } } }
public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int num = sc . nextInt ( ) ; System . out . println ( num * ( num - 1 ) / 2 - num / 2 ) ; for ( int i = 1 ; i <= num ; i ++ ) { for ( int j = 1 ; j < i ; j ++ ) { if ( i + j == num / 2 * 2 + 1 ) { continue ; } System . out . println ( i + " ▁ " + j ) ; } } }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) name: (identifier) dimensions: (dimensions))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal)))) right: (decimal_integer_literal)) right: (binary_expression left: (identifier) right: (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 (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 (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal)) right: (decimal_integer_literal)))) consequence: (block (continue_statement))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (identifier) right: (string_literal)) right: (identifier)))))))))))
public static void input ( ) { Scanner scan = new Scanner ( System . in ) ; for ( int i = 0 ; i < 7 ; i ++ ) { D [ i ] = scan . nextInt ( ) ; } for ( int i = 0 ; i < 7 ; i ++ ) { J [ i ] = scan . nextInt ( ) ; } }
public static void input ( ) { Scanner scan = new Scanner ( System . in ) ; for ( int i = 0 ; i < 7 ; i ++ ) { D [ i ] = scan . nextInt ( ) ; } for ( int i = 0 ; i < 7 ; i ++ ) { J [ i ] = scan . nextInt ( ) ; } }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (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: (decimal_integer_literal)) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (method_invocation object: (identifier) name: (identifier) 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: (decimal_integer_literal)) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))))))))
public static void main ( String args [ ] ) { input ( ) ; int ans = 0 ; for ( int i = 0 ; i < 7 ; i ++ ) { if ( D [ i ] >= J [ i ] ) ans += D [ i ] ; else ans += J [ i ] ; } System . out . println ( ans ) ; }
public static void main ( String args [ ] ) { input ( ) ; int ans = 0 ; for ( int i = 0 ; i < 7 ; i ++ ) { if ( D [ i ] >= J [ i ] ) ans += D [ i ] ; else ans += J [ i ] ; } System . out . println ( ans ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) name: (identifier) dimensions: (dimensions))) body: (block (expression_statement (method_invocation name: (identifier) arguments: (argument_list))) (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: (decimal_integer_literal)) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (identifier)))) consequence: (expression_statement (assignment_expression left: (identifier) right: (array_access array: (identifier) index: (identifier)))) alternative: (expression_statement (assignment_expression left: (identifier) right: (array_access array: (identifier) index: (identifier))))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier))))))
public static void main ( String [ ] $ ) { Scanner sc = new Scanner ( in ) ; int ans = 0 ; int [ ] d = new int [ 7 ] ; int [ ] j = new int [ 7 ] ; for ( int i = 0 ; i < 7 ; i ++ ) { d [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < 7 ; i ++ ) { j [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < 7 ; i ++ ) { ans += max ( d [ i ] , j [ i ] ) ; } out . println ( ans ) ; }
public static void main ( String [ ] $ ) { Scanner sc = new Scanner ( in ) ; int ans = 0 ; int [ ] d = new int [ 7 ] ; int [ ] j = new int [ 7 ] ; for ( int i = 0 ; i < 7 ; i ++ ) { d [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < 7 ; i ++ ) { j [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < 7 ; i ++ ) { ans += max ( d [ i ] , j [ i ] ) ; } out . println ( ans ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (identifier))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (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 (decimal_integer_literal))))) (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 (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: (decimal_integer_literal)) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (method_invocation object: (identifier) name: (identifier) 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: (decimal_integer_literal)) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (method_invocation object: (identifier) name: (identifier) 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: (decimal_integer_literal)) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (identifier) right: (method_invocation name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (identifier)) (array_access array: (identifier) index: (identifier)))))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))))
public static void main ( String args [ ] ) { int max_sum = 0 ; Scanner scan = new Scanner ( System . in ) ; ArrayList < Integer > d = new ArrayList < Integer > ( ) ; ArrayList < Integer > j = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < 7 ; i ++ ) d . add ( scan . nextInt ( ) ) ; for ( int i = 0 ; i < 7 ; i ++ ) j . add ( scan . nextInt ( ) ) ; for ( int i = 0 ; i < 7 ; i ++ ) max_sum += Math . max ( d . get ( i ) , j . get ( i ) ) ; System . out . println ( max_sum ) ; }
public static void main ( String args [ ] ) { int max_sum = 0 ; Scanner scan = new Scanner ( System . in ) ; ArrayList < Integer > d = new ArrayList < Integer > ( ) ; ArrayList < Integer > j = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < 7 ; i ++ ) d . add ( scan . nextInt ( ) ) ; for ( int i = 0 ; i < 7 ; i ++ ) j . add ( scan . nextInt ( ) ) ; for ( int i = 0 ; i < 7 ; i ++ ) max_sum += Math . max ( d . get ( i ) , j . get ( i ) ) ; System . out . println ( max_sum ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) name: (identifier) dimensions: (dimensions))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (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 (type_identifier))) arguments: (argument_list)))) (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 (type_identifier))) 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: (decimal_integer_literal)) update: (update_expression (identifier)) body: (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) 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: (decimal_integer_literal)) update: (update_expression (identifier)) body: (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) 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: (decimal_integer_literal)) update: (update_expression (identifier)) body: (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier))))))
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] d = new int [ 7 ] ; int [ ] j = new int [ 7 ] ; for ( int i = 0 ; i < 7 ; i ++ ) { d [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < 7 ; i ++ ) { j [ i ] = sc . nextInt ( ) ; } int ans = 0 ; for ( int i = 0 ; i < 7 ; i ++ ) { if ( d [ i ] >= j [ i ] ) { ans += d [ i ] ; } else { ans += j [ i ] ; } } System . out . println ( ans ) ; }
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] d = new int [ 7 ] ; int [ ] j = new int [ 7 ] ; for ( int i = 0 ; i < 7 ; i ++ ) { d [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < 7 ; i ++ ) { j [ i ] = sc . nextInt ( ) ; } int ans = 0 ; for ( int i = 0 ; i < 7 ; i ++ ) { if ( d [ i ] >= j [ i ] ) { ans += d [ i ] ; } else { ans += j [ i ] ; } } System . out . println ( ans ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (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 (decimal_integer_literal))))) (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 (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: (decimal_integer_literal)) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (method_invocation object: (identifier) name: (identifier) 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: (decimal_integer_literal)) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))) (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: (decimal_integer_literal)) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (identifier)))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (array_access array: (identifier) index: (identifier))))) alternative: (block (expression_statement (assignment_expression left: (identifier) right: (array_access array: (identifier) index: (identifier)))))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier))))))
public static void main ( String [ ] args ) { int [ ] d = new int [ 7 ] , j = new int [ 7 ] ; int sum = 0 ; for ( int i = 0 ; i < 7 ; i ++ ) d [ i ] = s . nextInt ( ) ; for ( int i = 0 ; i < 7 ; i ++ ) j [ i ] = s . nextInt ( ) ; for ( int i = 0 ; i < 7 ; i ++ ) sum += Math . max ( d [ i ] , j [ i ] ) ; System . out . println ( sum ) ; }
public static void main ( String [ ] args ) { int [ ] d = new int [ 7 ] , j = new int [ 7 ] ; int sum = 0 ; for ( int i = 0 ; i < 7 ; i ++ ) d [ i ] = s . nextInt ( ) ; for ( int i = 0 ; i < 7 ; i ++ ) j [ i ] = s . nextInt ( ) ; for ( int i = 0 ; i < 7 ; i ++ ) sum += Math . max ( d [ i ] , j [ i ] ) ; System . out . println ( sum ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (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 (decimal_integer_literal)))) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (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: (decimal_integer_literal)) update: (update_expression (identifier)) body: (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (method_invocation object: (identifier) name: (identifier) 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: (decimal_integer_literal)) update: (update_expression (identifier)) body: (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (method_invocation object: (identifier) name: (identifier) 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: (decimal_integer_literal)) update: (update_expression (identifier)) body: (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (identifier)) (array_access array: (identifier) index: (identifier))))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier))))))
public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int B [ ] = new int [ N ] ; LinkedList list [ ] = new LinkedList [ N + 1 ] ; for ( int i = 0 ; i < N + 1 ; i ++ ) { list [ i ] = new LinkedList ( ) ; } for ( int i = 1 ; i < N ; i ++ ) { B [ i ] = sc . nextInt ( ) ; list [ B [ i ] - 1 ] . add ( i ) ; } System . out . println ( get_money ( 0 , list ) ) ; }
public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int B [ ] = new int [ N ] ; LinkedList list [ ] = new LinkedList [ N + 1 ] ; for ( int i = 0 ; i < N + 1 ; i ++ ) { list [ i ] = new LinkedList ( ) ; } for ( int i = 1 ; i < N ; i ++ ) { B [ i ] = sc . nextInt ( ) ; list [ B [ i ] - 1 ] . add ( i ) ; } System . out . println ( get_money ( 0 , list ) ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) name: (identifier) dimensions: (dimensions))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (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) dimensions: (dimensions) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (identifier))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) dimensions: (dimensions) value: (array_creation_expression type: (type_identifier) dimensions: (dimensions_expr (binary_expression left: (identifier) right: (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 (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (object_creation_expression type: (type_identifier) 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 (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (expression_statement (method_invocation object: (array_access array: (identifier) index: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal))) name: (identifier) arguments: (argument_list (identifier)))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (method_invocation name: (identifier) arguments: (argument_list (decimal_integer_literal) (identifier))))))))
public static int get_money ( int num , LinkedList list [ ] ) { if ( list [ num ] . size ( ) == 0 ) { return 1 ; } else { int min = Integer . MAX_VALUE ; int max = 0 ; for ( int i = 0 ; i < list [ num ] . size ( ) ; i ++ ) { int n = get_money ( list [ num ] . get ( i ) , list ) ; min = Math . min ( min , n ) ; max = Math . max ( max , n ) ; } return min + max + 1 ; } }
public static int get_money ( int num , LinkedList list [ ] ) { if ( list [ num ] . size ( ) == 0 ) { return 1 ; } else { int min = Integer . MAX_VALUE ; int max = 0 ; for ( int i = 0 ; i < list [ num ] . size ( ) ; i ++ ) { int n = get_money ( list [ num ] . get ( i ) , list ) ; min = Math . min ( min , n ) ; max = Math . max ( max , n ) ; } return min + max + 1 ; } }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (type_identifier) name: (identifier) dimensions: (dimensions))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (array_access array: (identifier) index: (identifier)) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal))) consequence: (block (return_statement (decimal_integer_literal))) alternative: (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: (method_invocation object: (array_access array: (identifier) index: (identifier)) name: (identifier) arguments: (argument_list))) update: (update_expression (identifier)) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation name: (identifier) arguments: (argument_list (method_invocation object: (array_access array: (identifier) index: (identifier)) name: (identifier) arguments: (argument_list (identifier))) (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (identifier))))))) (return_statement (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal)))))))
public static void main ( String [ ] $ ) { int n = scanner . nextInt ( ) ; int [ ] salary = new int [ n ] ; List < Integer > [ ] list = IntStream . range ( 0 , n ) . mapToObj ( i -> new ArrayList < > ( ) ) . toArray ( List [ ] :: new ) ; for ( int i = 1 ; i < n ; i ++ ) list [ scanner . nextInt ( ) - 1 ] . add ( i ) ; boolean flag = true ; while ( flag ) { flag = false ; for ( int i = 0 ; i < n ; i ++ ) { int [ ] array = list [ i ] . stream ( ) . mapToInt ( j -> salary [ j ] ) . toArray ( ) ; if ( salary [ i ] == 0 && Arrays . stream ( array ) . noneMatch ( j -> j == 0 ) ) { flag = true ; salary [ i ] = Arrays . stream ( array ) . min ( ) . orElse ( 0 ) + Arrays . stream ( array ) . max ( ) . orElse ( 0 ) + 1 ; } } } System . out . println ( salary [ 0 ] ) ; }
public static void main ( String [ ] $ ) { int n = scanner . nextInt ( ) ; int [ ] salary = new int [ n ] ; List < Integer > [ ] list = IntStream . range ( 0 , n ) . mapToObj ( i -> new ArrayList < > ( ) ) . toArray ( List [ ] :: new ) ; for ( int i = 1 ; i < n ; i ++ ) list [ scanner . nextInt ( ) - 1 ] . add ( i ) ; boolean flag = true ; while ( flag ) { flag = false ; for ( int i = 0 ; i < n ; i ++ ) { int [ ] array = list [ i ] . stream ( ) . mapToInt ( j -> salary [ j ] ) . toArray ( ) ; if ( salary [ i ] == 0 && Arrays . stream ( array ) . noneMatch ( j -> j == 0 ) ) { flag = true ; salary [ i ] = Arrays . stream ( array ) . min ( ) . orElse ( 0 ) + Arrays . stream ( array ) . max ( ) . orElse ( 0 ) + 1 ; } } } System . out . println ( salary [ 0 ] ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) 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: (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: (array_type element: (generic_type (type_identifier) (type_arguments (type_identifier))) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal) (identifier))) name: (identifier) arguments: (argument_list (lambda_expression parameters: (identifier) body: (object_creation_expression type: (generic_type (type_identifier) (type_arguments)) arguments: (argument_list))))) name: (identifier) arguments: (argument_list (method_reference (array_type element: (type_identifier) dimensions: (dimensions))))))) (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: (expression_statement (method_invocation object: (array_access array: (identifier) index: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal))) name: (identifier) arguments: (argument_list (identifier))))) (local_variable_declaration type: (boolean_type) declarator: (variable_declarator name: (identifier) value: (true))) (while_statement condition: (parenthesized_expression (identifier)) body: (block (expression_statement (assignment_expression left: (identifier) right: (false))) (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: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (method_invocation object: (method_invocation object: (array_access array: (identifier) index: (identifier)) name: (identifier) arguments: (argument_list)) name: (identifier) arguments: (argument_list (lambda_expression parameters: (identifier) body: (array_access array: (identifier) index: (identifier))))) name: (identifier) arguments: (argument_list)))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal)) right: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) name: (identifier) arguments: (argument_list (lambda_expression parameters: (identifier) body: (binary_expression left: (identifier) right: (decimal_integer_literal))))))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (true))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (binary_expression left: (binary_expression left: (method_invocation object: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) name: (identifier) arguments: (argument_list)) name: (identifier) arguments: (argument_list (decimal_integer_literal))) right: (method_invocation object: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) name: (identifier) arguments: (argument_list)) name: (identifier) arguments: (argument_list (decimal_integer_literal)))) right: (decimal_integer_literal)))))))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (decimal_integer_literal)))))))
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] boss = new int [ N + 1 ] ; boss [ 0 ] = - 1 ; Map < Integer , List < Integer >> members = new HashMap < Integer , List < Integer >> ( ) ; for ( int i = 1 ; i <= N - 1 ; i ++ ) { int b = sc . nextInt ( ) ; boss [ i + 1 ] = b ; List < Integer > member = new ArrayList < Integer > ( ) ; if ( members . containsKey ( b ) ) { member = members . get ( b ) ; } member . add ( i + 1 ) ; members . put ( b , member ) ; } Queue < Integer > checkMember = new ArrayDeque < Integer > ( ) ; for ( int i = 1 ; i <= N ; i ++ ) { if ( ! members . containsKey ( i ) ) { checkMember . add ( i ) ; } } int [ ] salary = new int [ N + 1 ] ; while ( ! checkMember . isEmpty ( ) ) { int n = checkMember . poll ( ) ; if ( ! members . containsKey ( n ) ) { salary [ n ] = 1 ; } else { int max = Integer . MIN_VALUE ; int min = Integer . MAX_VALUE ; for ( Integer m : members . get ( n ) ) { max = Math . max ( max , salary [ m ] ) ; min = Math . min ( min , salary [ m ] ) ; } salary [ n ] = max + min + 1 ; } if ( ! checkMember . contains ( boss [ n ] ) && boss [ n ] != - 1 ) { checkMember . add ( boss [ n ] ) ; } } out . println ( salary [ 1 ] ) ; }
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] boss = new int [ N + 1 ] ; boss [ 0 ] = - 1 ; Map < Integer , List < Integer > > members = new HashMap < Integer , List < Integer > > ( ) ; for ( int i = 1 ; i <= N - 1 ; i ++ ) { int b = sc . nextInt ( ) ; boss [ i + 1 ] = b ; List < Integer > member = new ArrayList < Integer > ( ) ; if ( members . containsKey ( b ) ) { member = members . get ( b ) ; } member . add ( i + 1 ) ; members . put ( b , member ) ; } Queue < Integer > checkMember = new ArrayDeque < Integer > ( ) ; for ( int i = 1 ; i <= N ; i ++ ) { if ( ! members . containsKey ( i ) ) { checkMember . add ( i ) ; } } int [ ] salary = new int [ N + 1 ] ; while ( ! checkMember . isEmpty ( ) ) { int n = checkMember . poll ( ) ; if ( ! members . containsKey ( n ) ) { salary [ n ] = 1 ; } else { int max = Integer . MIN_VALUE ; int min = Integer . MAX_VALUE ; for ( Integer m : members . get ( n ) ) { max = Math . max ( max , salary [ m ] ) ; min = Math . min ( min , salary [ m ] ) ; } salary [ n ] = max + min + 1 ; } if ( ! checkMember . contains ( boss [ n ] ) && boss [ n ] != - 1 ) { checkMember . add ( boss [ n ] ) ; } } out . println ( salary [ 1 ] ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (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: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (binary_expression left: (identifier) right: (decimal_integer_literal)))))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (unary_expression operand: (decimal_integer_literal)))) (local_variable_declaration type: (generic_type (type_identifier) (type_arguments (type_identifier) (generic_type (type_identifier) (type_arguments (type_identifier))))) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (generic_type (type_identifier) (type_arguments (type_identifier) (generic_type (type_identifier) (type_arguments (type_identifier))))) 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: (binary_expression left: (identifier) right: (decimal_integer_literal))) update: (update_expression (identifier)) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) 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 (type_identifier))) arguments: (argument_list)))) (if_statement condition: (parenthesized_expression (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (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 (type_identifier))) 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 (if_statement condition: (parenthesized_expression (unary_expression operand: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))) consequence: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (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 (binary_expression left: (identifier) right: (decimal_integer_literal)))))) (while_statement condition: (parenthesized_expression (unary_expression operand: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (if_statement condition: (parenthesized_expression (unary_expression operand: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))) consequence: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal)))) alternative: (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: (field_access object: (identifier) field: (identifier)))) (enhanced_for_statement type: (type_identifier) name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) body: (block (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (array_access array: (identifier) index: (identifier)))))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (array_access array: (identifier) index: (identifier)))))))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal)))))) (if_statement condition: (parenthesized_expression (binary_expression left: (unary_expression operand: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (identifier))))) right: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (unary_expression operand: (decimal_integer_literal))))) consequence: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (identifier))))))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (decimal_integer_literal)))))))
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] b = new int [ n ] ; for ( int i = 1 ; i < n ; i ++ ) { b [ i ] = sc . nextInt ( ) ; } List < List < Integer >> list = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { List < Integer > subList = new ArrayList < > ( ) ; for ( int j = 0 ; j < n ; j ++ ) { if ( i + 1 == b [ j ] ) { subList . add ( j ) ; } } list . add ( subList ) ; } int [ ] p = new int [ n ] ; for ( int i = n - 1 ; i >= 0 ; i -- ) { if ( list . get ( i ) . size ( ) == 0 ) { p [ i ] = 1 ; } else { int min = ( int ) 1e9 ; int max = 0 ; for ( int j = 0 ; j < list . get ( i ) . size ( ) ; j ++ ) { min = Math . min ( min , p [ list . get ( i ) . get ( j ) ] ) ; max = Math . max ( max , p [ list . get ( i ) . get ( j ) ] ) ; } p [ i ] = min + max + 1 ; } } System . out . println ( p [ 0 ] ) ; }
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] b = new int [ n ] ; for ( int i = 1 ; i < n ; i ++ ) { b [ i ] = sc . nextInt ( ) ; } List < List < Integer > > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { List < Integer > subList = new ArrayList < > ( ) ; for ( int j = 0 ; j < n ; j ++ ) { if ( i + 1 == b [ j ] ) { subList . add ( j ) ; } } list . add ( subList ) ; } int [ ] p = new int [ n ] ; for ( int i = n - 1 ; i >= 0 ; i -- ) { if ( list . get ( i ) . size ( ) == 0 ) { p [ i ] = 1 ; } else { int min = ( int ) 1e9 ; int max = 0 ; for ( int j = 0 ; j < list . get ( i ) . size ( ) ; j ++ ) { min = Math . min ( min , p [ list . get ( i ) . get ( j ) ] ) ; max = Math . max ( max , p [ list . get ( i ) . get ( j ) ] ) ; } p [ i ] = min + max + 1 ; } } System . out . println ( p [ 0 ] ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (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: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (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 (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))) (local_variable_declaration type: (generic_type (type_identifier) (type_arguments (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: (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 (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (array_access array: (identifier) index: (identifier)))) consequence: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (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))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (decimal_integer_literal)))) condition: (binary_expression left: (identifier) right: (decimal_integer_literal)) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal))) consequence: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal)))) alternative: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (cast_expression type: (integral_type) value: (decimal_floating_point_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: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) name: (identifier) arguments: (argument_list))) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (array_access array: (identifier) index: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) name: (identifier) arguments: (argument_list (identifier)))))))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (array_access array: (identifier) index: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) name: (identifier) arguments: (argument_list (identifier)))))))))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal)))))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (decimal_integer_literal)))))))
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; lists = new ArrayList [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) { lists [ i ] = new ArrayList < Integer > ( ) ; } for ( int i = 2 ; i <= n ; i ++ ) { int x = sc . nextInt ( ) ; lists [ x ] . add ( i ) ; } System . out . println ( getIncome ( 1 ) ) ; }
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; lists = new ArrayList [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) { lists [ i ] = new ArrayList < Integer > ( ) ; } for ( int i = 2 ; i <= n ; i ++ ) { int x = sc . nextInt ( ) ; lists [ x ] . add ( i ) ; } System . out . println ( getIncome ( 1 ) ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (expression_statement (assignment_expression left: (identifier) right: (array_creation_expression type: (type_identifier) dimensions: (dimensions_expr (binary_expression left: (identifier) right: (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: (array_access array: (identifier) index: (identifier)) right: (object_creation_expression type: (generic_type (type_identifier) (type_arguments (type_identifier))) 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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (expression_statement (method_invocation object: (array_access array: (identifier) index: (identifier)) name: (identifier) arguments: (argument_list (identifier)))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (method_invocation name: (identifier) arguments: (argument_list (decimal_integer_literal))))))))
static int getIncome ( int idx ) { if ( lists [ idx ] . size ( ) == 0 ) { return 1 ; } int max = 0 ; int min = Integer . MAX_VALUE ; for ( int x : lists [ idx ] ) { int y = getIncome ( x ) ; if ( max < y ) { max = y ; } if ( min > y ) { min = y ; } } return max + min + 1 ; }
static int getIncome ( int idx ) { if ( lists [ idx ] . size ( ) == 0 ) { return 1 ; } int max = 0 ; int min = Integer . MAX_VALUE ; for ( int x : lists [ idx ] ) { int y = getIncome ( x ) ; if ( max < y ) { max = y ; } if ( min > y ) { min = y ; } } return max + min + 1 ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (array_access array: (identifier) index: (identifier)) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal))) consequence: (block (return_statement (decimal_integer_literal)))) (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: (field_access object: (identifier) field: (identifier)))) (enhanced_for_statement type: (integral_type) name: (identifier) value: (array_access array: (identifier) index: (identifier)) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation name: (identifier) arguments: (argument_list (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (identifier))))))) (return_statement (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal)))))
public static void main ( String [ ] args ) throws Exception { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer tokenizer = new StringTokenizer ( input . readLine ( ) ) ; int a = Integer . parseInt ( tokenizer . nextToken ( ) ) ; int b = Integer . parseInt ( tokenizer . nextToken ( ) ) ; int c = Integer . parseInt ( tokenizer . nextToken ( ) ) ; int target = c % b ; for ( int i = 1 ; i <= b ; i ++ ) { if ( i * a % b == target ) { System . out . println ( "YES" ) ; return ; } } System . out . println ( "NO" ) ; }
public static void main ( String [ ] args ) throws Exception { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer tokenizer = new StringTokenizer ( input . readLine ( ) ) ; int a = Integer . parseInt ( tokenizer . nextToken ( ) ) ; int b = Integer . parseInt ( tokenizer . nextToken ( ) ) ; int c = Integer . parseInt ( tokenizer . nextToken ( ) ) ; int target = c % b ; for ( int i = 1 ; i <= b ; i ++ ) { if ( i * a % b == target ) { System . out . println ( " YES " ) ; return ; } } System . out . println ( " NO " ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) (throws (type_identifier)) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (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 (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (identifier)) right: (identifier))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal)))) (return_statement))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal))))))
public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; Task solver = new Task ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }
public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; Task solver = new Task ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (field_access object: (identifier) field: (identifier)))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (field_access object: (identifier) field: (identifier)))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_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 (identifier))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal) (identifier) (identifier)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))
public static void main ( String [ ] args ) { MyScanner sc = new MyScanner ( ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; a = a % b ; String ans = "NO" ; for ( int i = 1 ; i <= b ; i ++ ) { if ( a * i % b == c ) { ans = "YES" ; } } System . out . println ( ans ) ; }
public static void main ( String [ ] args ) { MyScanner sc = new MyScanner ( ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; a = a % b ; String ans = " NO " ; for ( int i = 1 ; i <= b ; i ++ ) { if ( a * i % b == c ) { ans = " YES " ; } } System . out . println ( ans ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list)))) (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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (identifier)))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (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 (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (identifier)) right: (identifier))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (string_literal))))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier))))))
static int l_min ( int [ ] a ) { Arrays . sort ( a ) ; return a [ 0 ] ; }
static int l_min ( int [ ] a ) { Arrays . sort ( a ) ; return a [ 0 ] ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (integral_type) dimensions: (dimensions)) name: (identifier))) body: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) (return_statement (array_access array: (identifier) index: (decimal_integer_literal)))))
static int l_max ( int [ ] a ) { int l = a . length ; Arrays . sort ( a ) ; return a [ l - 1 ] ; }
static int l_max ( int [ ] a ) { int l = a . length ; Arrays . sort ( a ) ; return a [ l - 1 ] ; }
(method_declaration (modifiers) type: (integral_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)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) (return_statement (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))))))
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int cnt = 1 ; List < Integer > list = new ArrayList < > ( ) ; while ( true ) { int i = a * cnt % b ; if ( i == c ) { System . out . println ( "YES" ) ; System . exit ( 0 ) ; } else if ( list . contains ( i ) ) { System . out . println ( "NO" ) ; System . exit ( 0 ) ; } else { list . add ( i ) ; cnt ++ ; } } }
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int cnt = 1 ; List < Integer > list = new ArrayList < > ( ) ; while ( true ) { int i = a * cnt % b ; if ( i == c ) { System . out . println ( " YES " ) ; System . exit ( 0 ) ; } else if ( list . contains ( i ) ) { System . out . println ( " NO " ) ; System . exit ( 0 ) ; } else { list . add ( i ) ; cnt ++ ; } } }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (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: (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)))) (while_statement condition: (parenthesized_expression (true)) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (identifier)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal))))) alternative: (if_statement condition: (parenthesized_expression (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal))))) alternative: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) (expression_statement (update_expression (identifier))))))))))
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; for ( int i = 1 ; i <= b ; i ++ ) { if ( a * i % b == c ) ans = "YES" ; } System . out . println ( ans ) ; }
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; for ( int i = 1 ; i <= b ; i ++ ) { if ( a * i % b == c ) ans = " YES " ; } System . out . println ( ans ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) 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 (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (identifier)) right: (identifier))) consequence: (expression_statement (assignment_expression left: (identifier) right: (string_literal)))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier))))))
public static void main ( String [ ] args ) { Scanner reader = new Scanner ( System . in ) ; int N = reader . nextInt ( ) ; int a = reader . nextInt ( ) ; int b = reader . nextInt ( ) ; int K = reader . nextInt ( ) ; List < Integer > P = new ArrayList < Integer > ( ) ; String ans = "YES" ; for ( int i = 0 ; i < K ; i ++ ) { int num = reader . nextInt ( ) ; if ( P . contains ( num ) || num == a || num == b ) { ans = "NO" ; } P . add ( num ) ; } System . out . println ( ans ) ; reader . close ( ) ; }
public static void main ( String [ ] args ) { Scanner reader = new Scanner ( System . in ) ; int N = reader . nextInt ( ) ; int a = reader . nextInt ( ) ; int b = reader . nextInt ( ) ; int K = reader . nextInt ( ) ; List < Integer > P = new ArrayList < Integer > ( ) ; String ans = " YES " ; for ( int i = 0 ; i < K ; i ++ ) { int num = reader . nextInt ( ) ; if ( P . contains ( num ) || num == a || num == b ) { ans = " NO " ; } P . add ( num ) ; } System . out . println ( ans ) ; reader . close ( ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (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 (type_identifier))) arguments: (argument_list)))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (binary_expression left: (identifier) right: (identifier))) right: (binary_expression left: (identifier) right: (identifier)))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (string_literal))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Map < Integer , Integer > map = new TreeMap ( ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; for ( int i = 0 ; i < d ; i ++ ) map . put ( sc . nextInt ( ) , 1 ) ; System . out . println ( map . size ( ) == d && map . containsKey ( b ) == false && map . containsKey ( c ) == false ? "YES" : "NO" ) ; }
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Map < Integer , Integer > map = new TreeMap ( ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; for ( int i = 0 ; i < d ; i ++ ) map . put ( sc . nextInt ( ) , 1 ) ; System . out . println ( map . size ( ) == d && map . containsKey ( b ) == false && map . containsKey ( c ) == false ? " YES " : " NO " ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (local_variable_declaration type: (generic_type (type_identifier) (type_arguments (type_identifier) (type_identifier))) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list)))) (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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (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: (method_invocation object: (identifier) name: (identifier) 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: (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) (decimal_integer_literal))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (ternary_expression condition: (binary_expression left: (binary_expression left: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (identifier)) right: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (false))) right: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (false))) consequence: (string_literal) alternative: (string_literal)))))))
public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; Task solver = new Task ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }
public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; Task solver = new Task ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (field_access object: (identifier) field: (identifier)))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (field_access object: (identifier) field: (identifier)))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_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 (identifier))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal) (identifier) (identifier)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))
public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; LightScanner in = new LightScanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; B solver = new B ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }
public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; LightScanner in = new LightScanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; B solver = new B ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (field_access object: (identifier) field: (identifier)))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (field_access object: (identifier) field: (identifier)))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_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 (identifier))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal) (identifier) (identifier)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))
public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = Integer . parseInt ( scanner . nextLine ( ) ) ; String [ ] line = scanner . nextLine ( ) . split ( " " , 2 ) ; int a = Integer . parseInt ( line [ 0 ] ) ; int b = Integer . parseInt ( line [ 1 ] ) ; boolean [ ] passed = new boolean [ n ] ; passed [ a - 1 ] = true ; passed [ b - 1 ] = true ; int k = Integer . parseInt ( scanner . nextLine ( ) ) ; line = scanner . nextLine ( ) . split ( " " , k ) ; boolean yes = true ; for ( int i = 0 ; i < k ; i ++ ) { int p = Integer . parseInt ( line [ i ] ) ; if ( passed [ p - 1 ] ) { yes = false ; break ; } passed [ p - 1 ] = true ; } if ( yes ) { System . out . println ( "YES" ) ; } else { System . out . println ( "NO" ) ; } }
public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = Integer . parseInt ( scanner . nextLine ( ) ) ; String [ ] line = scanner . nextLine ( ) . split ( " ▁ " , 2 ) ; int a = Integer . parseInt ( line [ 0 ] ) ; int b = Integer . parseInt ( line [ 1 ] ) ; boolean [ ] passed = new boolean [ n ] ; passed [ a - 1 ] = true ; passed [ b - 1 ] = true ; int k = Integer . parseInt ( scanner . nextLine ( ) ) ; line = scanner . nextLine ( ) . split ( " ▁ " , k ) ; boolean yes = true ; for ( int i = 0 ; i < k ; i ++ ) { int p = Integer . parseInt ( line [ i ] ) ; if ( passed [ p - 1 ] ) { yes = false ; break ; } passed [ p - 1 ] = true ; } if ( yes ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))) (local_variable_declaration type: (array_type element: (type_identifier) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) name: (identifier) arguments: (argument_list (string_literal) (decimal_integer_literal))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (decimal_integer_literal)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (decimal_integer_literal)))))) (local_variable_declaration type: (array_type element: (boolean_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (boolean_type) dimensions: (dimensions_expr (identifier))))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (true))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (true))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) name: (identifier) arguments: (argument_list (string_literal) (identifier))))) (local_variable_declaration type: (boolean_type) declarator: (variable_declarator name: (identifier) value: (true))) (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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (identifier)))))) (if_statement condition: (parenthesized_expression (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal)))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (false))) (break_statement))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (true))))) (if_statement condition: (parenthesized_expression (identifier)) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal))))) alternative: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal))))))))
public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int c = scan . nextInt ( ) ; if ( a == b ) { System . out . println ( c ) ; } else if ( a == c ) { System . out . println ( b ) ; } else if ( b == c ) { System . out . println ( a ) ; } }
public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int c = scan . nextInt ( ) ; if ( a == b ) { System . out . println ( c ) ; } else if ( a == c ) { System . out . println ( b ) ; } else if ( b == c ) { System . out . println ( a ) ; } }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier))))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier))))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier))))))))))
public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; Task solver = new Task ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }
public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; Task solver = new Task ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (field_access object: (identifier) field: (identifier)))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (field_access object: (identifier) field: (identifier)))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_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 (identifier))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal) (identifier) (identifier)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))
static int nextInt ( ) { return Integer . parseInt ( sc . next ( ) ) ; }
static int nextInt ( ) { return Integer . parseInt ( sc . next ( ) ) ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters) body: (block (return_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))))
static int [ ] nextIntArray ( int n ) { return IntStream . range ( 0 , n ) . map ( i -> nextInt ( ) ) . toArray ( ) ; }
static int [ ] nextIntArray ( int n ) { return IntStream . range ( 0 , n ) . map ( i -> nextInt ( ) ) . toArray ( ) ; }
(method_declaration (modifiers) type: (array_type element: (integral_type) dimensions: (dimensions)) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier))) body: (block (return_statement (method_invocation object: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal) (identifier))) name: (identifier) arguments: (argument_list (lambda_expression parameters: (identifier) body: (method_invocation name: (identifier) arguments: (argument_list))))) name: (identifier) arguments: (argument_list)))))
static int max ( int ... ar ) { Arrays . sort ( ar ) ; return ar [ ar . length - 1 ] ; }
static int max ( int ... ar ) { Arrays . sort ( ar ) ; return ar [ ar . length - 1 ] ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (spread_parameter (integral_type) (variable_declarator name: (identifier)))) body: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) (return_statement (array_access array: (identifier) index: (binary_expression left: (field_access object: (identifier) field: (identifier)) right: (decimal_integer_literal))))))
static int min ( int ... ar ) { Arrays . sort ( ar ) ; return ar [ 0 ] ; }
static int min ( int ... ar ) { Arrays . sort ( ar ) ; return ar [ 0 ] ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (spread_parameter (integral_type) (variable_declarator name: (identifier)))) body: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) (return_statement (array_access array: (identifier) index: (decimal_integer_literal)))))
public static void main ( String [ ] args ) { int a = nextInt ( ) , b = nextInt ( ) , c = nextInt ( ) ; out . println ( a == b ? c : b == c ? a : b ) ; }
public static void main ( String [ ] args ) { int a = nextInt ( ) , b = nextInt ( ) , c = nextInt ( ) ; out . println ( a == b ? c : b == c ? a : b ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation name: (identifier) arguments: (argument_list))) declarator: (variable_declarator name: (identifier) value: (method_invocation name: (identifier) arguments: (argument_list))) declarator: (variable_declarator name: (identifier) value: (method_invocation name: (identifier) arguments: (argument_list)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (ternary_expression condition: (binary_expression left: (identifier) right: (identifier)) consequence: (identifier) alternative: (ternary_expression condition: (binary_expression left: (identifier) right: (identifier)) consequence: (identifier) alternative: (identifier))))))))
public static void main ( String [ ] args ) { MyScanner sc = new MyScanner ( ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; System . out . println ( a == b ? c : a == c ? b : a ) ; }
public static void main ( String [ ] args ) { MyScanner sc = new MyScanner ( ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; System . out . println ( a == b ? c : a == c ? b : a ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list)))) (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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (ternary_expression condition: (binary_expression left: (identifier) right: (identifier)) consequence: (identifier) alternative: (ternary_expression condition: (binary_expression left: (identifier) right: (identifier)) consequence: (identifier) alternative: (identifier))))))))
static int l_min ( int [ ] a ) { Arrays . sort ( a ) ; return a [ 0 ] ; }
static int l_min ( int [ ] a ) { Arrays . sort ( a ) ; return a [ 0 ] ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (integral_type) dimensions: (dimensions)) name: (identifier))) body: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) (return_statement (array_access array: (identifier) index: (decimal_integer_literal)))))
static int l_max ( int [ ] a ) { int l = a . length ; Arrays . sort ( a ) ; return a [ l - 1 ] ; }
static int l_max ( int [ ] a ) { int l = a . length ; Arrays . sort ( a ) ; return a [ l - 1 ] ; }
(method_declaration (modifiers) type: (integral_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)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) (return_statement (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))))))
public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) , m = sc . nextInt ( ) , l = sc . nextInt ( ) ; if ( n == m ) System . out . println ( l ) ; else if ( n == l ) System . out . println ( m ) ; else System . out . println ( n ) ; }
public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) , m = sc . nextInt ( ) , l = sc . nextInt ( ) ; if ( n == m ) System . out . println ( l ) ; else if ( n == l ) System . out . println ( m ) ; else System . out . println ( n ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) (throws (type_identifier)) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier)))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier)))) alternative: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier))))))))
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; BigDecimal sum = BigDecimal . ZERO ; List < Entry < Integer , Integer >> list = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) list . add ( new SimpleEntry < Integer , Integer > ( sc . nextInt ( ) , sc . nextInt ( ) ) ) ; list = list . stream ( ) . sorted ( Comparator . comparingInt ( entry -> entry . getKey ( ) ) ) . collect ( Collectors . toList ( ) ) ; for ( Entry < Integer , Integer > entry : list ) { if ( m == 0 ) break ; BigDecimal a = BigDecimal . valueOf ( entry . getKey ( ) ) ; BigDecimal b = BigDecimal . valueOf ( entry . getValue ( ) ) ; if ( m > entry . getValue ( ) ) { m -= entry . getValue ( ) ; sum = sum . add ( a . multiply ( b ) ) ; } else if ( m <= entry . getValue ( ) ) { b = BigDecimal . valueOf ( m ) ; sum = sum . add ( a . multiply ( b ) ) ; m = 0 ; } } System . out . println ( sum . toString ( ) ) ; }
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; BigDecimal sum = BigDecimal . ZERO ; List < Entry < Integer , Integer > > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) list . add ( new SimpleEntry < Integer , Integer > ( sc . nextInt ( ) , sc . nextInt ( ) ) ) ; list = list . stream ( ) . sorted ( Comparator . comparingInt ( entry -> entry . getKey ( ) ) ) . collect ( Collectors . toList ( ) ) ; for ( Entry < Integer , Integer > entry : list ) { if ( m == 0 ) break ; BigDecimal a = BigDecimal . valueOf ( entry . getKey ( ) ) ; BigDecimal b = BigDecimal . valueOf ( entry . getValue ( ) ) ; if ( m > entry . getValue ( ) ) { m -= entry . getValue ( ) ; sum = sum . add ( a . multiply ( b ) ) ; } else if ( m <= entry . getValue ( ) ) { b = BigDecimal . valueOf ( m ) ; sum = sum . add ( a . multiply ( b ) ) ; m = 0 ; } } System . out . println ( sum . toString ( ) ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (field_access object: (identifier) field: (identifier)))) (local_variable_declaration type: (generic_type (type_identifier) (type_arguments (generic_type (type_identifier) (type_arguments (type_identifier) (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: (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (object_creation_expression type: (generic_type (type_identifier) (type_arguments (type_identifier) (type_identifier))) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (lambda_expression parameters: (identifier) body: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))))))) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))) (enhanced_for_statement type: (generic_type (type_identifier) (type_arguments (type_identifier) (type_identifier))) name: (identifier) value: (identifier) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (break_statement)) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))))))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal)))))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))))
public static void main ( String [ ] args ) { FastReader sc = new FastReader ( ) ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; long [ ] [ ] A = new long [ N ] [ 2 ] ; int k = 0 ; int number = 0 ; long sum = 0 ; for ( int i = 0 ; i < N ; i ++ ) { for ( int j = 0 ; j < 2 ; j ++ ) { A [ i ] [ j ] = sc . nextInt ( ) ; } } Arrays . sort ( A , ( a , b ) -> Long . compare ( a [ 0 ] , b [ 0 ] ) ) ; while ( M > k ) { k += A [ number ] [ 1 ] ; sum += A [ number ] [ 0 ] * A [ number ] [ 1 ] ; number ++ ; } if ( k != M ) { sum -= A [ number - 1 ] [ 0 ] * ( k - M ) ; } PrintWriter out = new PrintWriter ( System . out ) ; out . print ( sum ) ; out . flush ( ) ; }
public static void main ( String [ ] args ) { FastReader sc = new FastReader ( ) ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; long [ ] [ ] A = new long [ N ] [ 2 ] ; int k = 0 ; int number = 0 ; long sum = 0 ; for ( int i = 0 ; i < N ; i ++ ) { for ( int j = 0 ; j < 2 ; j ++ ) { A [ i ] [ j ] = sc . nextInt ( ) ; } } Arrays . sort ( A , ( a , b ) -> Long . compare ( a [ 0 ] , b [ 0 ] ) ) ; while ( M > k ) { k += A [ number ] [ 1 ] ; sum += A [ number ] [ 0 ] * A [ number ] [ 1 ] ; number ++ ; } if ( k != M ) { sum -= A [ number - 1 ] [ 0 ] * ( k - M ) ; } PrintWriter out = new PrintWriter ( System . out ) ; out . print ( sum ) ; out . flush ( ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list)))) (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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (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)) dimensions: (dimensions_expr (decimal_integer_literal))))) (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))) (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 (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (decimal_integer_literal)) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (lambda_expression parameters: (inferred_parameters (identifier) (identifier)) body: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (decimal_integer_literal)) (array_access array: (identifier) index: (decimal_integer_literal)))))))) (while_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) body: (block (expression_statement (assignment_expression left: (identifier) right: (array_access array: (array_access array: (identifier) index: (identifier)) index: (decimal_integer_literal)))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (decimal_integer_literal)) right: (array_access array: (array_access array: (identifier) index: (identifier)) index: (decimal_integer_literal))))) (expression_statement (update_expression (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (array_access array: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) index: (decimal_integer_literal)) right: (parenthesized_expression (binary_expression left: (identifier) right: (identifier)))))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; ArrayList < Data > list = new ArrayList < Data > ( ) ; String [ ] line_list = sc . nextLine ( ) . split ( " " ) ; int N = Integer . parseInt ( line_list [ 0 ] ) ; int M = Integer . parseInt ( line_list [ 1 ] ) ; for ( int i = 0 ; i < N ; i ++ ) { line_list = sc . nextLine ( ) . split ( " " ) ; list . add ( new Data ( Long . parseLong ( line_list [ 0 ] ) , Integer . parseInt ( line_list [ 1 ] ) ) ) ; } list . sort ( ( a , b ) -> a . compareTo ( b ) ) ; long kingaku = 0 ; for ( int i = 0 ; i < list . size ( ) ; i ++ ) { Data data = list . get ( i ) ; if ( M < data . getSuryou ( ) ) { kingaku = kingaku + M * data . getTanka ( ) ; break ; } else { kingaku = kingaku + data . getSuryou ( ) * data . getTanka ( ) ; M = M - data . getSuryou ( ) ; } } System . out . println ( kingaku ) ; }
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; ArrayList < Data > list = new ArrayList < Data > ( ) ; String [ ] line_list = sc . nextLine ( ) . split ( " ▁ " ) ; int N = Integer . parseInt ( line_list [ 0 ] ) ; int M = Integer . parseInt ( line_list [ 1 ] ) ; for ( int i = 0 ; i < N ; i ++ ) { line_list = sc . nextLine ( ) . split ( " ▁ " ) ; list . add ( new Data ( Long . parseLong ( line_list [ 0 ] ) , Integer . parseInt ( line_list [ 1 ] ) ) ) ; } list . sort ( ( a , b ) -> a . compareTo ( b ) ) ; long kingaku = 0 ; for ( int i = 0 ; i < list . size ( ) ; i ++ ) { Data data = list . get ( i ) ; if ( M < data . getSuryou ( ) ) { kingaku = kingaku + M * data . getTanka ( ) ; break ; } else { kingaku = kingaku + data . getSuryou ( ) * data . getTanka ( ) ; M = M - data . getSuryou ( ) ; } } System . out . println ( kingaku ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (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 (type_identifier))) arguments: (argument_list)))) (local_variable_declaration type: (array_type element: (type_identifier) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) name: (identifier) arguments: (argument_list (string_literal))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (decimal_integer_literal)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (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: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) name: (identifier) arguments: (argument_list (string_literal))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (object_creation_expression type: (type_identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (decimal_integer_literal)))) (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (decimal_integer_literal))))))))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (lambda_expression parameters: (inferred_parameters (identifier) (identifier)) body: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) update: (update_expression (identifier)) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))) (break_statement)) alternative: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))))))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier))))))
public static void main ( String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { int n = scanner . nextInt ( ) ; int m = scanner . nextInt ( ) ; scanner . nextLine ( ) ; List < Store > list = IntStream . range ( 0 , n ) . mapToObj ( i -> { Store store = new Store ( ) ; store . price = scanner . nextInt ( ) ; store . amount = scanner . nextInt ( ) ; scanner . nextLine ( ) ; return store ; } ) . sorted ( ( x , y ) -> x . price - y . price ) . collect ( Collectors . toList ( ) ) ; long sum = 0 ; for ( int i = 0 ; i < list . size ( ) ; i ++ ) { Store store = list . get ( i ) ; if ( store . amount >= m ) { sum += ( long ) store . price * m ; break ; } else { sum += ( long ) store . price * store . amount ; m -= store . amount ; } } System . out . println ( sum ) ; } }
public static void main ( String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { int n = scanner . nextInt ( ) ; int m = scanner . nextInt ( ) ; scanner . nextLine ( ) ; List < Store > list = IntStream . range ( 0 , n ) . mapToObj ( i -> { Store store = new Store ( ) ; store . price = scanner . nextInt ( ) ; store . amount = scanner . nextInt ( ) ; scanner . nextLine ( ) ; return store ; } ) . sorted ( ( x , y ) -> x . price - y . price ) . collect ( Collectors . toList ( ) ) ; long sum = 0 ; for ( int i = 0 ; i < list . size ( ) ; i ++ ) { Store store = list . get ( i ) ; if ( store . amount >= m ) { sum += ( long ) store . price * m ; break ; } else { sum += ( long ) store . price * store . amount ; m -= store . amount ; } } System . out . println ( sum ) ; } }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (try_with_resources_statement resources: (resource_specification (resource type: (type_identifier) name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) (local_variable_declaration type: (generic_type (type_identifier) (type_arguments (type_identifier))) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (method_invocation object: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal) (identifier))) name: (identifier) arguments: (argument_list (lambda_expression parameters: (identifier) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list)))) (expression_statement (assignment_expression left: (field_access object: (identifier) field: (identifier)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (expression_statement (assignment_expression left: (field_access object: (identifier) field: (identifier)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) (return_statement (identifier)))))) name: (identifier) arguments: (argument_list (lambda_expression parameters: (inferred_parameters (identifier) (identifier)) body: (binary_expression left: (field_access object: (identifier) field: (identifier)) right: (field_access object: (identifier) field: (identifier)))))) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))) (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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) update: (update_expression (identifier)) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (field_access object: (identifier) field: (identifier)) right: (identifier))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (cast_expression type: (integral_type) value: (field_access object: (identifier) field: (identifier))) right: (identifier)))) (break_statement)) alternative: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (cast_expression type: (integral_type) value: (field_access object: (identifier) field: (identifier))) right: (field_access object: (identifier) field: (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (field_access object: (identifier) field: (identifier)))))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier))))))))