code
stringlengths 31
2.27k
| tokenized_code
stringlengths 30
1.69k
| sexp
stringlengths 115
9.43k
|
---|---|---|
public static void main ( String args [ ] ) {
Main main = new Main ( ) ;
main . start ( ) ;
}
| public static void main ( String args [ ] ) { Main main = new Main ( ) ; main . start ( ) ; } | (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)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))))) |
public static void main ( String [ ] args ) {
new Main ( ) . compute ( ) ;
}
| public static void main ( String [ ] args ) { new Main ( ) . compute ( ) ; } | (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 ) {
InputStream inputStream = System . in ;
OutputStream outputStream = System . out ;
Scanner in = new Scanner ( inputStream ) ;
PrintWriter out = new PrintWriter ( outputStream ) ;
D1 solver = new D1 ( ) ;
solver . solve ( 1 , in , out ) ;
out . close ( ) ;
}
| public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; D1 solver = new D1 ( ) ; 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 [ ] $ ) {
Scanner sc = new Scanner ( in ) ;
int n = sc . nextInt ( ) ;
out . println ( ans ( n , 0 ) ) ;
}
| public static void main ( String [ ] $ ) { Scanner sc = new Scanner ( in ) ; int n = sc . nextInt ( ) ; out . println ( ans ( n , 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 (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: (identifier) name: (identifier) arguments: (argument_list (method_invocation name: (identifier) arguments: (argument_list (identifier) (decimal_integer_literal)))))))) |
static int ans ( int n , int c ) {
if ( c == 10 ) return 0 ;
int temp = 0 ;
if ( ( 1 + n ) % power ( 10 , c + 1 ) >= 2 * power ( 10 , c ) ) {
temp = power ( 10 , c ) ;
}
else if ( ( 1 + n ) % power ( 10 , c + 1 ) > power ( 10 , c ) ) {
temp = ( n + 1 ) % power ( 10 , c + 1 ) - power ( 10 , c ) ;
}
return ans ( n , c + 1 ) + power ( 10 , c ) * ( ( n + 1 ) / power ( 10 , c + 1 ) ) + temp ;
}
| static int ans ( int n , int c ) { if ( c == 10 ) return 0 ; int temp = 0 ; if ( ( 1 + n ) % power ( 10 , c + 1 ) >= 2 * power ( 10 , c ) ) { temp = power ( 10 , c ) ; } else if ( ( 1 + n ) % power ( 10 , c + 1 ) > power ( 10 , c ) ) { temp = ( n + 1 ) % power ( 10 , c + 1 ) - power ( 10 , c ) ; } return ans ( n , c + 1 ) + power ( 10 , c ) * ( ( n + 1 ) / power ( 10 , c + 1 ) ) + temp ; } | (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: (return_statement (decimal_integer_literal))) (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: (parenthesized_expression (binary_expression left: (decimal_integer_literal) right: (identifier))) right: (method_invocation name: (identifier) arguments: (argument_list (decimal_integer_literal) (binary_expression left: (identifier) right: (decimal_integer_literal))))) right: (binary_expression left: (decimal_integer_literal) right: (method_invocation name: (identifier) arguments: (argument_list (decimal_integer_literal) (identifier)))))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (method_invocation name: (identifier) arguments: (argument_list (decimal_integer_literal) (identifier)))))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (parenthesized_expression (binary_expression left: (decimal_integer_literal) right: (identifier))) right: (method_invocation name: (identifier) arguments: (argument_list (decimal_integer_literal) (binary_expression left: (identifier) right: (decimal_integer_literal))))) right: (method_invocation name: (identifier) arguments: (argument_list (decimal_integer_literal) (identifier))))) 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: (method_invocation name: (identifier) arguments: (argument_list (decimal_integer_literal) (binary_expression left: (identifier) right: (decimal_integer_literal))))) right: (method_invocation name: (identifier) arguments: (argument_list (decimal_integer_literal) (identifier))))))))) (return_statement (binary_expression left: (binary_expression left: (method_invocation name: (identifier) arguments: (argument_list (identifier) (binary_expression left: (identifier) right: (decimal_integer_literal)))) right: (binary_expression left: (method_invocation name: (identifier) arguments: (argument_list (decimal_integer_literal) (identifier))) right: (parenthesized_expression (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (method_invocation name: (identifier) arguments: (argument_list (decimal_integer_literal) (binary_expression left: (identifier) right: (decimal_integer_literal)))))))) right: (identifier))))) |
static int power ( int n , int m ) {
if ( m == 0 ) return 1 ;
if ( m % 2 == 1 ) return power ( n , m - 1 ) * n ;
int e = power ( n , m / 2 ) ;
return e * e ;
}
| static int power ( int n , int m ) { if ( m == 0 ) return 1 ; if ( m % 2 == 1 ) return power ( n , m - 1 ) * n ; int e = power ( n , m / 2 ) ; return e * e ; } | (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: (return_statement (decimal_integer_literal))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal))) consequence: (return_statement (binary_expression left: (method_invocation name: (identifier) arguments: (argument_list (identifier) (binary_expression left: (identifier) right: (decimal_integer_literal)))) right: (identifier)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation name: (identifier) arguments: (argument_list (identifier) (binary_expression left: (identifier) right: (decimal_integer_literal)))))) (return_statement (binary_expression left: (identifier) right: (identifier))))) |
public static void main ( String [ ] args ) {
Scanner sc = new Scanner ( System . in ) ;
long n = sc . nextInt ( ) ;
long count = 0 ;
for ( int i = 0 ;
i < 11 ;
i ++ ) {
count += ( n / pow10 ( i + 1 ) ) * pow10 ( i ) ;
long target = ( n % pow10 ( i + 1 ) ) / pow10 ( i ) ;
if ( target > 1 ) {
count += pow10 ( i ) ;
}
else if ( target == 1 ) {
count += n % pow10 ( i ) + 1 ;
}
}
System . out . println ( count ) ;
}
| public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long n = sc . nextInt ( ) ; long count = 0 ; for ( int i = 0 ; i < 11 ; i ++ ) { count += ( n / pow10 ( i + 1 ) ) * pow10 ( i ) ; long target = ( n % pow10 ( i + 1 ) ) / pow10 ( i ) ; if ( target > 1 ) { count += pow10 ( i ) ; } else if ( target == 1 ) { count += n % pow10 ( i ) + 1 ; } } 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: (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: (identifier) right: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)))))) right: (method_invocation name: (identifier) arguments: (argument_list (identifier)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)))))) right: (method_invocation name: (identifier) arguments: (argument_list (identifier)))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (method_invocation name: (identifier) arguments: (argument_list (identifier)))))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (binary_expression left: (identifier) right: (method_invocation name: (identifier) arguments: (argument_list (identifier)))) right: (decimal_integer_literal))))))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier)))))) |
static long pow10 ( int n ) {
if ( n == 0 ) {
return 1 ;
}
else {
return 10 * pow10 ( n - 1 ) ;
}
}
| static long pow10 ( int n ) { if ( n == 0 ) { return 1 ; } else { return 10 * pow10 ( n - 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: (identifier) right: (decimal_integer_literal))) consequence: (block (return_statement (decimal_integer_literal))) alternative: (block (return_statement (binary_expression left: (decimal_integer_literal) right: (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)))))))))) |
public static void main ( String [ ] args ) {
Scanner sc = new Scanner ( System . in ) ;
int N = sc . nextInt ( ) ;
int souwa = 0 ;
souwa += N / 10 ;
if ( N % 10 >= 1 ) {
souwa ++ ;
}
souwa += N / 100 * 10 ;
if ( N % 100 >= 10 ) {
souwa += Math . min ( N % 100 - 9 , 10 ) ;
}
souwa += N / 1000 * 100 ;
if ( N % 1000 >= 100 ) {
souwa += Math . min ( N % 1000 - 99 , 100 ) ;
}
souwa += N / 10000 * 1000 ;
if ( N % 10000 >= 1000 ) {
souwa += Math . min ( N % 10000 - 999 , 1000 ) ;
}
souwa += N / 100000 * 10000 ;
if ( N % 100000 >= 10000 ) {
souwa += Math . min ( N % 100000 - 9999 , 10000 ) ;
}
souwa += N / 1000000 * 100000 ;
if ( N % 1000000 >= 100000 ) {
souwa += Math . min ( N % 1000000 - 99999 , 100000 ) ;
}
souwa += N / 10000000 * 1000000 ;
if ( N % 10000000 >= 1000000 ) {
souwa += Math . min ( N % 10000000 - 999999 , 1000000 ) ;
}
souwa += N / 100000000 * 10000000 ;
if ( N % 100000000 >= 10000000 ) {
souwa += Math . min ( N % 100000000 - 9999999 , 10000000 ) ;
}
souwa += N / 1000000000 * 100000000 ;
if ( N % 1000000000 >= 100000000 ) {
souwa += Math . min ( N % 1000000000 - 99999999 , 100000000 ) ;
}
if ( N == 1000000000 ) {
souwa ++ ;
}
System . out . println ( souwa ) ;
}
| public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int souwa = 0 ; souwa += N / 10 ; if ( N % 10 >= 1 ) { souwa ++ ; } souwa += N / 100 * 10 ; if ( N % 100 >= 10 ) { souwa += Math . min ( N % 100 - 9 , 10 ) ; } souwa += N / 1000 * 100 ; if ( N % 1000 >= 100 ) { souwa += Math . min ( N % 1000 - 99 , 100 ) ; } souwa += N / 10000 * 1000 ; if ( N % 10000 >= 1000 ) { souwa += Math . min ( N % 10000 - 999 , 1000 ) ; } souwa += N / 100000 * 10000 ; if ( N % 100000 >= 10000 ) { souwa += Math . min ( N % 100000 - 9999 , 10000 ) ; } souwa += N / 1000000 * 100000 ; if ( N % 1000000 >= 100000 ) { souwa += Math . min ( N % 1000000 - 99999 , 100000 ) ; } souwa += N / 10000000 * 1000000 ; if ( N % 10000000 >= 1000000 ) { souwa += Math . min ( N % 10000000 - 999999 , 1000000 ) ; } souwa += N / 100000000 * 10000000 ; if ( N % 100000000 >= 10000000 ) { souwa += Math . min ( N % 100000000 - 9999999 , 10000000 ) ; } souwa += N / 1000000000 * 100000000 ; if ( N % 1000000000 >= 100000000 ) { souwa += Math . min ( N % 1000000000 - 99999999 , 100000000 ) ; } if ( N == 1000000000 ) { souwa ++ ; } System . out . println ( souwa ) ; } | (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))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal))) consequence: (block (expression_statement (update_expression (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal)))) (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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal)) (decimal_integer_literal))))))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal)))) (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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal)) (decimal_integer_literal))))))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal)))) (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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal)) (decimal_integer_literal))))))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal)))) (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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal)) (decimal_integer_literal))))))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal)))) (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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal)) (decimal_integer_literal))))))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal)))) (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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal)) (decimal_integer_literal))))))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal)))) (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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal)) (decimal_integer_literal))))))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal)))) (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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal)) (decimal_integer_literal))))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (expression_statement (update_expression (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 [ ] a = new int [ 3 ] ;
for ( int i = 0 ;
i < 3 ;
i ++ ) a [ i ] = Integer . parseInt ( sc . next ( ) ) ;
int c = 0 ;
while ( true ) {
Arrays . sort ( a ) ;
if ( a [ 0 ] == a [ 1 ] && a [ 1 ] == a [ 2 ] ) break ;
else if ( a [ 1 ] == a [ 2 ] ) a [ 0 ] += 2 ;
else {
a [ 0 ] ++ ;
a [ 1 ] ++ ;
}
c ++ ;
}
System . out . println ( c ) ;
}
| 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 ] = Integer . parseInt ( sc . next ( ) ) ; int c = 0 ; while ( true ) { Arrays . sort ( a ) ; if ( a [ 0 ] == a [ 1 ] && a [ 1 ] == a [ 2 ] ) break ; else if ( a [ 1 ] == a [ 2 ] ) a [ 0 ] += 2 ; else { a [ 0 ] ++ ; a [ 1 ] ++ ; } c ++ ; } System . out . println ( c ) ; } | (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: (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (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))) (while_statement condition: (parenthesized_expression (true)) body: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) (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: (binary_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (array_access array: (identifier) index: (decimal_integer_literal))))) consequence: (break_statement) 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: (expression_statement (assignment_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (decimal_integer_literal))) alternative: (block (expression_statement (update_expression (array_access array: (identifier) index: (decimal_integer_literal)))) (expression_statement (update_expression (array_access array: (identifier) index: (decimal_integer_literal))))))) (expression_statement (update_expression (identifier))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier)))))) |
public static void main ( String [ ] args ) throws IOException {
BufferedReader r = new BufferedReader ( new InputStreamReader ( System . in ) , 1 ) ;
String [ ] sl = r . readLine ( ) . split ( "[\\s]+" ) ;
int a = Integer . parseInt ( sl [ 0 ] ) ;
int b = Integer . parseInt ( sl [ 1 ] ) ;
int c = Integer . parseInt ( sl [ 2 ] ) ;
if ( a > b ) {
int t = a ;
a = b ;
b = t ;
}
if ( b > c ) {
int t = b ;
b = c ;
c = t ;
}
if ( a > b ) {
int t = a ;
a = b ;
b = t ;
}
if ( a == b && b == c ) {
System . out . println ( 0 ) ;
System . exit ( 0 ) ;
}
if ( b == c ) {
if ( ( b - a ) % 2 == 0 ) {
System . out . println ( ( b - a ) / 2 ) ;
System . exit ( 0 ) ;
}
else {
System . out . println ( ( b - a + 1 ) / 2 + 1 ) ;
System . exit ( 0 ) ;
}
}
if ( a == b ) {
System . out . println ( c - a ) ;
System . exit ( 0 ) ;
}
int v = 0 ;
v += c - b ;
a += c - b ;
b += c - b ;
if ( ( b - a ) % 2 == 0 ) {
System . out . println ( v + ( b - a ) / 2 ) ;
System . exit ( 0 ) ;
}
else {
System . out . println ( v + ( b - a + 1 ) / 2 + 1 ) ;
System . exit ( 0 ) ;
}
}
| public static void main ( String [ ] args ) throws IOException { BufferedReader r = new BufferedReader ( new InputStreamReader ( System . in ) , 1 ) ; String [ ] sl = r . readLine ( ) . split ( " [ \\ s ] + " ) ; int a = Integer . parseInt ( sl [ 0 ] ) ; int b = Integer . parseInt ( sl [ 1 ] ) ; int c = Integer . parseInt ( sl [ 2 ] ) ; if ( a > b ) { int t = a ; a = b ; b = t ; } if ( b > c ) { int t = b ; b = c ; c = t ; } if ( a > b ) { int t = a ; a = b ; b = t ; } if ( a == b && b == c ) { System . out . println ( 0 ) ; System . exit ( 0 ) ; } if ( b == c ) { if ( ( b - a ) % 2 == 0 ) { System . out . println ( ( b - a ) / 2 ) ; System . exit ( 0 ) ; } else { System . out . println ( ( b - a + 1 ) / 2 + 1 ) ; System . exit ( 0 ) ; } } if ( a == b ) { System . out . println ( c - a ) ; System . exit ( 0 ) ; } int v = 0 ; v += c - b ; a += c - b ; b += c - b ; if ( ( b - a ) % 2 == 0 ) { System . out . println ( v + ( b - a ) / 2 ) ; System . exit ( 0 ) ; } else { System . out . println ( v + ( b - a + 1 ) / 2 + 1 ) ; System . exit ( 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 (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))) (decimal_integer_literal))))) (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)))))) (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: (identifier) right: (identifier))) consequence: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (identifier))) (expression_statement (assignment_expression left: (identifier) right: (identifier))) (expression_statement (assignment_expression left: (identifier) right: (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (identifier))) (expression_statement (assignment_expression left: (identifier) right: (identifier))) (expression_statement (assignment_expression left: (identifier) right: (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (identifier))) (expression_statement (assignment_expression left: (identifier) right: (identifier))) (expression_statement (assignment_expression left: (identifier) right: (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (binary_expression left: (identifier) right: (identifier)))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (decimal_integer_literal)))) (expression_statement (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 (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) right: (decimal_integer_literal)) right: (decimal_integer_literal))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) 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: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal))) right: (decimal_integer_literal)) right: (decimal_integer_literal))))) (expression_statement (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 (binary_expression left: (identifier) right: (identifier))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (identifier)))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) right: (decimal_integer_literal)) right: (decimal_integer_literal))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) 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: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (identifier) right: (binary_expression left: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal))) right: (decimal_integer_literal))) right: (decimal_integer_literal))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal)))))))) |
public static void main ( String [ ] args ) {
new Main ( ) . solveA ( ) ;
}
| public static void main ( String [ ] args ) { new Main ( ) . solveA ( ) ; } | (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 ) throws IOException {
init ( System . in ) ;
int [ ] abc = new int [ 3 ] ;
for ( int i = 0 ;
i < abc . length ;
i ++ ) abc [ i ] = nextInt ( ) ;
Arrays . sort ( abc ) ;
int diff1 = abc [ 2 ] - abc [ 0 ] ;
int diff2 = abc [ 2 ] - abc [ 1 ] ;
if ( diff1 % 2 == 0 && diff2 % 2 == 0 ) System . out . println ( diff1 / 2 + diff2 / 2 ) ;
else if ( diff1 % 2 == 1 && diff2 % 2 == 0 ) System . out . println ( 1 + diff2 / 2 + ( diff1 + 1 ) / 2 ) ;
else if ( diff1 % 2 == 0 && diff2 % 2 == 1 ) System . out . println ( 1 + diff1 / 2 + ( diff2 + 1 ) / 2 ) ;
else System . out . println ( 1 + ( diff1 - 1 ) / 2 + ( diff2 - 1 ) / 2 ) ;
}
| public static void main ( String [ ] args ) throws IOException { init ( System . in ) ; int [ ] abc = new int [ 3 ] ; for ( int i = 0 ; i < abc . length ; i ++ ) abc [ i ] = nextInt ( ) ; Arrays . sort ( abc ) ; int diff1 = abc [ 2 ] - abc [ 0 ] ; int diff2 = abc [ 2 ] - abc [ 1 ] ; if ( diff1 % 2 == 0 && diff2 % 2 == 0 ) System . out . println ( diff1 / 2 + diff2 / 2 ) ; else if ( diff1 % 2 == 1 && diff2 % 2 == 0 ) System . out . println ( 1 + diff2 / 2 + ( diff1 + 1 ) / 2 ) ; else if ( diff1 % 2 == 0 && diff2 % 2 == 1 ) System . out . println ( 1 + diff1 / 2 + ( diff2 + 1 ) / 2 ) ; else System . out . println ( 1 + ( diff1 - 1 ) / 2 + ( diff2 - 1 ) / 2 ) ; } | (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 (expression_statement (method_invocation name: (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: (field_access object: (identifier) field: (identifier))) update: (update_expression (identifier)) body: (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (method_invocation name: (identifier) arguments: (argument_list))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (array_access array: (identifier) index: (decimal_integer_literal))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (array_access array: (identifier) index: (decimal_integer_literal))))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal)) right: (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal)))) consequence: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal)) right: (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal)))) consequence: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (decimal_integer_literal) right: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (decimal_integer_literal)))))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal)) right: (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal)))) consequence: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (decimal_integer_literal) right: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (decimal_integer_literal)))))) alternative: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (decimal_integer_literal) right: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (decimal_integer_literal))) right: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (decimal_integer_literal))))))))))) |
private static void init ( InputStream inputStream ) {
reader = new BufferedReader ( new InputStreamReader ( inputStream ) ) ;
tokenizer = new StringTokenizer ( "" ) ;
}
| private static void init ( InputStream inputStream ) { reader = new BufferedReader ( new InputStreamReader ( inputStream ) ) ; tokenizer = new StringTokenizer ( " " ) ; } | (method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) name: (identifier))) 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 (identifier))))))) (expression_statement (assignment_expression left: (identifier) right: (object_creation_expression type: (type_identifier) arguments: (argument_list (string_literal))))))) |
private static String next ( ) throws IOException {
String read ;
while ( ! tokenizer . hasMoreTokens ( ) ) {
read = reader . readLine ( ) ;
if ( read == null || read . equals ( "" ) ) return "-1" ;
tokenizer = new StringTokenizer ( read ) ;
}
return tokenizer . nextToken ( ) ;
}
| private static String next ( ) throws IOException { String read ; while ( ! tokenizer . hasMoreTokens ( ) ) { read = reader . readLine ( ) ; if ( read == null || read . equals ( " " ) ) return " - 1" ; tokenizer = new StringTokenizer ( read ) ; } return tokenizer . nextToken ( ) ; } | (method_declaration (modifiers) type: (type_identifier) name: (identifier) parameters: (formal_parameters) (throws (type_identifier)) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier))) (while_statement condition: (parenthesized_expression (unary_expression operand: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) body: (block (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (null_literal)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (string_literal))))) consequence: (return_statement (string_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 ( ) throws IOException {
return Integer . parseInt ( next ( ) ) ;
}
| private static int nextInt ( ) throws IOException { return Integer . parseInt ( next ( ) ) ; } | (method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters) (throws (type_identifier)) 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 ) {
Scanner in = new Scanner ( System . in ) ;
String [ ] tokens = in . nextLine ( ) . split ( " " ) ;
List < Integer > values = new ArrayList < > ( ) ;
for ( String token : tokens ) {
values . add ( Integer . parseInt ( token ) ) ;
}
Collections . sort ( values ) ;
int result = 0 ;
while ( true ) {
int r = operation ( values ) ;
if ( r == 0 ) {
break ;
}
result += r ;
Collections . sort ( values ) ;
}
System . out . println ( result ) ;
in . close ( ) ;
}
| public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; String [ ] tokens = in . nextLine ( ) . split ( " ▁ " ) ; List < Integer > values = new ArrayList < > ( ) ; for ( String token : tokens ) { values . add ( Integer . parseInt ( token ) ) ; } Collections . sort ( values ) ; int result = 0 ; while ( true ) { int r = operation ( values ) ; if ( r == 0 ) { break ; } result += r ; Collections . sort ( values ) ; } System . out . println ( result ) ; in . 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: (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: (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)))) (enhanced_for_statement type: (type_identifier) name: (identifier) value: (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: (identifier) name: (identifier) arguments: (argument_list (identifier)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (while_statement condition: (parenthesized_expression (true)) 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: (decimal_integer_literal))) consequence: (block (break_statement))) (expression_statement (assignment_expression left: (identifier) right: (identifier))) (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 int operation ( List < Integer > values ) {
if ( values . get ( 0 ) == values . get ( 2 ) ) {
return 0 ;
}
if ( values . get ( 0 ) == values . get ( 1 ) ) {
int result = values . get ( 2 ) - values . get ( 1 ) ;
values . set ( 0 , values . get ( 2 ) ) ;
values . set ( 1 , values . get ( 2 ) ) ;
return result ;
}
if ( ( values . get ( 1 ) - values . get ( 0 ) ) % 2 == 0 ) {
int result = ( values . get ( 1 ) - values . get ( 0 ) ) / 2 ;
values . set ( 0 , values . get ( 1 ) ) ;
return result ;
}
else {
int result = ( values . get ( 1 ) + 1 - values . get ( 0 ) ) / 2 ;
values . set ( 0 , values . get ( 1 ) ) ;
values . set ( 1 , values . get ( 1 ) + 1 ) ;
return result ;
}
}
| public static int operation ( List < Integer > values ) { if ( values . get ( 0 ) == values . get ( 2 ) ) { return 0 ; } if ( values . get ( 0 ) == values . get ( 1 ) ) { int result = values . get ( 2 ) - values . get ( 1 ) ; values . set ( 0 , values . get ( 2 ) ) ; values . set ( 1 , values . get ( 2 ) ) ; return result ; } if ( ( values . get ( 1 ) - values . get ( 0 ) ) % 2 == 0 ) { int result = ( values . get ( 1 ) - values . get ( 0 ) ) / 2 ; values . set ( 0 , values . get ( 1 ) ) ; return result ; } else { int result = ( values . get ( 1 ) + 1 - values . get ( 0 ) ) / 2 ; values . set ( 0 , values . get ( 1 ) ) ; values . set ( 1 , values . get ( 1 ) + 1 ) ; return result ; } } | (method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (generic_type (type_identifier) (type_arguments (type_identifier))) name: (identifier))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal))) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal))))) consequence: (block (return_statement (decimal_integer_literal)))) (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal))) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal))))) consequence: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal))) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal)))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal) (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal)))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal) (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal)))))) (return_statement (identifier)))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal))) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal))))) right: (decimal_integer_literal)) right: (decimal_integer_literal))) consequence: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal))) right: (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) (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal)))))) (return_statement (identifier))) alternative: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (parenthesized_expression (binary_expression left: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal))) right: (decimal_integer_literal)) right: (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) (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal)))))) (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))))) (return_statement (identifier)))))) |
public static void main ( String [ ] args ) throws IOException {
BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ;
int num = Integer . parseInt ( br . readLine ( ) ) ;
int tenNum = num / 10 ;
int remainder = num % 10 ;
int answer = 0 ;
if ( remainder * 15 > 100 ) {
answer = ( tenNum + 1 ) * 100 ;
}
else {
answer = tenNum * 100 + remainder * 15 ;
}
System . out . println ( answer ) ;
}
| public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int num = Integer . parseInt ( br . readLine ( ) ) ; int tenNum = num / 10 ; int remainder = num % 10 ; int answer = 0 ; if ( remainder * 15 > 100 ) { answer = ( tenNum + 1 ) * 100 ; } else { answer = tenNum * 100 + remainder * 15 ; } System . out . println ( answer ) ; } | (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: (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: (decimal_integer_literal)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (decimal_integer_literal)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (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: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (decimal_integer_literal))))) alternative: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (binary_expression left: (identifier) right: (decimal_integer_literal))))))) (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 ( ) ;
out . println ( n >= 10 ? min ( ( n / 10 ) * 100 + ( n % 10 ) * 15 , ( n / 10 + 1 ) * 100 ) : min ( n * 15 , 100 ) ) ;
}
| public static void main ( String [ ] $ ) { Scanner sc = new Scanner ( in ) ; int n = sc . nextInt ( ) ; out . println ( n >= 10 ? min ( ( n / 10 ) * 100 + ( n % 10 ) * 15 , ( n / 10 + 1 ) * 100 ) : min ( n * 15 , 100 ) ) ; } | (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)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (ternary_expression condition: (binary_expression left: (identifier) right: (decimal_integer_literal)) consequence: (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (decimal_integer_literal)) right: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (decimal_integer_literal))) (binary_expression left: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal))) right: (decimal_integer_literal)))) alternative: (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)) (decimal_integer_literal))))))))) |
public static void main ( String [ ] args ) {
InputStream inputStream = System . in ;
OutputStream outputStream = System . out ;
FastScanner in = new FastScanner ( inputStream ) ;
PrintWriter out = new PrintWriter ( outputStream ) ;
TaskA solver = new TaskA ( ) ;
solver . solve ( 1 , in , out ) ;
out . close ( ) ;
}
| public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; FastScanner in = new FastScanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskA solver = new TaskA ( ) ; 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))))) |
private static boolean isSpaceChar ( int c ) {
return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == - 1 ;
}
| private static boolean isSpaceChar ( int c ) { return c == ' ▁ ' || c == ' \n ' || c == ' \r ' || c == ' \t ' || c == - 1 ; } | (method_declaration (modifiers) type: (boolean_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier))) body: (block (return_statement (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (character_literal)) right: (binary_expression left: (identifier) right: (character_literal))) right: (binary_expression left: (identifier) right: (character_literal))) right: (binary_expression left: (identifier) right: (character_literal))) right: (binary_expression left: (identifier) right: (unary_expression operand: (decimal_integer_literal))))))) |
public static void main ( String [ ] args ) {
SC sc = new SC ( System . in ) ;
int N = sc . nextInt ( ) ;
pl ( Math . min ( ( ( N / 10 ) * 100 + ( N % 10 ) * 15 ) , ( ( N + 9 ) / 10 ) * 100 ) ) ;
}
| public static void main ( String [ ] args ) { SC sc = new SC ( System . in ) ; int N = sc . nextInt ( ) ; pl ( Math . min ( ( ( N / 10 ) * 100 + ( N % 10 ) * 15 ) , ( ( N + 9 ) / 10 ) * 100 ) ) ; } | (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 (method_invocation name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (parenthesized_expression (binary_expression left: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (decimal_integer_literal)) right: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (decimal_integer_literal)))) (binary_expression left: (parenthesized_expression (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (decimal_integer_literal))) right: (decimal_integer_literal))))))))) |
public static void pl ( Object o ) {
System . out . println ( o ) ;
}
| public static void pl ( Object o ) { System . out . println ( o ) ; } | (method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) name: (identifier))) body: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier)))))) |
public static void p ( Object o ) {
System . out . print ( o ) ;
}
| public static void p ( Object o ) { System . out . print ( o ) ; } | (method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) name: (identifier))) body: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier)))))) |
public static boolean isPrime ( int a ) {
if ( a < 4 ) {
if ( a == 2 || a == 3 ) {
return true ;
}
else {
return false ;
}
}
else {
for ( int j = 2 ;
j * j <= a ;
j ++ ) {
if ( a % j == 0 ) {
return false ;
}
if ( a % j != 0 && ( j + 1 ) * ( j + 1 ) > a ) {
return true ;
}
}
return true ;
}
}
| public static boolean isPrime ( int a ) { if ( a < 4 ) { if ( a == 2 || a == 3 ) { return true ; } else { return false ; } } else { for ( int j = 2 ; j * j <= a ; j ++ ) { if ( a % j == 0 ) { return false ; } if ( a % j != 0 && ( j + 1 ) * ( j + 1 ) > a ) { return true ; } } return true ; } } | (method_declaration (modifiers) type: (boolean_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) consequence: (block (return_statement (true))) alternative: (block (return_statement (false))))) alternative: (block (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (identifier)) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal))) consequence: (block (return_statement (false)))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal)) right: (binary_expression left: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal)))) right: (identifier)))) consequence: (block (return_statement (true)))))) (return_statement (true)))))) |
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 ) {
Scanner sc = new Scanner ( System . in ) ;
int N = sc . nextInt ( ) ;
int L = 2 * N - 1 ;
int [ ] a = new int [ L ] ;
for ( int i = 0 ;
i < L ;
i ++ ) a [ i ] = sc . nextInt ( ) ;
int min = 1 ;
int max = L ;
boolean b [ ] = new boolean [ L ] ;
while ( min + 1 < max ) {
int mid = ( min + max ) / 2 ;
for ( int i = 0 ;
i < L ;
i ++ ) b [ i ] = a [ i ] >= mid ;
if ( satisfy ( b ) ) min = mid ;
else max = mid ;
}
System . out . println ( min ) ;
sc . close ( ) ;
}
| public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int L = 2 * N - 1 ; int [ ] a = new int [ L ] ; for ( int i = 0 ; i < L ; i ++ ) a [ i ] = sc . nextInt ( ) ; int min = 1 ; int max = L ; boolean b [ ] = new boolean [ L ] ; while ( min + 1 < max ) { int mid = ( min + max ) / 2 ; for ( int i = 0 ; i < L ; i ++ ) b [ i ] = a [ i ] >= mid ; if ( satisfy ( b ) ) min = mid ; else max = mid ; } System . out . println ( min ) ; 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: (binary_expression left: (binary_expression left: (decimal_integer_literal) right: (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 (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: (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))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (identifier))) (local_variable_declaration type: (boolean_type) declarator: (variable_declarator name: (identifier) dimensions: (dimensions) value: (array_creation_expression type: (boolean_type) dimensions: (dimensions_expr (identifier))))) (while_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (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: (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier))))) (if_statement condition: (parenthesized_expression (method_invocation name: (identifier) arguments: (argument_list (identifier)))) consequence: (expression_statement (assignment_expression left: (identifier) right: (identifier))) alternative: (expression_statement (assignment_expression left: (identifier) right: (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))))) |
static boolean satisfy ( boolean [ ] b ) {
int L = b . length ;
int N = ( L + 1 ) / 2 ;
int l = N - 1 ;
while ( l > 0 && b [ l ] != b [ l - 1 ] ) l -- ;
int r = N - 1 ;
while ( r < L - 1 && b [ r ] != b [ r + 1 ] ) r ++ ;
if ( l > 0 ) {
if ( r < L - 1 ) {
if ( b [ l ] == b [ r ] ) return b [ l ] ;
else return ( l + r ) / 2 >= N - 1 ? b [ l ] : b [ r ] ;
}
else {
return b [ l ] ;
}
}
else if ( r < L - 1 ) {
return b [ r ] ;
}
else {
return b [ N - 1 ] ^ N % 2 == 0 ;
}
}
| static boolean satisfy ( boolean [ ] b ) { int L = b . length ; int N = ( L + 1 ) / 2 ; int l = N - 1 ; while ( l > 0 && b [ l ] != b [ l - 1 ] ) l -- ; int r = N - 1 ; while ( r < L - 1 && b [ r ] != b [ r + 1 ] ) r ++ ; if ( l > 0 ) { if ( r < L - 1 ) { if ( b [ l ] == b [ r ] ) return b [ l ] ; else return ( l + r ) / 2 >= N - 1 ? b [ l ] : b [ r ] ; } else { return b [ l ] ; } } else if ( r < L - 1 ) { return b [ r ] ; } else { return b [ N - 1 ] ^ N % 2 == 0 ; } } | (method_declaration (modifiers) type: (boolean_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (boolean_type) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (field_access object: (identifier) field: (identifier)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (decimal_integer_literal)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (decimal_integer_literal)))) (while_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal)))))) body: (expression_statement (update_expression (identifier)))) (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: (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal)))))) body: (expression_statement (update_expression (identifier)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) consequence: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (identifier)))) consequence: (return_statement (array_access array: (identifier) index: (identifier))) alternative: (return_statement (ternary_expression condition: (binary_expression left: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) right: (decimal_integer_literal)) right: (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (array_access array: (identifier) index: (identifier)) alternative: (array_access array: (identifier) index: (identifier)))))) alternative: (block (return_statement (array_access array: (identifier) index: (identifier)))))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) consequence: (block (return_statement (array_access array: (identifier) index: (identifier)))) alternative: (block (return_statement (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal))))))))) |
public static void main ( String [ ] args ) {
Scanner sc = new Scanner ( System . in ) ;
int N = sc . nextInt ( ) ;
int [ ] [ ] A = new int [ N ] [ N ] ;
long sum = 0 ;
for ( int i = 0 ;
i < N ;
i ++ ) for ( int j = 0 ;
j < N ;
j ++ ) {
A [ i ] [ j ] = sc . nextInt ( ) ;
sum += A [ i ] [ j ] ;
}
sum /= 2 ;
for ( int i = 0 ;
i < N ;
i ++ ) {
for ( int j = i + 1 ;
j < N ;
j ++ ) {
for ( int k = 0 ;
k < N ;
k ++ ) {
if ( i == k || j == k ) continue ;
if ( A [ i ] [ j ] > A [ i ] [ k ] + A [ k ] [ j ] ) {
System . out . println ( - 1 ) ;
return ;
}
if ( A [ i ] [ j ] == A [ i ] [ k ] + A [ k ] [ j ] ) {
sum -= A [ i ] [ j ] ;
break ;
}
}
}
}
System . out . println ( sum ) ;
}
| public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] [ ] A = new int [ N ] [ N ] ; long sum = 0 ; for ( int i = 0 ; i < N ; i ++ ) for ( int j = 0 ; j < N ; j ++ ) { A [ i ] [ j ] = sc . nextInt ( ) ; sum += A [ i ] [ j ] ; } sum /= 2 ; for ( int i = 0 ; i < N ; i ++ ) { for ( int j = i + 1 ; j < N ; j ++ ) { for ( int k = 0 ; k < N ; k ++ ) { if ( i == k || j == k ) continue ; if ( A [ i ] [ j ] > A [ i ] [ k ] + A [ k ] [ j ] ) { System . out . println ( - 1 ) ; return ; } if ( A [ i ] [ j ] == A [ i ] [ k ] + A [ k ] [ j ] ) { sum -= A [ i ] [ j ] ; break ; } } } } 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: (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)) dimensions: (dimensions_expr (identifier))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (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: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (expression_statement (assignment_expression left: (identifier) right: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier))))))) (expression_statement (assignment_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: (binary_expression left: (identifier) right: (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: (identifier) right: (identifier)))) consequence: (continue_statement)) (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (binary_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier))))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (unary_expression operand: (decimal_integer_literal))))) (return_statement))) (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (binary_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier))))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)))) (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 ) ;
int n = scanner . nextInt ( ) ;
long [ ] [ ] dist = new long [ n + 1 ] [ n + 1 ] ;
for ( int i = 1 ;
i <= n ;
++ i ) {
for ( int j = 1 ;
j <= n ;
++ j ) {
long a = scanner . nextInt ( ) ;
dist [ i ] [ j ] = a ;
}
}
long totalLength = 0 ;
for ( int i = 1 ;
i <= n ;
++ i ) {
for ( int j = i + 1 ;
j <= n ;
++ j ) {
boolean isNecessary = true ;
for ( int k = 1 ;
k <= n ;
++ k ) {
if ( i == k || j == k ) {
continue ;
}
if ( dist [ i ] [ k ] + dist [ k ] [ j ] < dist [ i ] [ j ] ) {
System . out . println ( - 1 ) ;
return ;
}
else if ( dist [ i ] [ k ] + dist [ k ] [ j ] == dist [ i ] [ j ] ) {
isNecessary = false ;
break ;
}
}
if ( isNecessary ) {
totalLength += dist [ i ] [ j ] ;
}
}
}
System . out . println ( totalLength ) ;
}
| public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; long [ ] [ ] dist = new long [ n + 1 ] [ n + 1 ] ; for ( int i = 1 ; i <= n ; ++ i ) { for ( int j = 1 ; j <= n ; ++ j ) { long a = scanner . nextInt ( ) ; dist [ i ] [ j ] = a ; } } long totalLength = 0 ; for ( int i = 1 ; i <= n ; ++ i ) { for ( int j = i + 1 ; j <= n ; ++ j ) { boolean isNecessary = true ; for ( int k = 1 ; k <= n ; ++ k ) { if ( i == k || j == k ) { continue ; } if ( dist [ i ] [ k ] + dist [ k ] [ j ] < dist [ i ] [ j ] ) { System . out . println ( - 1 ) ; return ; } else if ( dist [ i ] [ k ] + dist [ k ] [ j ] == dist [ i ] [ j ] ) { isNecessary = false ; break ; } } if ( isNecessary ) { totalLength += dist [ i ] [ j ] ; } } } System . out . println ( totalLength ) ; } | (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))) 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 (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 (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (identifier))))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (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 (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 (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (binary_expression left: (identifier) right: (identifier)))) consequence: (block (continue_statement))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier))) right: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (unary_expression operand: (decimal_integer_literal))))) (return_statement)) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier))) right: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (false))) (break_statement)))))) (if_statement condition: (parenthesized_expression (identifier)) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (array_access array: (array_access array: (identifier) index: (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 ) ;
N = sc . nextInt ( ) ;
A = new int [ N ] [ N ] ;
for ( int i = 0 ;
i < N ;
i ++ ) {
for ( int j = 0 ;
j < N ;
j ++ ) {
A [ i ] [ j ] = sc . nextInt ( ) ;
}
}
System . out . println ( solve ( ) ) ;
}
| public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; N = sc . nextInt ( ) ; A = new int [ N ] [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { for ( int j = 0 ; j < N ; j ++ ) { A [ i ] [ j ] = sc . nextInt ( ) ; } } System . out . println ( 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 (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 (assignment_expression left: (identifier) right: (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 (identifier)) 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 (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: (array_access array: (identifier) index: (identifier)) index: (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 (method_invocation name: (identifier) arguments: (argument_list))))))) |
static long solve ( ) {
boolean [ ] [ ] indirect = new boolean [ N ] [ N ] ;
for ( int i = 0 ;
i < N - 1 ;
i ++ ) {
for ( int j = i + 1 ;
j < N ;
j ++ ) {
for ( int k = 0 ;
k < N ;
k ++ ) {
if ( k == i || k == j ) continue ;
int ikj = A [ i ] [ k ] + A [ k ] [ j ] ;
int ij = A [ i ] [ j ] ;
if ( ikj < ij ) {
return - 1 ;
}
else if ( ikj == ij ) {
indirect [ i ] [ j ] = true ;
}
}
}
}
long ans = 0 ;
for ( int i = 0 ;
i < N - 1 ;
i ++ ) {
for ( int j = i + 1 ;
j < N ;
j ++ ) {
if ( ! indirect [ i ] [ j ] ) {
ans += A [ i ] [ j ] ;
}
}
}
return ans ;
}
| static long solve ( ) { boolean [ ] [ ] indirect = new boolean [ N ] [ N ] ; for ( int i = 0 ; i < N - 1 ; i ++ ) { for ( int j = i + 1 ; j < N ; j ++ ) { for ( int k = 0 ; k < N ; k ++ ) { if ( k == i || k == j ) continue ; int ikj = A [ i ] [ k ] + A [ k ] [ j ] ; int ij = A [ i ] [ j ] ; if ( ikj < ij ) { return - 1 ; } else if ( ikj == ij ) { indirect [ i ] [ j ] = true ; } } } } long ans = 0 ; for ( int i = 0 ; i < N - 1 ; i ++ ) { for ( int j = i + 1 ; j < N ; j ++ ) { if ( ! indirect [ i ] [ j ] ) { ans += A [ i ] [ j ] ; } } } return ans ; } | (method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters) body: (block (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)) 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: (binary_expression left: (identifier) right: (decimal_integer_literal))) 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 (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: (identifier) right: (identifier)))) consequence: (continue_statement)) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (return_statement (unary_expression operand: (decimal_integer_literal)))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (true)))))))))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal))) update: (update_expression (identifier)) body: (block (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 (unary_expression operand: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)))))))))) (return_statement (identifier)))) |
public static void main ( String [ ] args ) {
Scanner sc = new Scanner ( System . in ) ;
n = sc . nextInt ( ) ;
dist = new int [ n ] [ n ] ;
for ( int i = 0 ;
i < n ;
i ++ ) {
for ( int j = 0 ;
j < n ;
j ++ ) {
dist [ i ] [ j ] = sc . nextInt ( ) ;
}
}
long sum = 0 ;
for ( int i = 0 ;
i < n ;
i ++ ) {
for ( int j = i + 1 ;
j < n ;
j ++ ) {
sum += ( long ) dist [ i ] [ j ] ;
}
}
boolean [ ] [ ] subtracted = new boolean [ n ] [ n ] ;
for ( int i = 0 ;
i < n ;
i ++ ) {
for ( int j = i + 1 ;
j < n ;
j ++ ) {
for ( int k = 0 ;
k < n ;
k ++ ) {
if ( k == i || k == j ) {
continue ;
}
if ( dist [ i ] [ j ] > dist [ i ] [ k ] + dist [ k ] [ j ] ) {
System . out . println ( - 1 ) ;
return ;
}
if ( ! subtracted [ i ] [ j ] && dist [ i ] [ j ] == dist [ i ] [ k ] + dist [ k ] [ j ] ) {
sum -= ( long ) dist [ i ] [ j ] ;
subtracted [ i ] [ j ] = true ;
}
}
}
}
System . out . println ( sum ) ;
}
| public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; n = sc . nextInt ( ) ; dist = new int [ n ] [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { dist [ i ] [ j ] = sc . nextInt ( ) ; } } long sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = i + 1 ; j < n ; j ++ ) { sum += ( long ) dist [ i ] [ j ] ; } } boolean [ ] [ ] subtracted = new boolean [ n ] [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = i + 1 ; j < n ; j ++ ) { for ( int k = 0 ; k < n ; k ++ ) { if ( k == i || k == j ) { continue ; } if ( dist [ i ] [ j ] > dist [ i ] [ k ] + dist [ k ] [ j ] ) { System . out . println ( - 1 ) ; return ; } if ( ! subtracted [ i ] [ j ] && dist [ i ] [ j ] == dist [ i ] [ k ] + dist [ k ] [ j ] ) { sum -= ( long ) dist [ i ] [ j ] ; subtracted [ i ] [ j ] = true ; } } } } 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: (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 (assignment_expression left: (identifier) right: (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 (identifier)) 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 (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: (array_access array: (identifier) index: (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: (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 (expression_statement (assignment_expression left: (identifier) right: (cast_expression type: (integral_type) value: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier))))))))) (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)) 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 (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 (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: (identifier) right: (identifier)))) consequence: (block (continue_statement))) (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (binary_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier))))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (unary_expression operand: (decimal_integer_literal))))) (return_statement))) (if_statement condition: (parenthesized_expression (binary_expression left: (unary_expression operand: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier))) right: (binary_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (binary_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)))))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (cast_expression type: (integral_type) value: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier))))) (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (true))))))))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier)))))) |
public static void main ( String args [ ] ) throws Exception {
Scanner sc = new Scanner ( System . in ) ;
int N = sc . nextInt ( ) ;
long [ ] [ ] A = new long [ N ] [ N ] ;
long [ ] [ ] D = new long [ N ] [ N ] ;
Boolean nes [ ] [ ] = new Boolean [ N ] [ N ] ;
for ( int i = 0 ;
i < N ;
i ++ ) {
for ( int j = 0 ;
j < N ;
j ++ ) {
A [ i ] [ j ] = sc . nextLong ( ) ;
if ( A [ i ] [ j ] == 0 && i != j ) {
A [ i ] [ j ] = ( long ) 10e12 ;
}
D [ i ] [ j ] = A [ i ] [ j ] ;
nes [ i ] [ j ] = true ;
}
}
for ( int i = 0 ;
i < N ;
i ++ ) {
for ( int j = 0 ;
j < N ;
j ++ ) {
for ( int k = 0 ;
k < N ;
k ++ ) {
if ( j != i && k != i && D [ j ] [ k ] == D [ j ] [ i ] + D [ i ] [ k ] ) {
nes [ j ] [ k ] = false ;
}
D [ j ] [ k ] = Math . min ( D [ j ] [ k ] , D [ j ] [ i ] + D [ i ] [ k ] ) ;
}
}
}
long ans = 0 ;
for ( int i = 0 ;
i < N ;
i ++ ) {
for ( int j = i + 1 ;
j < N ;
j ++ ) {
if ( A [ i ] [ j ] != D [ i ] [ j ] ) {
System . out . println ( - 1 ) ;
return ;
}
if ( nes [ i ] [ j ] ) {
ans += D [ i ] [ j ] ;
}
}
}
System . out . println ( ans ) ;
}
| public static void main ( String args [ ] ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; long [ ] [ ] A = new long [ N ] [ N ] ; long [ ] [ ] D = new long [ N ] [ N ] ; Boolean nes [ ] [ ] = new Boolean [ N ] [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { for ( int j = 0 ; j < N ; j ++ ) { A [ i ] [ j ] = sc . nextLong ( ) ; if ( A [ i ] [ j ] == 0 && i != j ) { A [ i ] [ j ] = ( long ) 10e12 ; } D [ i ] [ j ] = A [ i ] [ j ] ; nes [ i ] [ j ] = true ; } } for ( int i = 0 ; i < N ; i ++ ) { for ( int j = 0 ; j < N ; j ++ ) { for ( int k = 0 ; k < N ; k ++ ) { if ( j != i && k != i && D [ j ] [ k ] == D [ j ] [ i ] + D [ i ] [ k ] ) { nes [ j ] [ k ] = false ; } D [ j ] [ k ] = Math . min ( D [ j ] [ k ] , D [ j ] [ i ] + D [ i ] [ k ] ) ; } } } long ans = 0 ; for ( int i = 0 ; i < N ; i ++ ) { for ( int j = i + 1 ; j < N ; j ++ ) { if ( A [ i ] [ j ] != D [ i ] [ j ] ) { System . out . println ( - 1 ) ; return ; } if ( nes [ i ] [ j ] ) { ans += D [ i ] [ j ] ; } } } System . out . println ( ans ) ; } | (method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) name: (identifier) dimensions: (dimensions))) (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: (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 (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)) 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 (identifier)) 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 (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: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (decimal_integer_literal)) right: (binary_expression left: (identifier) right: (identifier)))) consequence: (block (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (cast_expression type: (integral_type) value: (decimal_floating_point_literal)))))) (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)))) (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (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 (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: (binary_expression left: (identifier) right: (identifier)) right: (binary_expression left: (identifier) right: (identifier))) right: (binary_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (binary_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)))))) consequence: (block (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (false))))) (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 (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) (binary_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier))))))))))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (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: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (unary_expression operand: (decimal_integer_literal))))) (return_statement))) (if_statement condition: (parenthesized_expression (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (array_access array: (array_access array: (identifier) index: (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 ) {
try ( Scanner sc = new Scanner ( System . in ) ;
) {
new Main ( ) . solve ( sc ) ;
}
}
| public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ; ) { new Main ( ) . solve ( sc ) ; } } | (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 (expression_statement (method_invocation object: (object_creation_expression type: (type_identifier) arguments: (argument_list)) name: (identifier) arguments: (argument_list (identifier)))))))) |
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 ) ;
int N = Integer . parseInt ( sc . next ( ) ) ;
HashMap < Long , Pair > map = new HashMap < > ( ) ;
ArrayList < Pair > l = new ArrayList < > ( ) ;
for ( int i = 0 ;
i < N ;
i ++ ) {
long c = Long . parseLong ( sc . next ( ) ) ;
if ( ! map . containsKey ( c ) ) {
Pair p = new Pair ( c , 1 ) ;
map . put ( c , p ) ;
l . add ( p ) ;
}
else {
Pair p = map . get ( c ) ;
p . cnt ++ ;
}
}
Collections . sort ( l ) ;
int size = l . size ( ) ;
Pair p1 = l . get ( size - 1 ) ;
Pair p2 = l . get ( size - 2 ) ;
long res = 0 ;
if ( p1 . cnt >= 4 ) res = p1 . a * p1 . a ;
else if ( p1 . cnt >= 2 && p2 . cnt >= 2 ) res = p1 . a * p2 . a ;
System . out . println ( res ) ;
}
| public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . next ( ) ) ; HashMap < Long , Pair > map = new HashMap < > ( ) ; ArrayList < Pair > l = new ArrayList < > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { long c = Long . parseLong ( sc . next ( ) ) ; if ( ! map . containsKey ( c ) ) { Pair p = new Pair ( c , 1 ) ; map . put ( c , p ) ; l . add ( p ) ; } else { Pair p = map . get ( c ) ; p . cnt ++ ; } } Collections . sort ( l ) ; int size = l . size ( ) ; Pair p1 = l . get ( size - 1 ) ; Pair p2 = l . get ( size - 2 ) ; long res = 0 ; if ( p1 . cnt >= 4 ) res = p1 . a * p1 . a ; else if ( p1 . cnt >= 2 && p2 . cnt >= 2 ) res = p1 . a * p2 . a ; System . out . println ( res ) ; } | (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: (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)))) (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 (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 (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (identifier) (decimal_integer_literal))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (identifier)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))) alternative: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))) (expression_statement (update_expression (field_access object: (identifier) field: (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: (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 (binary_expression left: (identifier) right: (decimal_integer_literal)))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (if_statement condition: (parenthesized_expression (binary_expression left: (field_access object: (identifier) field: (identifier)) right: (decimal_integer_literal))) consequence: (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (field_access object: (identifier) field: (identifier)) right: (field_access object: (identifier) field: (identifier))))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (field_access object: (identifier) field: (identifier)) right: (decimal_integer_literal)) right: (binary_expression left: (field_access object: (identifier) field: (identifier)) right: (decimal_integer_literal)))) consequence: (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (field_access object: (identifier) field: (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)))))) |
public static void main ( String [ ] $ ) {
Scanner sc = new Scanner ( in ) ;
int n = sc . nextInt ( ) ;
long [ ] a = new long [ n ] ;
long edge1 = 0 , edge2 = 0 ;
TreeMap < Long , Long > tm = new TreeMap < > ( ) ;
for ( int i = 0 ;
i < n ;
i ++ ) {
a [ i ] = sc . nextLong ( ) ;
tm . put ( a [ i ] , tm . getOrDefault ( a [ i ] , 0l ) + 1 ) ;
}
while ( tm . size ( ) > 0 && edge1 == 0 ) {
Map . Entry < Long , Long > temp = tm . pollLastEntry ( ) ;
if ( temp . getValue ( ) > 1 ) {
edge1 = temp . getKey ( ) ;
tm . put ( temp . getKey ( ) , temp . getValue ( ) - 2 ) ;
}
}
while ( tm . size ( ) > 0 && edge2 == 0 ) {
Map . Entry < Long , Long > temp = tm . pollLastEntry ( ) ;
if ( temp . getValue ( ) > 1 ) {
edge2 = temp . getKey ( ) ;
}
}
out . println ( edge1 * edge2 ) ;
}
| public static void main ( String [ ] $ ) { Scanner sc = new Scanner ( in ) ; int n = sc . nextInt ( ) ; long [ ] a = new long [ n ] ; long edge1 = 0 , edge2 = 0 ; TreeMap < Long , Long > tm = new TreeMap < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextLong ( ) ; tm . put ( a [ i ] , tm . getOrDefault ( a [ i ] , 0l ) + 1 ) ; } while ( tm . size ( ) > 0 && edge1 == 0 ) { Map . Entry < Long , Long > temp = tm . pollLastEntry ( ) ; if ( temp . getValue ( ) > 1 ) { edge1 = temp . getKey ( ) ; tm . put ( temp . getKey ( ) , temp . getValue ( ) - 2 ) ; } } while ( tm . size ( ) > 0 && edge2 == 0 ) { Map . Entry < Long , Long > temp = tm . pollLastEntry ( ) ; if ( temp . getValue ( ) > 1 ) { edge2 = temp . getKey ( ) ; } } out . println ( edge1 * edge2 ) ; } | (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: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (identifier))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal)) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (local_variable_declaration type: (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: (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: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (identifier)) (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (identifier)) (decimal_integer_literal))) right: (decimal_integer_literal))))))) (while_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal)) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) body: (block (local_variable_declaration type: (generic_type (scoped_type_identifier (type_identifier) (type_identifier)) (type_arguments (type_identifier) (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)) right: (decimal_integer_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal))))))))) (while_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal)) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) body: (block (local_variable_declaration type: (generic_type (scoped_type_identifier (type_identifier) (type_identifier)) (type_arguments (type_identifier) (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)) right: (decimal_integer_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (identifier))))))) |
public static void main ( String [ ] args ) {
Scanner sc = new Scanner ( System . in ) ;
while ( sc . hasNextInt ( ) ) {
int N = sc . nextInt ( ) ;
Map < Long , Integer > cnt = new HashMap < > ( ) ;
Set < Long > set = new HashSet < > ( ) ;
for ( int i = 0 ;
i < N ;
i ++ ) {
long x = sc . nextLong ( ) ;
int nowCnt = cnt . getOrDefault ( x , 0 ) ;
nowCnt ++ ;
cnt . put ( x , nowCnt ) ;
set . add ( x ) ;
}
List < Long > sortList = new ArrayList < > ( set ) ;
sortList . sort ( Long :: compareTo ) ;
long ans = 0 ;
List < Long > hen = new ArrayList < > ( ) ;
for ( int i = sortList . size ( ) - 1 ;
hen . size ( ) < 2 && i >= 0 ;
i -- ) {
long len = sortList . get ( i ) ;
if ( cnt . get ( len ) >= 2 ) {
hen . add ( len ) ;
}
if ( cnt . get ( len ) >= 4 ) {
hen . add ( len ) ;
}
}
if ( hen . size ( ) >= 2 ) {
ans = hen . get ( 0 ) * hen . get ( 1 ) ;
}
System . out . println ( ans ) ;
}
}
| public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( sc . hasNextInt ( ) ) { int N = sc . nextInt ( ) ; Map < Long , Integer > cnt = new HashMap < > ( ) ; Set < Long > set = new HashSet < > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { long x = sc . nextLong ( ) ; int nowCnt = cnt . getOrDefault ( x , 0 ) ; nowCnt ++ ; cnt . put ( x , nowCnt ) ; set . add ( x ) ; } List < Long > sortList = new ArrayList < > ( set ) ; sortList . sort ( Long :: compareTo ) ; long ans = 0 ; List < Long > hen = new ArrayList < > ( ) ; for ( int i = sortList . size ( ) - 1 ; hen . size ( ) < 2 && i >= 0 ; i -- ) { long len = sortList . get ( i ) ; if ( cnt . get ( len ) >= 2 ) { hen . add ( len ) ; } if ( cnt . get ( len ) >= 4 ) { hen . add ( len ) ; } } if ( hen . size ( ) >= 2 ) { ans = hen . get ( 0 ) * hen . get ( 1 ) ; } 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)))))) (while_statement condition: (parenthesized_expression (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)))) (local_variable_declaration type: (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)))) (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)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (decimal_integer_literal))))) (expression_statement (update_expression (identifier))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (identifier)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))))) (local_variable_declaration type: (generic_type (type_identifier) (type_arguments (type_identifier))) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (generic_type (type_identifier) (type_arguments)) arguments: (argument_list (identifier))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_reference (identifier) (identifier))))) (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)))) (for_statement init: (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)))) condition: (binary_expression left: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal)) 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 (identifier))))) (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: (identifier) name: (identifier) arguments: (argument_list (identifier)))))) (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: (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 (assignment_expression left: (identifier) right: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal))) right: (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 (identifier)))))))) |
public static void main ( String [ ] args ) {
Scanner sc = new Scanner ( System . in ) ;
int n = sc . nextInt ( ) ;
String s = sc . next ( ) ;
int r = 0 ;
int g = 0 ;
int b = 0 ;
for ( char c : s . toCharArray ( ) ) {
switch ( c ) {
case 'R' : r ++ ;
break ;
case 'G' : g ++ ;
break ;
case 'B' : b ++ ;
break ;
}
}
System . out . println ( r % 2 + g % 2 + b % 2 ) ;
}
| public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String s = sc . next ( ) ; int r = 0 ; int g = 0 ; int b = 0 ; for ( char c : s . toCharArray ( ) ) { switch ( c ) { case ' R ' : r ++ ; break ; case ' G ' : g ++ ; break ; case ' B ' : b ++ ; break ; } } System . out . println ( r % 2 + g % 2 + b % 2 ) ; } | (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: (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: (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))) (enhanced_for_statement type: (integral_type) name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) body: (block (switch_expression condition: (parenthesized_expression (identifier)) body: (switch_block (switch_block_statement_group (switch_label (character_literal)) (expression_statement (update_expression (identifier))) (break_statement)) (switch_block_statement_group (switch_label (character_literal)) (expression_statement (update_expression (identifier))) (break_statement)) (switch_block_statement_group (switch_label (character_literal)) (expression_statement (update_expression (identifier))) (break_statement)))))) (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: (decimal_integer_literal)) right: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))))))) |
public static Color toEnum ( String string ) {
if ( string . equals ( R . name ) ) {
return R ;
}
else if ( string . equals ( B . name ) ) {
return B ;
}
else {
return G ;
}
}
| public static Color toEnum ( String string ) { if ( string . equals ( R . name ) ) { return R ; } else if ( string . equals ( B . name ) ) { return B ; } else { return G ; } } | (method_declaration (modifiers) type: (type_identifier) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) name: (identifier))) body: (block (if_statement condition: (parenthesized_expression (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier))))) consequence: (block (return_statement (identifier))) alternative: (if_statement condition: (parenthesized_expression (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier))))) consequence: (block (return_statement (identifier))) alternative: (block (return_statement (identifier))))))) |
public static void main ( String [ ] args ) {
Scanner scanner = new Scanner ( System . in ) ;
final int N = scanner . nextInt ( ) ;
final String S = scanner . next ( ) ;
Deque < Color > deque = new ArrayDeque < > ( ) ;
String [ ] strings = S . split ( "" ) ;
for ( int i = 0 ;
i < N ;
i ++ ) {
Color ball = Color . toEnum ( strings [ i ] ) ;
if ( deque . size ( ) == 0 ) {
deque . addLast ( ball ) ;
continue ;
}
if ( deque . size ( ) == 1 ) {
Color ball1 = deque . getFirst ( ) ;
if ( ball1 == ball ) {
deque . removeFirst ( ) ;
}
else {
deque . addLast ( ball ) ;
}
continue ;
}
Color ball1 = deque . getFirst ( ) ;
Color ball2 = deque . getLast ( ) ;
if ( ball == ball1 ) {
deque . removeFirst ( ) ;
continue ;
}
if ( ball == ball2 ) {
deque . removeLast ( ) ;
continue ;
}
if ( i == N - 1 ) {
deque . addLast ( ball ) ;
continue ;
}
Color nextBall = Color . toEnum ( strings [ i + 1 ] ) ;
if ( ball == nextBall ) {
deque . addLast ( ball ) ;
continue ;
}
if ( ball1 == nextBall ) {
deque . addLast ( ball ) ;
}
else if ( ball2 == nextBall ) {
deque . addFirst ( ball ) ;
}
}
System . out . println ( deque . size ( ) ) ;
}
| public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; final int N = scanner . nextInt ( ) ; final String S = scanner . next ( ) ; Deque < Color > deque = new ArrayDeque < > ( ) ; String [ ] strings = S . split ( " " ) ; for ( int i = 0 ; i < N ; i ++ ) { Color ball = Color . toEnum ( strings [ i ] ) ; if ( deque . size ( ) == 0 ) { deque . addLast ( ball ) ; continue ; } if ( deque . size ( ) == 1 ) { Color ball1 = deque . getFirst ( ) ; if ( ball1 == ball ) { deque . removeFirst ( ) ; } else { deque . addLast ( ball ) ; } continue ; } Color ball1 = deque . getFirst ( ) ; Color ball2 = deque . getLast ( ) ; if ( ball == ball1 ) { deque . removeFirst ( ) ; continue ; } if ( ball == ball2 ) { deque . removeLast ( ) ; continue ; } if ( i == N - 1 ) { deque . addLast ( ball ) ; continue ; } Color nextBall = Color . toEnum ( strings [ i + 1 ] ) ; if ( ball == nextBall ) { deque . addLast ( ball ) ; continue ; } if ( ball1 == nextBall ) { deque . addLast ( ball ) ; } else if ( ball2 == nextBall ) { deque . addFirst ( ball ) ; } } System . out . println ( deque . size ( ) ) ; } | (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: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration (modifiers) type: (type_identifier) 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: (array_type element: (type_identifier) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (string_literal))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (local_variable_declaration type: (type_identifier) 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 (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal))) consequence: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) (continue_statement))) (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: (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: (identifier) right: (identifier))) consequence: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) alternative: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))))) (continue_statement))) (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: (identifier) right: (identifier))) consequence: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) (continue_statement))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) (continue_statement))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) consequence: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) (continue_statement))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) (continue_statement))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (expression_statement (method_invocation object: (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: (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 object: (identifier) name: (identifier) arguments: (argument_list))))))) |
public static void main ( String [ ] args ) {
Scanner sc = new Scanner ( System . in ) ;
int N = sc . nextInt ( ) ;
char s [ ] = sc . next ( ) . toCharArray ( ) ;
int [ ] num = new int [ 3 ] ;
for ( int i = 0 ;
i < N ;
i ++ ) {
switch ( s [ i ] ) {
case 'R' : num [ 0 ] ++ ;
break ;
case 'G' : num [ 1 ] ++ ;
break ;
case 'B' : num [ 2 ] ++ ;
break ;
}
}
int ans = 0 ;
for ( int i = 0 ;
i < 3 ;
i ++ ) {
ans += num [ i ] % 2 ;
}
System . out . println ( ans ) ;
}
| public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; char s [ ] = sc . next ( ) . toCharArray ( ) ; int [ ] num = new int [ 3 ] ; for ( int i = 0 ; i < N ; i ++ ) { switch ( s [ i ] ) { case ' R ' : num [ 0 ] ++ ; break ; case ' G ' : num [ 1 ] ++ ; break ; case ' B ' : num [ 2 ] ++ ; break ; } } int ans = 0 ; for ( int i = 0 ; i < 3 ; i ++ ) { ans += num [ i ] % 2 ; } 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) dimensions: (dimensions) value: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) 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))))) (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 (switch_expression condition: (parenthesized_expression (array_access array: (identifier) index: (identifier))) body: (switch_block (switch_block_statement_group (switch_label (character_literal)) (expression_statement (update_expression (array_access array: (identifier) index: (decimal_integer_literal)))) (break_statement)) (switch_block_statement_group (switch_label (character_literal)) (expression_statement (update_expression (array_access array: (identifier) index: (decimal_integer_literal)))) (break_statement)) (switch_block_statement_group (switch_label (character_literal)) (expression_statement (update_expression (array_access array: (identifier) index: (decimal_integer_literal)))) (break_statement)))))) (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 (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal)))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier)))))) |
public static void main ( String [ ] args ) throws Exception {
Scanner sc = new Scanner ( System . in ) ;
int a = sc . nextInt ( ) ;
int b = sc . nextInt ( ) ;
sc . close ( ) ;
if ( a == b ) {
System . out . println ( "Draw" ) ;
}
else if ( a == 1 ) {
System . out . println ( "Alice" ) ;
}
else if ( b == 1 ) {
System . out . println ( "Bob" ) ;
}
else if ( a > b ) {
System . out . println ( "Alice" ) ;
}
else {
System . out . println ( "Bob" ) ;
}
}
| public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; sc . close ( ) ; if ( a == b ) { System . out . println ( " Draw " ) ; } else if ( a == 1 ) { System . out . println ( " Alice " ) ; } else if ( b == 1 ) { System . out . println ( " Bob " ) ; } else if ( a > b ) { System . out . println ( " Alice " ) ; } else { System . out . println ( " Bob " ) ; } } | (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)))) (expression_statement (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 (string_literal))))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (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: (if_statement condition: (parenthesized_expression (binary_expression left: (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: (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 ) {
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 ) {
Scanner sc = new Scanner ( System . in ) ;
int A = sc . nextInt ( ) ;
int B = sc . nextInt ( ) ;
if ( A == 1 ) {
A = 14 ;
}
if ( B == 1 ) {
B = 14 ;
}
if ( A == B ) {
System . out . println ( "Draw" ) ;
}
else if ( A > B ) {
System . out . println ( "Alice" ) ;
}
else {
System . out . println ( "Bob" ) ;
}
}
| public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; if ( A == 1 ) { A = 14 ; } if ( B == 1 ) { B = 14 ; } if ( A == B ) { System . out . println ( " Draw " ) ; } else if ( A > B ) { System . out . println ( " Alice " ) ; } else { System . out . println ( " Bob " ) ; } } | (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)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (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: (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 ) {
int a = sc . nextInt ( ) , b = sc . nextInt ( ) ;
if ( a == b ) {
System . out . println ( "Draw" ) ;
return ;
}
if ( a == 1 ) {
a += 13 ;
}
if ( b == 1 ) {
b += 13 ;
}
System . out . println ( a > b ? "Alice" : "Bob" ) ;
}
| public static void main ( String [ ] args ) { int a = sc . nextInt ( ) , b = sc . nextInt ( ) ; if ( a == b ) { System . out . println ( " Draw " ) ; return ; } if ( a == 1 ) { a += 13 ; } if ( b == 1 ) { b += 13 ; } System . out . println ( a > b ? " Alice " : " Bob " ) ; } | (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))) 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 (string_literal)))) (return_statement))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (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: (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: (identifier) right: (identifier)) consequence: (string_literal) alternative: (string_literal))))))) |
public static void main ( String [ ] args ) throws Exception {
Scanner sc = new Scanner ( System . in ) ;
int A = sc . nextInt ( ) ;
int B = sc . nextInt ( ) ;
if ( A == 1 ) A = 14 ;
if ( B == 1 ) B = 14 ;
String ans ;
if ( A > B ) {
ans = "Alice" ;
}
else if ( A < B ) {
ans = "Bob" ;
}
else {
ans = "Draw" ;
}
System . out . print ( ans ) ;
}
| public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; if ( A == 1 ) A = 14 ; if ( B == 1 ) B = 14 ; String ans ; if ( A > B ) { ans = " Alice " ; } else if ( A < B ) { ans = " Bob " ; } else { ans = " Draw " ; } System . out . print ( 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)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal)))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (string_literal)))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (string_literal)))) alternative: (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)))))) |
public static void main ( String [ ] args ) {
Scanner sc = new Scanner ( System . in ) ;
int n = sc . nextInt ( ) ;
int a = sc . nextInt ( ) ;
int b = sc . nextInt ( ) ;
int ans = 0 ;
if ( n >= 5 ) {
ans = 5 * b + ( n - 5 ) * a ;
}
else {
ans = n * b ;
}
System . out . println ( ans ) ;
}
| public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int ans = 0 ; if ( n >= 5 ) { ans = 5 * b + ( n - 5 ) * a ; } else { ans = n * b ; } 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)))) (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: (binary_expression left: (binary_expression left: (decimal_integer_literal) right: (identifier)) right: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (identifier)))))) alternative: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (identifier)))))) (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 ;
FastScanner in = new FastScanner ( 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 ; FastScanner in = new FastScanner ( 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))))) |
private static boolean isSpaceChar ( int c ) {
return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == - 1 ;
}
| private static boolean isSpaceChar ( int c ) { return c == ' ▁ ' || c == ' \n ' || c == ' \r ' || c == ' \t ' || c == - 1 ; } | (method_declaration (modifiers) type: (boolean_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier))) body: (block (return_statement (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (character_literal)) right: (binary_expression left: (identifier) right: (character_literal))) right: (binary_expression left: (identifier) right: (character_literal))) right: (binary_expression left: (identifier) right: (character_literal))) right: (binary_expression left: (identifier) right: (unary_expression operand: (decimal_integer_literal))))))) |
public static void main ( String [ ] args ) {
SC sc = new SC ( System . in ) ;
int N = sc . nextInt ( ) ;
int A = sc . nextInt ( ) ;
int B = sc . nextInt ( ) ;
if ( N <= 5 ) {
pl ( B * N ) ;
}
else if ( N > 5 ) {
pl ( ( B * 5 + ( N - 5 ) * A ) ) ;
}
}
| public static void main ( String [ ] args ) { SC sc = new SC ( System . in ) ; int N = sc . nextInt ( ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; if ( N <= 5 ) { pl ( B * N ) ; } else if ( N > 5 ) { pl ( ( B * 5 + ( N - 5 ) * 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: (decimal_integer_literal))) consequence: (block (expression_statement (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (identifier)))))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (expression_statement (method_invocation name: (identifier) arguments: (argument_list (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (identifier)))))))))))) |
public static void pl ( Object o ) {
System . out . println ( o ) ;
}
| public static void pl ( Object o ) { System . out . println ( o ) ; } | (method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) name: (identifier))) body: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier)))))) |
public static void p ( Object o ) {
System . out . print ( o ) ;
}
| public static void p ( Object o ) { System . out . print ( o ) ; } | (method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) name: (identifier))) body: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier)))))) |
public static boolean isPrime ( int a ) {
if ( a < 4 ) {
if ( a == 2 || a == 3 ) {
return true ;
}
else {
return false ;
}
}
else {
for ( int j = 2 ;
j * j <= a ;
j ++ ) {
if ( a % j == 0 ) {
return false ;
}
if ( a % j != 0 && ( j + 1 ) * ( j + 1 ) > a ) {
return true ;
}
}
return true ;
}
}
| public static boolean isPrime ( int a ) { if ( a < 4 ) { if ( a == 2 || a == 3 ) { return true ; } else { return false ; } } else { for ( int j = 2 ; j * j <= a ; j ++ ) { if ( a % j == 0 ) { return false ; } if ( a % j != 0 && ( j + 1 ) * ( j + 1 ) > a ) { return true ; } } return true ; } } | (method_declaration (modifiers) type: (boolean_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) consequence: (block (return_statement (true))) alternative: (block (return_statement (false))))) alternative: (block (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (identifier)) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal))) consequence: (block (return_statement (false)))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal)) right: (binary_expression left: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal)))) right: (identifier)))) consequence: (block (return_statement (true)))))) (return_statement (true)))))) |
static int min ( int a , int b ) {
if ( a > b ) return b ;
else return a ;
}
| static int min ( int a , int b ) { if ( a > b ) return b ; else return a ; } | (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: (identifier))) consequence: (return_statement (identifier)) alternative: (return_statement (identifier))))) |
static void solve ( ) {
int n , sc , di ;
Scanner cin = new Scanner ( System . in ) ;
n = cin . nextInt ( ) ;
sc = cin . nextInt ( ) ;
di = cin . nextInt ( ) ;
System . out . println ( ( min ( n , 5 ) * di ) + ( n - min ( n , 5 ) ) * sc ) ;
}
| static void solve ( ) { int n , sc , di ; Scanner cin = new Scanner ( System . in ) ; n = cin . nextInt ( ) ; sc = cin . nextInt ( ) ; di = cin . nextInt ( ) ; System . out . println ( ( min ( n , 5 ) * di ) + ( n - min ( n , 5 ) ) * sc ) ; } | (method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier)) declarator: (variable_declarator name: (identifier)) declarator: (variable_declarator name: (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 (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)))) (expression_statement (assignment_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 (binary_expression left: (parenthesized_expression (binary_expression left: (method_invocation name: (identifier) arguments: (argument_list (identifier) (decimal_integer_literal))) right: (identifier))) right: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (method_invocation name: (identifier) arguments: (argument_list (identifier) (decimal_integer_literal))))) right: (identifier)))))))) |
public static void main ( String args [ ] ) {
solve ( ) ;
}
| public static void main ( String args [ ] ) { solve ( ) ; } | (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))))) |
public static void main ( String [ ] $ ) {
Scanner sc = new Scanner ( in ) ;
int n = sc . nextInt ( ) , a = sc . nextInt ( ) , b = sc . nextInt ( ) ;
int ans = 0 ;
for ( int i = 1 ;
i <= n ;
i ++ ) {
if ( i <= 5 ) ans += b ;
else ans += a ;
}
out . println ( ans ) ;
}
| public static void main ( String [ ] $ ) { Scanner sc = new Scanner ( in ) ; int n = sc . nextInt ( ) , a = sc . nextInt ( ) , b = sc . nextInt ( ) ; int ans = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { if ( i <= 5 ) ans += b ; else ans += a ; } 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))) 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)))) (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 (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (expression_statement (assignment_expression left: (identifier) right: (identifier))) alternative: (expression_statement (assignment_expression left: (identifier) right: (identifier)))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))))) |
public static void main ( String [ ] args ) {
Scanner in = new Scanner ( System . in ) ;
long x = in . nextLong ( ) , y = in . nextLong ( ) ;
System . out . println ( Math . abs ( x - y ) <= 1 ? "Brown" : "Alice" ) ;
}
| public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; long x = in . nextLong ( ) , y = in . nextLong ( ) ; System . out . println ( Math . abs ( x - y ) <= 1 ? " Brown " : " Alice " ) ; } | (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))) 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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (identifier)))) right: (decimal_integer_literal)) consequence: (string_literal) alternative: (string_literal))))))) |
public static void main ( String [ ] args ) throws IOException {
new Main ( ) . run ( ) ;
}
| public static void main ( String [ ] args ) throws IOException { 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))) (throws (type_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 ) {
MyScanner sc = new MyScanner ( ) ;
out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ;
long x = sc . nextLong ( ) ;
long y = sc . nextLong ( ) ;
out . println ( Math . abs ( x - y ) <= 1 ? "Brown" : "Alice" ) ;
out . close ( ) ;
}
| public static void main ( String [ ] args ) { MyScanner sc = new MyScanner ( ) ; out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ; long x = sc . nextLong ( ) ; long y = sc . nextLong ( ) ; out . println ( Math . abs ( x - y ) <= 1 ? " Brown " : " Alice " ) ; 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: (object_creation_expression type: (type_identifier) arguments: (argument_list)))) (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)))))))) (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 (ternary_expression condition: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (identifier)))) right: (decimal_integer_literal)) consequence: (string_literal) alternative: (string_literal))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))))) |
static void db ( Object ... os ) {
System . err . println ( Arrays . deepToString ( os ) ) ;
}
| static void db ( Object ... os ) { System . err . println ( Arrays . deepToString ( os ) ) ; } | (method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (spread_parameter (type_identifier) (variable_declarator name: (identifier)))) body: (block (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 (identifier)))))))) |
private static BigInteger C ( long n , long r ) {
BigInteger res = BigInteger . ONE ;
for ( long i = n ;
i > n - r ;
-- i ) {
res = res . multiply ( BigInteger . valueOf ( i ) ) ;
}
for ( long i = r ;
i > 1 ;
-- i ) {
res = res . divide ( BigInteger . valueOf ( i ) ) ;
}
return res ;
}
| private static BigInteger C ( long n , long r ) { BigInteger res = BigInteger . ONE ; for ( long i = n ; i > n - r ; -- i ) { res = res . multiply ( BigInteger . valueOf ( i ) ) ; } for ( long i = r ; i > 1 ; -- i ) { res = res . divide ( BigInteger . valueOf ( i ) ) ; } return res ; } | (method_declaration (modifiers) type: (type_identifier) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (field_access object: (identifier) field: (identifier)))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (identifier))) condition: (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (identifier))) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (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: (identifier))) condition: (binary_expression left: (identifier) right: (decimal_integer_literal)) update: (update_expression (identifier)) body: (block (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))))))))) (return_statement (identifier)))) |
private static BigInteger P ( long n , long r ) {
BigInteger res = BigInteger . ONE ;
for ( long i = n ;
i > n - r ;
-- i ) {
res = res . multiply ( BigInteger . valueOf ( i ) ) ;
}
return res ;
}
| private static BigInteger P ( long n , long r ) { BigInteger res = BigInteger . ONE ; for ( long i = n ; i > n - r ; -- i ) { res = res . multiply ( BigInteger . valueOf ( i ) ) ; } return res ; } | (method_declaration (modifiers) type: (type_identifier) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (field_access object: (identifier) field: (identifier)))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (identifier))) condition: (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (identifier))) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))))))) (return_statement (identifier)))) |
public static void main ( String [ ] args ) {
long S = System . currentTimeMillis ( ) ;
Scanner sc = new Scanner ( System . in ) ;
new Main ( ) . solve ( sc ) ;
_out . flush ( ) ;
long G = System . currentTimeMillis ( ) ;
if ( elapsed ) {
_err . println ( ( G - S ) + "ms" ) ;
}
_err . flush ( ) ;
}
| public static void main ( String [ ] args ) { long S = System . currentTimeMillis ( ) ; Scanner sc = new Scanner ( System . in ) ; new Main ( ) . solve ( sc ) ; _out . flush ( ) ; long G = System . currentTimeMillis ( ) ; if ( elapsed ) { _err . println ( ( G - S ) + " ms " ) ; } _err . 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: (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: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (expression_statement (method_invocation object: (object_creation_expression type: (type_identifier) arguments: (argument_list)) name: (identifier) arguments: (argument_list (identifier)))) (expression_statement (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 (identifier)) consequence: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) right: (string_literal))))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))))) |
public static void main ( String [ ] args ) {
Scanner sc = new Scanner ( System . in ) ;
int N = sc . nextInt ( ) ;
int total = 0 ;
for ( int i = 1 ;
i <= N ;
i ++ ) {
int count = 1 ;
count += N - i ;
total += count ;
}
System . out . println ( total ) ;
}
| public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int total = 0 ; for ( int i = 1 ; i <= N ; i ++ ) { int count = 1 ; count += N - i ; total += count ; } System . out . println ( total ) ; } | (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))) (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))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (identifier))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier)))))) |
public static void main ( String [ ] args ) {
SC sc = new SC ( System . in ) ;
int a = sc . nextInt ( ) ;
pl ( a * ( a + 1 ) / 2 ) ;
}
| public static void main ( String [ ] args ) { SC sc = new SC ( System . in ) ; int a = sc . nextInt ( ) ; pl ( a * ( a + 1 ) / 2 ) ; } | (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 (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (identifier) right: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal)))) right: (decimal_integer_literal))))))) |
public static void pl ( Object o ) {
System . out . println ( o ) ;
}
| public static void pl ( Object o ) { System . out . println ( o ) ; } | (method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) name: (identifier))) body: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier)))))) |
public static void p ( Object o ) {
System . out . print ( o ) ;
}
| public static void p ( Object o ) { System . out . print ( o ) ; } | (method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) 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 ( ) ;
int ans = 0 ;
for ( int i = 0 ;
i < n ;
i ++ ) {
for ( int j = i ;
j < n ;
j ++ ) {
ans ++ ;
}
}
out . println ( ans ) ;
}
| public static void main ( String [ ] $ ) { Scanner sc = new Scanner ( in ) ; int n = sc . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = i ; j < n ; j ++ ) { ans ++ ; } } 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: (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: (identifier))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (expression_statement (update_expression (identifier))))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))))) |
public static void main ( String [ ] args ) {
int n = s . nextInt ( ) ;
System . out . println ( n * ( n + 1 ) / 2 ) ;
}
| public static void main ( String [ ] args ) { int n = s . nextInt ( ) ; System . out . println ( n * ( n + 1 ) / 2 ) ; } | (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 (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (identifier) right: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal)))) right: (decimal_integer_literal))))))) |
public static void main ( String [ ] args ) {
final Scanner sc = new Scanner ( System . in ) ;
int n = sc . nextInt ( ) ;
long ans = 0 ;
for ( int i = n ;
i >= 1 ;
i -- ) {
ans += i ;
}
System . out . println ( ans ) ;
}
| public static void main ( String [ ] args ) { final Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long ans = 0 ; for ( int i = n ; i >= 1 ; i -- ) { ans += 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 (modifiers) 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))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (identifier))) condition: (binary_expression left: (identifier) right: (decimal_integer_literal)) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (identifier) right: (identifier))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier)))))) |
public static void main ( String [ ] args ) throws Exception {
Scanner sc = new Scanner ( System . in ) ;
final int N = sc . nextInt ( ) ;
final int K = sc . nextInt ( ) ;
System . out . println ( N % K == 0 ? 0 : 1 ) ;
}
| public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; final int N = sc . nextInt ( ) ; final int K = sc . nextInt ( ) ; System . out . println ( N % K == 0 ? 0 : 1 ) ; } | (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 (modifiers) type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration (modifiers) 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: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal)) consequence: (decimal_integer_literal) alternative: (decimal_integer_literal))))))) |
public static void main ( String [ ] args ) {
new Main ( ) . solveA ( ) ;
}
| public static void main ( String [ ] args ) { new Main ( ) . solveA ( ) ; } | (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 ) {
BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ;
Scanner sc = new Scanner ( System . in ) ;
int n = sc . nextInt ( ) ;
int k = sc . nextInt ( ) ;
if ( n % k == 0 ) System . out . println ( 0 ) ;
else System . out . println ( 1 ) ;
}
| public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( n % k == 0 ) System . out . println ( 0 ) ; else System . out . println ( 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 (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 (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)))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal))) consequence: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (decimal_integer_literal)))) alternative: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (decimal_integer_literal))))))) |
public static void main ( String [ ] args ) throws IOException {
Scanner scanner = new Scanner ( System . in ) ;
BufferedWriter bufferedWriter = new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ;
int N = scanner . nextInt ( ) ;
int K = scanner . nextInt ( ) ;
int res ;
if ( N % K == 0 ) res = 0 ;
else res = 1 ;
bufferedWriter . write ( Integer . toString ( res ) ) ;
bufferedWriter . close ( ) ;
scanner . close ( ) ;
}
| public static void main ( String [ ] args ) throws IOException { Scanner scanner = new Scanner ( System . in ) ; BufferedWriter bufferedWriter = new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ; int N = scanner . nextInt ( ) ; int K = scanner . nextInt ( ) ; int res ; if ( N % K == 0 ) res = 0 ; else res = 1 ; bufferedWriter . write ( Integer . toString ( res ) ) ; bufferedWriter . close ( ) ; scanner . close ( ) ; } | (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: (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: (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))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal))) consequence: (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))) alternative: (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal)))) (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: (identifier) name: (identifier) arguments: (argument_list))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))))) |
public static void main ( String [ ] args ) {
System . out . println ( scanner . nextInt ( ) % scanner . nextInt ( ) == 0 ? 0 : 1 ) ;
}
| public static void main ( String [ ] args ) { System . out . println ( scanner . nextInt ( ) % scanner . nextInt ( ) == 0 ? 0 : 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 (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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) right: (decimal_integer_literal)) consequence: (decimal_integer_literal) alternative: (decimal_integer_literal))))))) |
public static void main ( String [ ] args ) {
Scanner input = new Scanner ( System . in ) ;
int a = 0 ;
int b = 0 ;
for ( int i = 0 ;
i < 3 ;
i ++ ) {
int value = input . nextInt ( ) ;
if ( value == 5 ) a ++ ;
else if ( value == 7 ) b ++ ;
}
if ( a == 2 && b == 1 ) System . out . println ( "YES" ) ;
else System . out . println ( "NO" ) ;
}
| public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int a = 0 ; int b = 0 ; for ( int i = 0 ; i < 3 ; i ++ ) { int value = input . nextInt ( ) ; if ( value == 5 ) a ++ ; else if ( value == 7 ) b ++ ; } if ( a == 2 && b == 1 ) 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: (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: (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: (identifier) right: (decimal_integer_literal))) consequence: (expression_statement (update_expression (identifier))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (expression_statement (update_expression (identifier))))))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (binary_expression left: (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 ) {
InputStream inputStream = System . in ;
OutputStream outputStream = System . out ;
InputReader in = new InputReader ( inputStream ) ;
PrintWriter out = new PrintWriter ( outputStream ) ;
IrohaAndHaikuABCEdition solver = new IrohaAndHaikuABCEdition ( ) ;
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 ) ; IrohaAndHaikuABCEdition solver = new IrohaAndHaikuABCEdition ( ) ; 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 ) ;
Map < Integer , Integer > seen = new HashMap < > ( ) ;
for ( int ix = 0 ;
ix < 3 ;
ix ++ ) {
int value = scanner . nextInt ( ) ;
seen . put ( value , seen . getOrDefault ( value , 0 ) + 1 ) ;
}
boolean result = seen . containsKey ( 5 ) && seen . containsKey ( 7 ) && seen . get ( 5 ) == 2 && seen . get ( 7 ) == 1 ;
System . out . println ( result ? "YES" : "NO" ) ;
}
| public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; Map < Integer , Integer > seen = new HashMap < > ( ) ; for ( int ix = 0 ; ix < 3 ; ix ++ ) { int value = scanner . nextInt ( ) ; seen . put ( value , seen . getOrDefault ( value , 0 ) + 1 ) ; } boolean result = seen . containsKey ( 5 ) && seen . containsKey ( 7 ) && seen . get ( 5 ) == 2 && seen . get ( 7 ) == 1 ; System . out . println ( result ? " 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: (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: (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 (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (decimal_integer_literal))) right: (decimal_integer_literal))))))) (local_variable_declaration type: (boolean_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (binary_expression left: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal))) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal)))) right: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal))) right: (decimal_integer_literal))) right: (binary_expression left: (method_invocation object: (identifier) 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 (ternary_expression condition: (identifier) consequence: (string_literal) alternative: (string_literal))))))) |
public static void main ( String [ ] args ) {
Scanner keyboard = new Scanner ( System . in ) ;
int SideA = keyboard . nextInt ( ) ;
int SideB = keyboard . nextInt ( ) ;
int SideC = keyboard . nextInt ( ) ;
int [ ] arr = new int [ ] {
SideA , SideB , SideC };
Arrays . sort ( arr ) ;
if ( arr [ 0 ] == 5 && arr [ 1 ] == 5 && arr [ 2 ] == 7 ) {
System . out . println ( "YES" ) ;
}
else {
System . out . println ( "NO" ) ;
}
keyboard . close ( ) ;
}
| public static void main ( String [ ] args ) { Scanner keyboard = new Scanner ( System . in ) ; int SideA = keyboard . nextInt ( ) ; int SideB = keyboard . nextInt ( ) ; int SideC = keyboard . nextInt ( ) ; int [ ] arr = new int [ ] { SideA , SideB , SideC } ; Arrays . sort ( arr ) ; if ( arr [ 0 ] == 5 && arr [ 1 ] == 5 && arr [ 2 ] == 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } keyboard . 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: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions) value: (array_initializer (identifier) (identifier) (identifier))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (binary_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (decimal_integer_literal)) right: (binary_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (decimal_integer_literal))) right: (binary_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) 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)))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))))) |
public static void main ( String args [ ] ) {
Scanner sc = new Scanner ( System . in ) ;
int [ ] input = new int [ 3 ] ;
int fiveCount = 0 ;
int sevenCount = 0 ;
for ( int i = 0 ;
i < 3 ;
i ++ ) {
input [ i ] = sc . nextInt ( ) ;
if ( input [ i ] == 5 && fiveCount < 2 ) {
fiveCount ++ ;
}
else if ( input [ i ] == 7 && sevenCount < 1 ) {
sevenCount ++ ;
}
else {
System . out . println ( "NO" ) ;
return ;
}
}
System . out . println ( "YES" ) ;
}
| public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int [ ] input = new int [ 3 ] ; int fiveCount = 0 ; int sevenCount = 0 ; for ( int i = 0 ; i < 3 ; i ++ ) { input [ i ] = sc . nextInt ( ) ; if ( input [ i ] == 5 && fiveCount < 2 ) { fiveCount ++ ; } else if ( input [ i ] == 7 && sevenCount < 1 ) { sevenCount ++ ; } else { System . out . println ( " NO " ) ; return ; } } System . out . println ( " YES " ) ; } | (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: (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: (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: (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: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal)) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) consequence: (block (expression_statement (update_expression (identifier)))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal)) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) consequence: (block (expression_statement (update_expression (identifier)))) alternative: (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 ) {
Scanner sc = new Scanner ( System . in ) ;
String po = sc . nextLine ( ) ;
String popo = sc . nextLine ( ) ;
for ( int i = 0 ;
i < popo . length ( ) ;
i ++ ) {
System . out . print ( po . substring ( i , i + 1 ) + popo . substring ( i , i + 1 ) ) ;
}
System . out . println ( ( po . length ( ) == popo . length ( ) ) ? "" : po . substring ( po . length ( ) - 1 , po . length ( ) ) ) ;
}
| public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String po = sc . nextLine ( ) ; String popo = sc . nextLine ( ) ; for ( int i = 0 ; i < popo . length ( ) ; i ++ ) { System . out . print ( po . substring ( i , i + 1 ) + popo . substring ( i , i + 1 ) ) ; } System . out . println ( ( po . length ( ) == popo . length ( ) ) ? " " : po . substring ( po . length ( ) - 1 , po . length ( ) ) ) ; } | (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)))) (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: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (binary_expression left: (identifier) right: (decimal_integer_literal)))) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (binary_expression left: (identifier) right: (decimal_integer_literal)))))))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (ternary_expression condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) consequence: (string_literal) alternative: (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)) (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))))))) |
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 {
BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ;
String o = input . readLine ( ) ;
String e = input . readLine ( ) ;
StringBuilder out = new StringBuilder ( ) ;
for ( int i = 0 ;
i < Math . max ( o . length ( ) , e . length ( ) ) ;
i ++ ) {
if ( i < o . length ( ) ) out . append ( o . charAt ( i ) ) ;
if ( i < e . length ( ) ) out . append ( e . charAt ( i ) ) ;
}
System . out . println ( out ) ;
}
| public static void main ( String [ ] args ) throws Exception { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String o = input . readLine ( ) ; String e = input . readLine ( ) ; StringBuilder out = new StringBuilder ( ) ; for ( int i = 0 ; i < Math . max ( o . length ( ) , e . length ( ) ) ; i ++ ) { if ( i < o . length ( ) ) out . append ( o . charAt ( i ) ) ; if ( i < e . length ( ) ) out . append ( e . charAt ( i ) ) ; } System . out . println ( out ) ; } | (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: (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: (type_identifier) declarator: (variable_declarator name: (identifier) value: (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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))))) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) consequence: (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (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: (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 (identifier)))))) |
public static void main ( String [ ] args ) throws Exception {
Scanner sc = new Scanner ( System . in ) ;
String O = sc . next ( ) ;
String E = sc . next ( ) ;
int Olen = O . length ( ) ;
int Elen = E . length ( ) ;
for ( int i = 0 ;
i < Elen ;
i ++ ) {
System . out . print ( O . charAt ( i ) ) ;
System . out . print ( E . charAt ( i ) ) ;
}
if ( Olen > Elen ) System . out . print ( O . charAt ( Olen - 1 ) ) ;
}
| public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String O = sc . next ( ) ; String E = sc . next ( ) ; int Olen = O . length ( ) ; int Elen = E . length ( ) ; for ( int i = 0 ; i < Elen ; i ++ ) { System . out . print ( O . charAt ( i ) ) ; System . out . print ( E . charAt ( i ) ) ; } if ( Olen > Elen ) System . out . print ( O . charAt ( Olen - 1 ) ) ; } | (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)))) (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 (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 (identifier)))))) (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 (identifier)))))))) (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 (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)))))))))) |
public static void main ( String [ ] args ) {
String a = sc . next ( ) , b = sc . next ( ) ;
StringBuilder sb = new StringBuilder ( ) ;
for ( int i = 0 ;
i < a . length ( ) ;
i ++ ) {
sb . append ( a . charAt ( i ) ) ;
if ( b . length ( ) > i ) {
sb . append ( b . charAt ( i ) ) ;
}
}
System . out . println ( sb ) ;
}
| public static void main ( String [ ] args ) { String a = sc . next ( ) , b = sc . next ( ) ; StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < a . length ( ) ; i ++ ) { sb . append ( a . charAt ( i ) ) ; if ( b . length ( ) > i ) { sb . append ( b . charAt ( i ) ) ; } } System . out . println ( sb ) ; } | (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 object: (identifier) name: (identifier) arguments: (argument_list))) 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: (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: (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)))))) (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (identifier))) consequence: (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 (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 ( ) ;
int d = sc . nextInt ( ) ;
if ( a + b > c + d ) {
System . out . println ( "Left" ) ;
}
else if ( a + b < c + d ) {
System . out . println ( "Right" ) ;
}
else {
System . out . println ( "Balanced" ) ;
}
}
| 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 d = sc . nextInt ( ) ; if ( a + b > c + d ) { System . out . println ( " Left " ) ; } else if ( a + b < c + d ) { System . out . println ( " Right " ) ; } else { System . out . println ( " Balanced " ) ; } } | (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)))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (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: (binary_expression left: (identifier) right: (identifier)) right: (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 ) {
PrintWriter out = new PrintWriter ( System . out ) ;
InputStreamScanner in = new InputStreamScanner ( System . in ) ;
new Main ( ) . solve ( in , out ) ;
out . flush ( ) ;
}
| public static void main ( String [ ] args ) { PrintWriter out = new PrintWriter ( System . out ) ; InputStreamScanner in = new InputStreamScanner ( System . in ) ; new Main ( ) . solve ( in , out ) ; 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 (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)))))) (expression_statement (method_invocation object: (object_creation_expression type: (type_identifier) arguments: (argument_list)) name: (identifier) arguments: (argument_list (identifier) (identifier)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))))) |
public static void main ( String [ ] args ) {
Scanner sc = new Scanner ( System . in ) ;
int a , b , c , d ;
a = Integer . parseInt ( sc . next ( ) ) ;
b = Integer . parseInt ( sc . next ( ) ) ;
c = Integer . parseInt ( sc . next ( ) ) ;
d = Integer . parseInt ( sc . next ( ) ) ;
int left = a + b ;
int right = c + d ;
if ( left > right ) {
System . out . println ( "Left" ) ;
}
else if ( left < right ) {
System . out . println ( "Right" ) ;
}
else {
System . out . println ( "Balanced" ) ;
}
sc . close ( ) ;
}
| public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a , b , c , d ; a = Integer . parseInt ( sc . next ( ) ) ; b = Integer . parseInt ( sc . next ( ) ) ; c = Integer . parseInt ( sc . next ( ) ) ; d = Integer . parseInt ( sc . next ( ) ) ; int left = a + b ; int right = c + d ; if ( left > right ) { System . out . println ( " Left " ) ; } else if ( left < right ) { System . out . println ( " Right " ) ; } else { System . out . println ( " Balanced " ) ; } 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)) declarator: (variable_declarator name: (identifier)) declarator: (variable_declarator name: (identifier)) declarator: (variable_declarator name: (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)))))) (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)))))) (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)))))) (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)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (identifier)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (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))))) 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))))))) (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 A = sc . nextInt ( ) ;
int B = sc . nextInt ( ) ;
int C = sc . nextInt ( ) ;
int D = sc . nextInt ( ) ;
int L = A + B ;
int R = C + D ;
if ( L > R ) {
System . out . println ( "Left" ) ;
}
else if ( L == R ) {
System . out . println ( "Balanced" ) ;
}
else {
System . out . println ( "Right" ) ;
}
}
| public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int D = sc . nextInt ( ) ; int L = A + B ; int R = C + D ; if ( L > R ) { System . out . println ( " Left " ) ; } else if ( L == R ) { System . out . println ( " Balanced " ) ; } else { System . out . println ( " Right " ) ; } } | (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: (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)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (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))))) 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 ) {
Scanner sc = new Scanner ( System . in ) ;
int a = sc . nextInt ( ) ;
int b = sc . nextInt ( ) ;
int c = sc . nextInt ( ) ;
int d = sc . nextInt ( ) ;
String ans = ( a + b > c + d ) ? "Left" : ( a + b == c + d ) ? "Balanced" : "Right" ;
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 ( ) ; int d = sc . nextInt ( ) ; String ans = ( a + b > c + d ) ? " Left " : ( a + b == c + d ) ? " Balanced " : " Right " ; 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)))) (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: (ternary_expression condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (binary_expression left: (identifier) right: (identifier)))) consequence: (string_literal) alternative: (ternary_expression condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (binary_expression left: (identifier) right: (identifier)))) consequence: (string_literal) alternative: (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 ) throws Exception {
BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ;
int N = Integer . parseInt ( br . readLine ( ) ) ;
boolean [ ] rainTimes = new boolean [ 24 * 12 + 1 ] ;
for ( int i = 0 ;
i < N ;
i ++ ) {
String [ ] rainTime = br . readLine ( ) . split ( "-" ) ;
int rainFrom = Integer . parseInt ( rainTime [ 0 ] ) ;
int rainTo = Integer . parseInt ( rainTime [ 1 ] ) ;
for ( int j = rainFrom / 100 * 12 + ( rainFrom % 100 ) / 5 ;
j < rainTo / 100 * 12 + ( rainTo % 100 + 4 ) / 5 ;
j ++ ) {
rainTimes [ j ] = true ;
}
}
for ( int i = 0 ;
i < 24 * 12 ;
i ++ ) {
if ( ! rainTimes [ i ] ) continue ;
System . out . print ( String . format ( "%02d%02d-" , i / 12 , i % 12 * 5 ) ) ;
while ( i < 24 * 12 && rainTimes [ i ] && rainTimes [ i + 1 ] ) i ++ ;
i ++ ;
System . out . println ( String . format ( "%02d%02d" , i / 12 , i % 12 * 5 ) ) ;
}
}
| public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int N = Integer . parseInt ( br . readLine ( ) ) ; boolean [ ] rainTimes = new boolean [ 24 * 12 + 1 ] ; for ( int i = 0 ; i < N ; i ++ ) { String [ ] rainTime = br . readLine ( ) . split ( " - " ) ; int rainFrom = Integer . parseInt ( rainTime [ 0 ] ) ; int rainTo = Integer . parseInt ( rainTime [ 1 ] ) ; for ( int j = rainFrom / 100 * 12 + ( rainFrom % 100 ) / 5 ; j < rainTo / 100 * 12 + ( rainTo % 100 + 4 ) / 5 ; j ++ ) { rainTimes [ j ] = true ; } } for ( int i = 0 ; i < 24 * 12 ; i ++ ) { if ( ! rainTimes [ i ] ) continue ; System . out . print ( String . format ( " % 02d % 02d - " , i / 12 , i % 12 * 5 ) ) ; while ( i < 24 * 12 && rainTimes [ i ] && rainTimes [ i + 1 ] ) i ++ ; i ++ ; System . out . println ( String . format ( " % 02d % 02d " , i / 12 , i % 12 * 5 ) ) ; } } | (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: (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: (boolean_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (boolean_type) dimensions: (dimensions_expr (binary_expression left: (binary_expression left: (decimal_integer_literal) right: (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 (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: (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal)) right: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (decimal_integer_literal))))) condition: (binary_expression left: (identifier) right: (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal)) right: (binary_expression left: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal))) right: (decimal_integer_literal)))) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (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: (binary_expression left: (decimal_integer_literal) right: (decimal_integer_literal))) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (unary_expression operand: (array_access array: (identifier) index: (identifier)))) consequence: (continue_statement)) (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 (string_literal) (binary_expression left: (identifier) right: (decimal_integer_literal)) (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal))))))) (while_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (binary_expression left: (decimal_integer_literal) right: (decimal_integer_literal))) right: (array_access array: (identifier) index: (identifier))) right: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))))) body: (expression_statement (update_expression (identifier)))) (expression_statement (update_expression (identifier))) (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 (string_literal) (binary_expression left: (identifier) right: (decimal_integer_literal)) (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal))))))))))) |
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 ) {
int timeData = 0 ;
int [ ] [ ] times = new int [ 289 ] [ 2 ] ;
for ( int i = 0 ;
i < 289 ;
i ++ ) {
times [ i ] [ 0 ] = timeData ;
timeData += 5 ;
if ( i != 0 && ( times [ i ] [ 0 ] % 100 ) == 55 ) timeData = ( timeData / 100 + 1 ) * 100 ;
}
Scanner sc = new Scanner ( System . in ) ;
int inputCount = sc . nextInt ( ) ;
for ( int i = 0 ;
i < inputCount ;
i ++ ) {
String [ ] lainTime = sc . next ( ) . split ( "-" ) ;
int from = Integer . valueOf ( lainTime [ 0 ] ) ;
int to = Integer . valueOf ( lainTime [ 1 ] ) ;
from = from - from % 5 ;
for ( int j = 0 ;
j < 289 ;
j ++ ) {
if ( times [ j ] [ 0 ] >= from && times [ j ] [ 0 ] < to ) times [ j ] [ 1 ] = 1 ;
}
}
ArrayList < String > resultList = new ArrayList < > ( ) ;
String result = "" ;
boolean isContinue = false ;
for ( int i = 0 ;
i < times . length ;
i ++ ) {
if ( isContinue ) {
if ( times [ i ] [ 1 ] == 0 ) {
isContinue = false ;
String intResult = "0000" + times [ i ] [ 0 ] ;
result += "-" + intResult . substring ( intResult . length ( ) - 4 ) ;
resultList . add ( result ) ;
result = "" ;
}
}
else {
if ( times [ i ] [ 1 ] == 1 ) {
isContinue = true ;
result = "0000" + ( times [ i ] [ 0 ] ) ;
result = result . substring ( result . length ( ) - 4 ) ;
}
}
if ( isContinue && i == 288 ) {
result += "-2400" ;
resultList . add ( result ) ;
}
}
for ( String output : resultList ) {
System . out . println ( output ) ;
}
}
| public static void main ( String [ ] args ) { int timeData = 0 ; int [ ] [ ] times = new int [ 289 ] [ 2 ] ; for ( int i = 0 ; i < 289 ; i ++ ) { times [ i ] [ 0 ] = timeData ; timeData += 5 ; if ( i != 0 && ( times [ i ] [ 0 ] % 100 ) == 55 ) timeData = ( timeData / 100 + 1 ) * 100 ; } Scanner sc = new Scanner ( System . in ) ; int inputCount = sc . nextInt ( ) ; for ( int i = 0 ; i < inputCount ; i ++ ) { String [ ] lainTime = sc . next ( ) . split ( " - " ) ; int from = Integer . valueOf ( lainTime [ 0 ] ) ; int to = Integer . valueOf ( lainTime [ 1 ] ) ; from = from - from % 5 ; for ( int j = 0 ; j < 289 ; j ++ ) { if ( times [ j ] [ 0 ] >= from && times [ j ] [ 0 ] < to ) times [ j ] [ 1 ] = 1 ; } } ArrayList < String > resultList = new ArrayList < > ( ) ; String result = " " ; boolean isContinue = false ; for ( int i = 0 ; i < times . length ; i ++ ) { if ( isContinue ) { if ( times [ i ] [ 1 ] == 0 ) { isContinue = false ; String intResult = "0000" + times [ i ] [ 0 ] ; result += " - " + intResult . substring ( intResult . length ( ) - 4 ) ; resultList . add ( result ) ; result = " " ; } } else { if ( times [ i ] [ 1 ] == 1 ) { isContinue = true ; result = "0000" + ( times [ i ] [ 0 ] ) ; result = result . substring ( result . length ( ) - 4 ) ; } } if ( isContinue && i == 288 ) { result += " - 2400" ; resultList . add ( result ) ; } } for ( String output : resultList ) { System . out . println ( output ) ; } } | (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: (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)) 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: (array_access array: (identifier) index: (identifier)) index: (decimal_integer_literal)) right: (identifier))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (binary_expression left: (parenthesized_expression (binary_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (decimal_integer_literal)) right: (decimal_integer_literal))) right: (decimal_integer_literal)))) consequence: (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal))) 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)))))) (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 (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)))))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) 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: (decimal_integer_literal)) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (decimal_integer_literal)) right: (identifier)) right: (binary_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (decimal_integer_literal)) right: (identifier)))) consequence: (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (decimal_integer_literal)) right: (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)))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (string_literal))) (local_variable_declaration type: (boolean_type) declarator: (variable_declarator name: (identifier) value: (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: (field_access object: (identifier) field: (identifier))) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (identifier)) consequence: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (decimal_integer_literal)) right: (decimal_integer_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (false))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (string_literal) right: (array_access array: (array_access array: (identifier) index: (identifier)) index: (decimal_integer_literal))))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (string_literal) right: (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: (identifier) name: (identifier) arguments: (argument_list (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (string_literal)))))) alternative: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (decimal_integer_literal)) right: (decimal_integer_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (true))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (string_literal) right: (parenthesized_expression (array_access array: (array_access array: (identifier) index: (identifier)) index: (decimal_integer_literal)))))) (expression_statement (assignment_expression left: (identifier) right: (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)))))))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (string_literal))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))))))) (enhanced_for_statement type: (type_identifier) name: (identifier) value: (identifier) body: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier)))))))) |
static public void main ( String [ ] args ) {
Scanner scan = new Scanner ( System . in ) ;
int size = scan . nextInt ( ) ;
List < String > list = new ArrayList < > ( size ) ;
for ( int i = 0 ;
i < size ;
i ++ ) {
list . add ( scan . next ( ) ) ;
}
list . sort ( naturalOrder ( ) ) ;
int start = 9999 ;
int end = - 1 ;
for ( String data : list ) {
String [ ] record = data . split ( "-" ) ;
int rainStart = Integer . parseInt ( record [ 0 ] ) ;
int rainEnd = Integer . parseInt ( record [ 1 ] ) ;
rainStart -= rainStart % 5 ;
if ( rainEnd % 5 > 0 ) {
rainEnd += 5 - rainEnd % 5 ;
}
if ( rainEnd % 100 == 60 ) {
rainEnd += 40 ;
}
if ( rainStart > end ) {
if ( start != 9999 ) {
System . out . println ( String . format ( "%04d" , start ) + "-" + String . format ( "%04d" , end ) ) ;
}
start = rainStart ;
end = - 1 ;
}
if ( end < rainEnd ) {
end = rainEnd ;
}
}
System . out . println ( String . format ( "%04d" , start ) + "-" + String . format ( "%04d" , end ) ) ;
scan . close ( ) ;
}
| static public void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int size = scan . nextInt ( ) ; List < String > list = new ArrayList < > ( size ) ; for ( int i = 0 ; i < size ; i ++ ) { list . add ( scan . next ( ) ) ; } list . sort ( naturalOrder ( ) ) ; int start = 9999 ; int end = - 1 ; for ( String data : list ) { String [ ] record = data . split ( " - " ) ; int rainStart = Integer . parseInt ( record [ 0 ] ) ; int rainEnd = Integer . parseInt ( record [ 1 ] ) ; rainStart -= rainStart % 5 ; if ( rainEnd % 5 > 0 ) { rainEnd += 5 - rainEnd % 5 ; } if ( rainEnd % 100 == 60 ) { rainEnd += 40 ; } if ( rainStart > end ) { if ( start != 9999 ) { System . out . println ( String . format ( " % 04d " , start ) + " - " + String . format ( " % 04d " , end ) ) ; } start = rainStart ; end = - 1 ; } if ( end < rainEnd ) { end = rainEnd ; } } System . out . println ( String . format ( " % 04d " , start ) + " - " + String . format ( " % 04d " , end ) ) ; scan . 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: (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 (identifier))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation name: (identifier) arguments: (argument_list))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (unary_expression operand: (decimal_integer_literal)))) (enhanced_for_statement type: (type_identifier) name: (identifier) value: (identifier) body: (block (local_variable_declaration type: (array_type element: (type_identifier) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) 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)))))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) (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: (decimal_integer_literal) right: (binary_expression left: (identifier) right: (decimal_integer_literal))))))) (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: (decimal_integer_literal))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (string_literal) (identifier))) right: (string_literal)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (string_literal) (identifier))))))))) (expression_statement (assignment_expression left: (identifier) right: (identifier))) (expression_statement (assignment_expression left: (identifier) right: (unary_expression operand: (decimal_integer_literal)))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (identifier))))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (string_literal) (identifier))) right: (string_literal)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (string_literal) (identifier))))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))))) |
public static void main ( String [ ] args ) {
Scanner sc = new Scanner ( System . in ) ;
int n = sc . nextInt ( ) ;
int plot [ ] = new int [ 1000 ] ;
for ( int i = 0 ;
i < plot . length ;
i ++ ) {
plot [ i ] = 0 ;
}
for ( int i = 0 ;
i < n ;
i ++ ) {
String baseTime = sc . next ( ) ;
String times [ ] = baseTime . split ( "-" ) ;
int startTime = Integer . parseInt ( times [ 0 ] ) ;
int endTime = Integer . parseInt ( times [ 1 ] ) ;
int start = startTime - ( startTime % 5 ) ;
int end = endTime + ( 5 - ( endTime % 5 ) == 5 ? 0 : 5 - ( endTime % 5 ) ) ;
if ( end % 100 > 59 ) {
end += 100 - 60 + ( end % 100 - 60 ) ;
}
int startIndex = start / 5 ;
int endIndex = end / 5 ;
for ( int j = startIndex ;
j < endIndex ;
j ++ ) {
plot [ j ] = 1 ;
}
}
boolean startFlag = false ;
for ( int i = 0 ;
i < plot . length ;
i ++ ) {
if ( ! startFlag ) {
if ( plot [ i ] == 1 ) {
System . out . print ( String . format ( "%04d" , ( i * 5 ) ) + "-" ) ;
startFlag = true ;
}
}
else {
if ( plot [ i ] == 0 ) {
System . out . println ( String . format ( "%04d" , ( i * 5 ) ) ) ;
startFlag = false ;
}
}
}
}
| public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int plot [ ] = new int [ 1000 ] ; for ( int i = 0 ; i < plot . length ; i ++ ) { plot [ i ] = 0 ; } for ( int i = 0 ; i < n ; i ++ ) { String baseTime = sc . next ( ) ; String times [ ] = baseTime . split ( " - " ) ; int startTime = Integer . parseInt ( times [ 0 ] ) ; int endTime = Integer . parseInt ( times [ 1 ] ) ; int start = startTime - ( startTime % 5 ) ; int end = endTime + ( 5 - ( endTime % 5 ) == 5 ? 0 : 5 - ( endTime % 5 ) ) ; if ( end % 100 > 59 ) { end += 100 - 60 + ( end % 100 - 60 ) ; } int startIndex = start / 5 ; int endIndex = end / 5 ; for ( int j = startIndex ; j < endIndex ; j ++ ) { plot [ j ] = 1 ; } } boolean startFlag = false ; for ( int i = 0 ; i < plot . length ; i ++ ) { if ( ! startFlag ) { if ( plot [ i ] == 1 ) { System . out . print ( String . format ( " % 04d " , ( i * 5 ) ) + " - " ) ; startFlag = true ; } } else { if ( plot [ i ] == 0 ) { System . out . println ( String . format ( " % 04d " , ( i * 5 ) ) ) ; startFlag = false ; } } } } | (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) dimensions: (dimensions) 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: (field_access object: (identifier) field: (identifier))) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (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: (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) dimensions: (dimensions) value: (method_invocation object: (identifier) 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)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (parenthesized_expression (ternary_expression condition: (binary_expression left: (binary_expression left: (decimal_integer_literal) right: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal)))) right: (decimal_integer_literal)) consequence: (decimal_integer_literal) alternative: (binary_expression left: (decimal_integer_literal) right: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))))))))) (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: (decimal_integer_literal) right: (decimal_integer_literal)) right: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal)))))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (decimal_integer_literal)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (decimal_integer_literal)))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (identifier))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal))))))) (local_variable_declaration type: (boolean_type) declarator: (variable_declarator name: (identifier) value: (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: (field_access object: (identifier) field: (identifier))) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (unary_expression operand: (identifier))) consequence: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal))) consequence: (block (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 (string_literal) (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))))) right: (string_literal))))) (expression_statement (assignment_expression left: (identifier) right: (true)))))) alternative: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal))) consequence: (block (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 (string_literal) (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal)))))))) (expression_statement (assignment_expression left: (identifier) right: (false))))))))))) |
public static void main ( String [ ] args ) {
Scanner sc = new Scanner ( System . in ) ;
int a = sc . nextInt ( ) ;
int b = sc . nextInt ( ) ;
int n = sc . nextInt ( ) ;
System . out . println ( ( a + b == n ) ? ( a - b == n ) ? "?" : "+" : ( a - b == n ) ? "-" : "!" ) ;
}
| public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; System . out . println ( ( a + b == n ) ? ( a - b == n ) ? " ? " : " + " : ( a - b == 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: (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: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (identifier))) consequence: (ternary_expression condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (identifier))) consequence: (string_literal) alternative: (string_literal)) alternative: (ternary_expression condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (identifier))) consequence: (string_literal) alternative: (string_literal)))))))) |