code
stringlengths
31
2.27k
tokenized_code
stringlengths
30
1.69k
sexp
stringlengths
115
9.43k
public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = sc . nextInt ( ) ; long ans = help ( a ) ; System . out . println ( ans ) ; }
public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = sc . nextInt ( ) ; long ans = help ( a ) ; System . out . println ( ans ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) (throws (type_identifier)) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (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: (method_invocation name: (identifier) arguments: (argument_list (identifier))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier))))))
static long help ( int [ ] a ) { if ( a [ 0 ] != 0 ) return 0 ; int maxDist = 0 ; for ( int w : a ) maxDist = Math . max ( maxDist , w ) ; int [ ] rec = new int [ maxDist + 1 ] ; for ( int w : a ) rec [ w ] ++ ; if ( rec [ 0 ] != 1 ) return 0 ; for ( int i = 1 ; i <= maxDist ; i ++ ) { if ( rec [ i ] < 1 ) return 0 ; } long [ ] dp = new long [ maxDist + 1 ] ; dp [ 0 ] = 1 ; for ( int i = 1 ; i <= maxDist ; i ++ ) { long base = power ( 2 , rec [ i - 1 ] ) - 1 ; dp [ i ] = power ( base , rec [ i ] ) * dp [ i - 1 ] % mod ; long sameLayer = ( ( long ) rec [ i ] ) * ( ( long ) rec [ i ] - 1 ) / 2 ; dp [ i ] = dp [ i ] * power ( 2 , sameLayer ) % mod ; } return dp [ maxDist ] ; }
static long help ( int [ ] a ) { if ( a [ 0 ] != 0 ) return 0 ; int maxDist = 0 ; for ( int w : a ) maxDist = Math . max ( maxDist , w ) ; int [ ] rec = new int [ maxDist + 1 ] ; for ( int w : a ) rec [ w ] ++ ; if ( rec [ 0 ] != 1 ) return 0 ; for ( int i = 1 ; i <= maxDist ; i ++ ) { if ( rec [ i ] < 1 ) return 0 ; } long [ ] dp = new long [ maxDist + 1 ] ; dp [ 0 ] = 1 ; for ( int i = 1 ; i <= maxDist ; i ++ ) { long base = power ( 2 , rec [ i - 1 ] ) - 1 ; dp [ i ] = power ( base , rec [ i ] ) * dp [ i - 1 ] % mod ; long sameLayer = ( ( long ) rec [ i ] ) * ( ( long ) rec [ i ] - 1 ) / 2 ; dp [ i ] = dp [ i ] * power ( 2 , sameLayer ) % mod ; } return dp [ maxDist ] ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (integral_type) dimensions: (dimensions)) name: (identifier))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) 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))) (enhanced_for_statement type: (integral_type) name: (identifier) value: (identifier) body: (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (identifier)))))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (binary_expression left: (identifier) right: (decimal_integer_literal)))))) (enhanced_for_statement type: (integral_type) name: (identifier) value: (identifier) body: (expression_statement (update_expression (array_access array: (identifier) index: (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (decimal_integer_literal))) consequence: (return_statement (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: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal))) consequence: (return_statement (decimal_integer_literal))))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (binary_expression left: (identifier) right: (decimal_integer_literal)))))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (decimal_integer_literal))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (method_invocation name: (identifier) arguments: (argument_list (decimal_integer_literal) (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))))) right: (decimal_integer_literal)))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (binary_expression left: (binary_expression left: (method_invocation name: (identifier) arguments: (argument_list (identifier) (array_access array: (identifier) index: (identifier)))) right: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal)))) right: (identifier)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (binary_expression left: (parenthesized_expression (cast_expression type: (integral_type) value: (array_access array: (identifier) index: (identifier)))) right: (parenthesized_expression (binary_expression left: (cast_expression type: (integral_type) value: (array_access array: (identifier) index: (identifier))) right: (decimal_integer_literal)))) right: (decimal_integer_literal)))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (binary_expression left: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (method_invocation name: (identifier) arguments: (argument_list (decimal_integer_literal) (identifier)))) right: (identifier)))))) (return_statement (array_access array: (identifier) index: (identifier)))))
static long power ( long base , long p ) { long ans = 1 ; while ( p > 0 ) { if ( p % 2 == 1 ) ans = ans * base % mod ; base = base * base % mod ; p /= 2 ; } return ans ; }
static long power ( long base , long p ) { long ans = 1 ; while ( p > 0 ) { if ( p % 2 == 1 ) ans = ans * base % mod ; base = base * base % mod ; p /= 2 ; } return ans ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (while_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal))) consequence: (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))))) (return_statement (identifier))))
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; int [ ] d = new int [ n ] ; int dmax = 0 ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; d [ a [ i ] ] ++ ; dmax = Math . max ( a [ i ] , dmax ) ; } if ( a [ 0 ] != 0 || d [ 0 ] != 1 ) { System . out . println ( 0 ) ; return ; } for ( int i = 0 ; i <= dmax ; i ++ ) { if ( d [ i ] == 0 ) { System . out . println ( 0 ) ; return ; } } long ans = 1L ; for ( int i = 1 ; i <= dmax ; i ++ ) { long tmp = pow ( 2 , d [ i - 1 ] ) ; tmp = ( tmp + MOD - 1 ) % MOD ; ans = ( ans * pow ( tmp , d [ i ] ) ) % MOD ; ans = ( ans * pow ( 2 , ( long ) ( d [ i ] - 1 ) * d [ i ] / 2 ) ) % MOD ; } System . out . println ( ans ) ; }
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; int [ ] d = new int [ n ] ; int dmax = 0 ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; d [ a [ i ] ] ++ ; dmax = Math . max ( a [ i ] , dmax ) ; } if ( a [ 0 ] != 0 || d [ 0 ] != 1 ) { System . out . println ( 0 ) ; return ; } for ( int i = 0 ; i <= dmax ; i ++ ) { if ( d [ i ] == 0 ) { System . out . println ( 0 ) ; return ; } } long ans = 1L ; for ( int i = 1 ; i <= dmax ; i ++ ) { long tmp = pow ( 2 , d [ i - 1 ] ) ; tmp = ( tmp + MOD - 1 ) % MOD ; ans = ( ans * pow ( tmp , d [ i ] ) ) % MOD ; ans = ( ans * pow ( 2 , ( long ) ( d [ i ] - 1 ) * d [ i ] / 2 ) ) % MOD ; } 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: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (identifier))))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (identifier))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (expression_statement (update_expression (array_access array: (identifier) index: (array_access array: (identifier) index: (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (identifier)) (identifier))))))) (if_statement condition: (parenthesized_expression (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)))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (decimal_integer_literal)))) (return_statement))) (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: (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 (decimal_integer_literal)))) (return_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: (identifier)) update: (update_expression (identifier)) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation name: (identifier) arguments: (argument_list (decimal_integer_literal) (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))))))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal))) right: (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (method_invocation name: (identifier) arguments: (argument_list (identifier) (array_access array: (identifier) index: (identifier)))))) right: (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (method_invocation name: (identifier) arguments: (argument_list (decimal_integer_literal) (binary_expression left: (binary_expression left: (cast_expression type: (integral_type) value: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal)))) right: (array_access array: (identifier) index: (identifier))) right: (decimal_integer_literal)))))) right: (identifier)))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier))))))
public static long pow ( long a , long n ) { long x = 1 ; while ( n > 0 ) { if ( n % 2 == 1 ) { x = x * a % MOD ; } a = a * a % MOD ; n >>= 1 ; } return x ; }
public static long pow ( long a , long n ) { long x = 1 ; while ( n > 0 ) { if ( n % 2 == 1 ) { x = x * a % MOD ; } a = a * a % MOD ; n >>= 1 ; } return x ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (while_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) body: (block (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: (identifier) right: (identifier)) right: (identifier)))))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))))) (return_statement (identifier))))
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; UnionFind uf = new UnionFind ( N ) ; for ( int i = 0 ; i < M ; i ++ ) { int a = sc . nextInt ( ) - 1 ; int b = sc . nextInt ( ) - 1 ; uf . union ( a , b ) ; } System . out . println ( uf . count ( N ) - 1 ) ; }
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; UnionFind uf = new UnionFind ( N ) ; for ( int i = 0 ; i < M ; i ++ ) { int a = sc . nextInt ( ) - 1 ; int b = sc . nextInt ( ) - 1 ; uf . union ( a , b ) ; } System . out . println ( uf . count ( N ) - 1 ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (identifier))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (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) (identifier)))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (decimal_integer_literal)))))))
public static void main ( String [ ] args ) { for ( int i = 0 ; i < N ; i ++ ) node [ i ] = new Node ( ) ; for ( int i = 0 ; i < M ; i ++ ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; node [ a - 1 ] . to . add ( b - 1 ) ; node [ b - 1 ] . to . add ( a - 1 ) ; } int count = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( node [ i ] . visit ) continue ; node [ i ] . visit = true ; solve ( node [ i ] ) ; count ++ ; } System . out . println ( count - 1 ) ; }
public static void main ( String [ ] args ) { for ( int i = 0 ; i < N ; i ++ ) node [ i ] = new Node ( ) ; for ( int i = 0 ; i < M ; i ++ ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; node [ a - 1 ] . to . add ( b - 1 ) ; node [ b - 1 ] . to . add ( a - 1 ) ; } int count = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( node [ i ] . visit ) continue ; node [ i ] . visit = true ; solve ( node [ i ] ) ; count ++ ; } System . out . println ( count - 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 (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: (object_creation_expression type: (type_identifier) arguments: (argument_list))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (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: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal))))) (expression_statement (method_invocation object: (field_access object: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) field: (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))) (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 (field_access object: (array_access array: (identifier) index: (identifier)) field: (identifier))) consequence: (continue_statement)) (expression_statement (assignment_expression left: (field_access object: (array_access array: (identifier) index: (identifier)) field: (identifier)) right: (true))) (expression_statement (method_invocation name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (identifier))))) (expression_statement (update_expression (identifier))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)))))))
public static void solve ( Node n ) { for ( int i = 0 ; i < n . to . size ( ) ; i ++ ) { int next = n . to . get ( i ) ; if ( node [ next ] . visit ) continue ; node [ next ] . visit = true ; solve ( node [ next ] ) ; } }
public static void solve ( Node n ) { for ( int i = 0 ; i < n . to . size ( ) ; i ++ ) { int next = n . to . get ( i ) ; if ( node [ next ] . visit ) continue ; node [ next ] . visit = true ; solve ( node [ next ] ) ; } }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) name: (identifier))) body: (block (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list))) update: (update_expression (identifier)) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier))))) (if_statement condition: (parenthesized_expression (field_access object: (array_access array: (identifier) index: (identifier)) field: (identifier))) consequence: (continue_statement)) (expression_statement (assignment_expression left: (field_access object: (array_access array: (identifier) index: (identifier)) field: (identifier)) right: (true))) (expression_statement (method_invocation name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (identifier)))))))))
public static void main ( String [ ] args ) { int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; UnionFind uf = new UnionFind ( N ) ; uf . init ( N ) ; for ( int i = 0 ; i < M ; i ++ ) { int a = sc . nextInt ( ) - 1 ; int b = sc . nextInt ( ) - 1 ; uf . unite ( a , b ) ; } for ( int i = 0 ; i < N ; i ++ ) { uf . find ( i ) ; } boolean [ ] used = new boolean [ N ] ; int ans = - 1 ; for ( int i = 0 ; i < N ; i ++ ) { if ( ! used [ uf . parent [ i ] ] ) { used [ uf . parent [ i ] ] = true ; ans ++ ; } } System . out . println ( ans ) ; }
public static void main ( String [ ] args ) { int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; UnionFind uf = new UnionFind ( N ) ; uf . init ( N ) ; for ( int i = 0 ; i < M ; i ++ ) { int a = sc . nextInt ( ) - 1 ; int b = sc . nextInt ( ) - 1 ; uf . unite ( a , b ) ; } for ( int i = 0 ; i < N ; i ++ ) { uf . find ( i ) ; } boolean [ ] used = new boolean [ N ] ; int ans = - 1 ; for ( int i = 0 ; i < N ; i ++ ) { if ( ! used [ uf . parent [ i ] ] ) { used [ uf . parent [ i ] ] = true ; ans ++ ; } } 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: (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: (object_creation_expression type: (type_identifier) arguments: (argument_list (identifier))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (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) (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 (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))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (unary_expression operand: (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 (unary_expression operand: (array_access array: (identifier) index: (array_access array: (field_access object: (identifier) field: (identifier)) index: (identifier))))) consequence: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (array_access array: (field_access object: (identifier) field: (identifier)) index: (identifier))) right: (true))) (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 N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; for ( int i = 0 ; i < N ; i ++ ) node [ i ] = new Node ( ) ; for ( int i = 0 ; i < M ; i ++ ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; node [ a - 1 ] . to . add ( b - 1 ) ; node [ b - 1 ] . to . add ( a - 1 ) ; } int count = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( node [ i ] . visit ) continue ; node [ i ] . visit = true ; solve ( node [ i ] ) ; count ++ ; } System . out . println ( count - 1 ) ; }
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; for ( int i = 0 ; i < N ; i ++ ) node [ i ] = new Node ( ) ; for ( int i = 0 ; i < M ; i ++ ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; node [ a - 1 ] . to . add ( b - 1 ) ; node [ b - 1 ] . to . add ( a - 1 ) ; } int count = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( node [ i ] . visit ) continue ; node [ i ] . visit = true ; solve ( node [ i ] ) ; count ++ ; } System . out . println ( count - 1 ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (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: (object_creation_expression type: (type_identifier) arguments: (argument_list))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (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: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal))))) (expression_statement (method_invocation object: (field_access object: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) field: (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))) (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 (field_access object: (array_access array: (identifier) index: (identifier)) field: (identifier))) consequence: (continue_statement)) (expression_statement (assignment_expression left: (field_access object: (array_access array: (identifier) index: (identifier)) field: (identifier)) right: (true))) (expression_statement (method_invocation name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (identifier))))) (expression_statement (update_expression (identifier))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)))))))
public static void solve ( Node n ) { for ( int i = 0 ; i < n . to . size ( ) ; i ++ ) { int next = n . to . get ( i ) ; if ( node [ next ] . visit ) continue ; node [ next ] . visit = true ; solve ( node [ next ] ) ; } }
public static void solve ( Node n ) { for ( int i = 0 ; i < n . to . size ( ) ; i ++ ) { int next = n . to . get ( i ) ; if ( node [ next ] . visit ) continue ; node [ next ] . visit = true ; solve ( node [ next ] ) ; } }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) name: (identifier))) body: (block (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list))) update: (update_expression (identifier)) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier))))) (if_statement condition: (parenthesized_expression (field_access object: (array_access array: (identifier) index: (identifier)) field: (identifier))) consequence: (continue_statement)) (expression_statement (assignment_expression left: (field_access object: (array_access array: (identifier) index: (identifier)) field: (identifier)) right: (true))) (expression_statement (method_invocation name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (identifier)))))))))
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; UnionFindTree uft = new UnionFindTree ( n ) ; for ( int i = 0 ; i < m ; i ++ ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; uft . union ( a - 1 , b - 1 ) ; } System . out . println ( uft . countBlock ( ) - 1 ) ; }
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; UnionFindTree uft = new UnionFindTree ( n ) ; for ( int i = 0 ; i < m ; i ++ ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; uft . union ( a - 1 , b - 1 ) ; } System . out . println ( uft . countBlock ( ) - 1 ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (identifier))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (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 (binary_expression left: (identifier) right: (decimal_integer_literal)) (binary_expression left: (identifier) right: (decimal_integer_literal))))))) (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)) right: (decimal_integer_literal)))))))
public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String n = sc . next ( ) , m = sc . next ( ) ; if ( n . length ( ) > m . length ( ) ) System . out . println ( n ) ; else System . out . println ( m ) ; }
public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String n = sc . next ( ) , m = sc . next ( ) ; if ( n . length ( ) > m . length ( ) ) System . out . println ( n ) ; else System . out . println ( m ) ; }
(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))) 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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) consequence: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier)))) alternative: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier)))))))
public static void main ( String [ ] args ) { 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 isPrintableChar ( int c ) { return c >= 33 && c <= 126 ; }
private static boolean isPrintableChar ( int c ) { return c >= 33 && c <= 126 ; }
(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: (identifier) right: (decimal_integer_literal)) right: (binary_expression left: (identifier) right: (decimal_integer_literal))))))
public static void main ( String [ ] args ) { MyScanner sc = new MyScanner ( ) ; String s = sc . next ( ) ; String s1 = sc . next ( ) ; int a = s . length ( ) ; int b = s1 . length ( ) ; System . out . println ( a > b ? s : s1 ) ; }
public static void main ( String [ ] args ) { MyScanner sc = new MyScanner ( ) ; String s = sc . next ( ) ; String s1 = sc . next ( ) ; int a = s . length ( ) ; int b = s1 . length ( ) ; System . out . println ( a > b ? s : s1 ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list)))) (local_variable_declaration type: (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)))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (ternary_expression condition: (binary_expression left: (identifier) right: (identifier)) consequence: (identifier) alternative: (identifier)))))))
static int l_min ( int [ ] a ) { Arrays . sort ( a ) ; return a [ 0 ] ; }
static int l_min ( int [ ] a ) { Arrays . sort ( a ) ; return a [ 0 ] ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (integral_type) dimensions: (dimensions)) name: (identifier))) body: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) (return_statement (array_access array: (identifier) index: (decimal_integer_literal)))))
static int l_max ( int [ ] a ) { int l = a . length ; Arrays . sort ( a ) ; return a [ l - 1 ] ; }
static int l_max ( int [ ] a ) { int l = a . length ; Arrays . sort ( a ) ; return a [ l - 1 ] ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (integral_type) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (field_access object: (identifier) field: (identifier)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) (return_statement (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))))))
static int nextInt ( ) { return Integer . parseInt ( sc . next ( ) ) ; }
static int nextInt ( ) { return Integer . parseInt ( sc . next ( ) ) ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters) body: (block (return_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))))
static int [ ] nextIntArray ( int n ) { return IntStream . range ( 0 , n ) . map ( i -> nextInt ( ) ) . toArray ( ) ; }
static int [ ] nextIntArray ( int n ) { return IntStream . range ( 0 , n ) . map ( i -> nextInt ( ) ) . toArray ( ) ; }
(method_declaration (modifiers) type: (array_type element: (integral_type) dimensions: (dimensions)) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier))) body: (block (return_statement (method_invocation object: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal) (identifier))) name: (identifier) arguments: (argument_list (lambda_expression parameters: (identifier) body: (method_invocation name: (identifier) arguments: (argument_list))))) name: (identifier) arguments: (argument_list)))))
static int max ( int ... ar ) { Arrays . sort ( ar ) ; return ar [ ar . length - 1 ] ; }
static int max ( int ... ar ) { Arrays . sort ( ar ) ; return ar [ ar . length - 1 ] ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (spread_parameter (integral_type) (variable_declarator name: (identifier)))) body: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) (return_statement (array_access array: (identifier) index: (binary_expression left: (field_access object: (identifier) field: (identifier)) right: (decimal_integer_literal))))))
static int min ( int ... ar ) { Arrays . sort ( ar ) ; return ar [ 0 ] ; }
static int min ( int ... ar ) { Arrays . sort ( ar ) ; return ar [ 0 ] ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (spread_parameter (integral_type) (variable_declarator name: (identifier)))) body: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) (return_statement (array_access array: (identifier) index: (decimal_integer_literal)))))
public static void main ( String [ ] args ) { String a = sc . next ( ) , b = sc . next ( ) ; out . println ( a . length ( ) > b . length ( ) ? a : b ) ; }
public static void main ( String [ ] args ) { String a = sc . next ( ) , b = sc . next ( ) ; out . println ( a . length ( ) > b . length ( ) ? a : b ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (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)))) (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)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) consequence: (identifier) alternative: (identifier)))))))
public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; Task solver = new Task ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }
public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; Task solver = new Task ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (field_access object: (identifier) field: (identifier)))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (field_access object: (identifier) field: (identifier)))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (identifier))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (identifier))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal) (identifier) (identifier)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; int [ ] b = new int [ n ] ; int [ ] c = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < n ; i ++ ) { b [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < n ; i ++ ) { c [ i ] = sc . nextInt ( ) ; } sc . close ( ) ; Arrays . sort ( a ) ; Arrays . sort ( b ) ; Arrays . sort ( c ) ; long ans = 0 ; long [ ] cnum = new long [ n + 1 ] ; int pos = 0 ; for ( int i = 0 ; i < n ; i ++ ) { while ( c [ pos ] <= b [ i ] ) { pos ++ ; if ( pos >= n ) { pos = n ; break ; } } if ( pos >= n ) break ; cnum [ i ] = n - pos ; } for ( int i = 1 ; i < n ; i ++ ) { cnum [ n - i - 1 ] = cnum [ n - i ] + cnum [ n - i - 1 ] ; } pos = 0 ; for ( int i = 0 ; i < n ; i ++ ) { while ( b [ pos ] <= a [ i ] ) { pos ++ ; if ( pos >= n ) { pos = n ; break ; } } if ( pos >= n ) break ; ans += cnum [ pos ] ; } System . out . println ( ans ) ; }
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; int [ ] b = new int [ n ] ; int [ ] c = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < n ; i ++ ) { b [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < n ; i ++ ) { c [ i ] = sc . nextInt ( ) ; } sc . close ( ) ; Arrays . sort ( a ) ; Arrays . sort ( b ) ; Arrays . sort ( c ) ; long ans = 0 ; long [ ] cnum = new long [ n + 1 ] ; int pos = 0 ; for ( int i = 0 ; i < n ; i ++ ) { while ( c [ pos ] <= b [ i ] ) { pos ++ ; if ( pos >= n ) { pos = n ; break ; } } if ( pos >= n ) break ; cnum [ i ] = n - pos ; } for ( int i = 1 ; i < n ; i ++ ) { cnum [ n - i - 1 ] = cnum [ n - i ] + cnum [ n - i - 1 ] ; } pos = 0 ; for ( int i = 0 ; i < n ; i ++ ) { while ( b [ pos ] <= a [ i ] ) { pos ++ ; if ( pos >= n ) { pos = n ; break ; } } if ( pos >= n ) break ; ans += cnum [ pos ] ; } 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: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (identifier))))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (identifier))))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (identifier))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))) (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)))))) (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))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) (local_variable_declaration type: (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 (binary_expression left: (identifier) right: (decimal_integer_literal)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (while_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (identifier)))) body: (block (expression_statement (update_expression (identifier))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (identifier))) (break_statement))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (break_statement)) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (binary_expression left: (identifier) right: (identifier)))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal))) right: (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (identifier))) right: (array_access array: (identifier) index: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal)))))))) (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 (while_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (identifier)))) body: (block (expression_statement (update_expression (identifier))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (identifier))) (break_statement))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (break_statement)) (expression_statement (assignment_expression left: (identifier) right: (array_access array: (identifier) index: (identifier)))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier))))))
public static void main ( String [ ] args ) { int n = sc . nextInt ( ) ; Integer [ ] A = new Integer [ n ] , B = new Integer [ n ] , C = new Integer [ n ] ; for ( int i = 0 ; i < n ; i ++ ) A [ i ] = sc . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) B [ i ] = sc . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) C [ i ] = sc . nextInt ( ) ; Arrays . sort ( A ) ; Arrays . sort ( C ) ; long ans = 0L ; for ( int i = 0 ; i < n ; i ++ ) { long a = ~ Arrays . binarySearch ( A , B [ i ] , ( x , y ) -> x . compareTo ( y ) >= 0 ? 1 : - 1 ) ; long c = n - ~ Arrays . binarySearch ( C , B [ i ] , ( x , y ) -> x . compareTo ( y ) > 0 ? 1 : - 1 ) ; ans += a * c ; } System . out . println ( ans ) ; }
public static void main ( String [ ] args ) { int n = sc . nextInt ( ) ; Integer [ ] A = new Integer [ n ] , B = new Integer [ n ] , C = new Integer [ n ] ; for ( int i = 0 ; i < n ; i ++ ) A [ i ] = sc . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) B [ i ] = sc . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) C [ i ] = sc . nextInt ( ) ; Arrays . sort ( A ) ; Arrays . sort ( C ) ; long ans = 0L ; for ( int i = 0 ; i < n ; i ++ ) { long a = ~ Arrays . binarySearch ( A , B [ i ] , ( x , y ) -> x . compareTo ( y ) >= 0 ? 1 : - 1 ) ; long c = n - ~ Arrays . binarySearch ( C , B [ i ] , ( x , y ) -> x . compareTo ( y ) > 0 ? 1 : - 1 ) ; ans += a * c ; } 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: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (array_type element: (type_identifier) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (type_identifier) dimensions: (dimensions_expr (identifier)))) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (type_identifier) dimensions: (dimensions_expr (identifier)))) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (type_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: (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (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))))) (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))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) (local_variable_declaration type: (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: (unary_expression operand: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (array_access array: (identifier) index: (identifier)) (lambda_expression parameters: (inferred_parameters (identifier) (identifier)) body: (ternary_expression condition: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (decimal_integer_literal)) consequence: (decimal_integer_literal) alternative: (unary_expression operand: (decimal_integer_literal))))))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (unary_expression operand: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (array_access array: (identifier) index: (identifier)) (lambda_expression parameters: (inferred_parameters (identifier) (identifier)) body: (ternary_expression condition: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (decimal_integer_literal)) consequence: (decimal_integer_literal) alternative: (unary_expression operand: (decimal_integer_literal)))))))))) (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))))))
static int gInt ( ) { return Integer . parseInt ( s . next ( ) ) ; }
static int gInt ( ) { return Integer . parseInt ( s . next ( ) ) ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters) body: (block (return_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))))
public static void main ( String [ ] $ ) { int n = gInt ( ) ; int [ ] a = in ( n ) , b = in ( n ) , c = in ( n ) ; long [ ] v1 = new long [ n ] , v2 = new long [ n ] ; { int v = 0 ; for ( int i = 0 ; i < n ; ++ i ) { for ( ; v < n && a [ v ] < b [ i ] ; ++ v ) { } v1 [ i ] = v ; } } Arrays . parallelPrefix ( v1 , Long :: sum ) ; { int v = 0 ; for ( int i = 0 ; i < n ; ++ i ) { for ( ; v < n && b [ v ] < c [ i ] ; ++ v ) { } v2 [ i ] = v == 0 ? 0 : v1 [ v - 1 ] ; } } System . out . println ( Arrays . stream ( v2 ) . sum ( ) ) ; }
public static void main ( String [ ] $ ) { int n = gInt ( ) ; int [ ] a = in ( n ) , b = in ( n ) , c = in ( n ) ; long [ ] v1 = new long [ n ] , v2 = new long [ n ] ; { int v = 0 ; for ( int i = 0 ; i < n ; ++ i ) { for ( ; v < n && a [ v ] < b [ i ] ; ++ v ) { } v1 [ i ] = v ; } } Arrays . parallelPrefix ( v1 , Long :: sum ) ; { int v = 0 ; for ( int i = 0 ; i < n ; ++ i ) { for ( ; v < n && b [ v ] < c [ i ] ; ++ v ) { } v2 [ i ] = v == 0 ? 0 : v1 [ v - 1 ] ; } } System . out . println ( Arrays . stream ( v2 ) . 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: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (method_invocation name: (identifier) arguments: (argument_list (identifier)))) declarator: (variable_declarator name: (identifier) value: (method_invocation name: (identifier) arguments: (argument_list (identifier)))) declarator: (variable_declarator name: (identifier) value: (method_invocation name: (identifier) arguments: (argument_list (identifier))))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (identifier)))) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (identifier))))) (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (for_statement condition: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (identifier)))) update: (update_expression (identifier)) body: (block)) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier)))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (method_reference (identifier) (identifier))))) (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (for_statement condition: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (identifier)))) update: (update_expression (identifier)) body: (block)) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (ternary_expression condition: (binary_expression left: (identifier) right: (decimal_integer_literal)) consequence: (decimal_integer_literal) alternative: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))))))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) name: (identifier) arguments: (argument_list)))))))
static int [ ] in ( int n ) { return IntStream . range ( 0 , n ) . map ( i -> gInt ( ) ) . sorted ( ) . toArray ( ) ; }
static int [ ] in ( int n ) { return IntStream . range ( 0 , n ) . map ( i -> gInt ( ) ) . sorted ( ) . toArray ( ) ; }
(method_declaration (modifiers) type: (array_type element: (integral_type) dimensions: (dimensions)) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier))) body: (block (return_statement (method_invocation object: (method_invocation object: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal) (identifier))) name: (identifier) arguments: (argument_list (lambda_expression parameters: (identifier) body: (method_invocation name: (identifier) arguments: (argument_list))))) name: (identifier) arguments: (argument_list)) name: (identifier) arguments: (argument_list)))))
public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = Integer . parseInt ( sc . next ( ) ) ; int [ ] b = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) b [ i ] = Integer . parseInt ( sc . next ( ) ) ; int [ ] c = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) c [ i ] = Integer . parseInt ( sc . next ( ) ) ; Arrays . sort ( a ) ; Arrays . sort ( b ) ; Arrays . sort ( c ) ; long ret = 0 ; int s = 0 , t = - 1 ; for ( int i = 0 ; i < n ; i ++ ) { while ( s < n && c [ s ] <= b [ i ] ) s ++ ; while ( t < n - 1 && a [ t + 1 ] < b [ i ] ) t ++ ; ret += ( long ) ( n - s ) * ( t + 1 ) ; } System . out . println ( ret ) ; }
public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = Integer . parseInt ( sc . next ( ) ) ; int [ ] b = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) b [ i ] = Integer . parseInt ( sc . next ( ) ) ; int [ ] c = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) c [ i ] = Integer . parseInt ( sc . next ( ) ) ; Arrays . sort ( a ) ; Arrays . sort ( b ) ; Arrays . sort ( c ) ; long ret = 0 ; int s = 0 , t = - 1 ; for ( int i = 0 ; i < n ; i ++ ) { while ( s < n && c [ s ] <= b [ i ] ) s ++ ; while ( t < n - 1 && a [ t + 1 ] < b [ i ] ) t ++ ; ret += ( long ) ( n - s ) * ( t + 1 ) ; } System . out . println ( ret ) ; }
(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 (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (identifier))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (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: (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 (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))))))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (identifier))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (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))))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) (local_variable_declaration type: (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)) declarator: (variable_declarator name: (identifier) value: (unary_expression operand: (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 (while_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (identifier))))) body: (expression_statement (update_expression (identifier)))) (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: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (array_access array: (identifier) index: (identifier))))) body: (expression_statement (update_expression (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (cast_expression type: (integral_type) value: (parenthesized_expression (binary_expression left: (identifier) right: (identifier)))) right: (parenthesized_expression (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 [ ] 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 ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; System . out . println ( sc . next ( ) . replaceAll ( a , "" ) ) ; }
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; System . out . println ( sc . next ( ) . replaceAll ( 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: (type_identifier) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) name: (identifier) arguments: (argument_list (identifier) (string_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 isPrintableChar ( int c ) { return c >= 33 && c <= 126 ; }
private static boolean isPrintableChar ( int c ) { return c >= 33 && c <= 126 ; }
(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: (identifier) right: (decimal_integer_literal)) right: (binary_expression left: (identifier) right: (decimal_integer_literal))))))
public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; Task solver = new Task ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }
public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; Task solver = new Task ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (field_access object: (identifier) field: (identifier)))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (field_access object: (identifier) field: (identifier)))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (identifier))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (identifier))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal) (identifier) (identifier)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))
public static void main ( String [ ] $ ) { Scanner sc = new Scanner ( in ) ; char x = sc . next ( ) . charAt ( 0 ) ; String s = sc . next ( ) ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) != x ) out . print ( s . charAt ( i ) ) ; } out . println ( ) ; }
public static void main ( String [ ] $ ) { Scanner sc = new Scanner ( in ) ; char x = sc . next ( ) . charAt ( 0 ) ; String s = sc . next ( ) ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) != x ) out . print ( s . charAt ( i ) ) ; } out . println ( ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (identifier))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) name: (identifier) arguments: (argument_list (decimal_integer_literal))))) (local_variable_declaration type: (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 (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (identifier))) 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: (identifier) name: (identifier) arguments: (argument_list)))))
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; String b = sc . next ( ) ; String s = "EQUAL" ; if ( a . length ( ) > b . length ( ) ) { System . out . println ( "GREATER" ) ; System . exit ( 0 ) ; } if ( a . length ( ) < b . length ( ) ) { System . out . println ( "LESS" ) ; System . exit ( 0 ) ; } for ( int i = 0 ; i < a . length ( ) ; i ++ ) { if ( a . charAt ( i ) > b . charAt ( i ) ) { s = "GREATER" ; break ; } if ( a . charAt ( i ) < b . charAt ( i ) ) { s = "LESS" ; break ; } } System . out . println ( s ) ; System . exit ( 0 ) ; }
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; String b = sc . next ( ) ; String s = " EQUAL " ; if ( a . length ( ) > b . length ( ) ) { System . out . println ( " GREATER " ) ; System . exit ( 0 ) ; } if ( a . length ( ) < b . length ( ) ) { System . out . println ( " LESS " ) ; System . exit ( 0 ) ; } for ( int i = 0 ; i < a . length ( ) ; i ++ ) { if ( a . charAt ( i ) > b . charAt ( i ) ) { s = " GREATER " ; break ; } if ( a . charAt ( i ) < b . charAt ( i ) ) { s = " LESS " ; break ; } } System . out . println ( s ) ; 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))) 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: (type_identifier) declarator: (variable_declarator name: (identifier) value: (string_literal))) (if_statement 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: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal)))))) (if_statement 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: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal)))))) (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 (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (string_literal))) (break_statement))) (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (string_literal))) (break_statement))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal))))))
public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; Task solver = new Task ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }
public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; Task solver = new Task ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (field_access object: (identifier) field: (identifier)))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (field_access object: (identifier) field: (identifier)))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (identifier))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (identifier))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal) (identifier) (identifier)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))
public static void main ( String [ ] args ) throws Exception { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; BufferedWriter out = new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ; String a = input . readLine ( ) ; String b = input . readLine ( ) ; String s = null ; if ( a . length ( ) < b . length ( ) ) s = "LESS" ; else if ( a . length ( ) > b . length ( ) ) s = "GREATER" ; else { for ( int i = 0 ; i < a . length ( ) ; i ++ ) { if ( a . charAt ( i ) > b . charAt ( i ) ) { s = "GREATER" ; break ; } else if ( a . charAt ( i ) < b . charAt ( i ) ) { s = "LESS" ; break ; } } } if ( s == null ) s = "EQUAL" ; out . write ( s ) ; out . write ( "\n" ) ; out . close ( ) ; }
public static void main ( String [ ] args ) throws Exception { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; BufferedWriter out = new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ; String a = input . readLine ( ) ; String b = input . readLine ( ) ; String s = null ; if ( a . length ( ) < b . length ( ) ) s = " LESS " ; else if ( a . length ( ) > b . length ( ) ) s = " GREATER " ; else { for ( int i = 0 ; i < a . length ( ) ; i ++ ) { if ( a . charAt ( i ) > b . charAt ( i ) ) { s = " GREATER " ; break ; } else if ( a . charAt ( i ) < b . charAt ( i ) ) { s = " LESS " ; break ; } } } if ( s == null ) s = " EQUAL " ; out . write ( s ) ; out . write ( " \n " ) ; 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))) (throws (type_identifier)) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (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: (null_literal))) (if_statement 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: (expression_statement (assignment_expression left: (identifier) right: (string_literal))) alternative: (if_statement 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: (expression_statement (assignment_expression left: (identifier) right: (string_literal))) alternative: (block (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (string_literal))) (break_statement)) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (string_literal))) (break_statement))))))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (null_literal))) consequence: (expression_statement (assignment_expression left: (identifier) right: (string_literal)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) (expression_statement (method_invocation object: (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 ) { String a = sc . next ( ) , b = sc . next ( ) ; int comp = new BigInteger ( a ) . compareTo ( new BigInteger ( b ) ) ; if ( comp < 0 ) { System . out . println ( "LESS" ) ; } else if ( comp == 0 ) { System . out . println ( "EQUAL" ) ; } else { System . out . println ( "GREATER" ) ; } }
public static void main ( String [ ] args ) { String a = sc . next ( ) , b = sc . next ( ) ; int comp = new BigInteger ( a ) . compareTo ( new BigInteger ( b ) ) ; if ( comp < 0 ) { System . out . println ( " LESS " ) ; } else if ( comp == 0 ) { System . out . println ( " EQUAL " ) ; } else { System . out . println ( " GREATER " ) ; } }
(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: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (object_creation_expression type: (type_identifier) arguments: (argument_list (identifier))) name: (identifier) arguments: (argument_list (object_creation_expression type: (type_identifier) arguments: (argument_list (identifier))))))) (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: (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 ) { MyScanner sc = new MyScanner ( ) ; String a = sc . next ( ) ; String b = sc . next ( ) ; String ans ; int la = a . length ( ) ; int lb = b . length ( ) ; if ( la > lb ) { ans = "GREATER" ; } else if ( la < lb ) { ans = "LESS" ; } else { if ( a . compareTo ( b ) < 0 ) { ans = "LESS" ; } else if ( a . compareTo ( b ) > 0 ) { ans = "GREATER" ; } else { ans = "EQUAL" ; } } System . out . println ( ans ) ; }
public static void main ( String [ ] args ) { MyScanner sc = new MyScanner ( ) ; String a = sc . next ( ) ; String b = sc . next ( ) ; String ans ; int la = a . length ( ) ; int lb = b . length ( ) ; if ( la > lb ) { ans = " GREATER " ; } else if ( la < lb ) { ans = " LESS " ; } else { if ( a . compareTo ( b ) < 0 ) { ans = " LESS " ; } else if ( a . compareTo ( b ) > 0 ) { ans = " GREATER " ; } else { ans = " EQUAL " ; } } System . out . println ( ans ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list)))) (local_variable_declaration type: (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))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (expression_statement (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 (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 (assignment_expression left: (identifier) right: (string_literal)))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (decimal_integer_literal))) consequence: (block (expression_statement (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))))))
static int l_min ( int [ ] a ) { Arrays . sort ( a ) ; return a [ 0 ] ; }
static int l_min ( int [ ] a ) { Arrays . sort ( a ) ; return a [ 0 ] ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (integral_type) dimensions: (dimensions)) name: (identifier))) body: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) (return_statement (array_access array: (identifier) index: (decimal_integer_literal)))))
static int l_max ( int [ ] a ) { int l = a . length ; Arrays . sort ( a ) ; return a [ l - 1 ] ; }
static int l_max ( int [ ] a ) { int l = a . length ; Arrays . sort ( a ) ; return a [ l - 1 ] ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (integral_type) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (field_access object: (identifier) field: (identifier)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) (return_statement (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))))))
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; String a [ ] = new String [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . next ( ) ; } Set < String > set = new HashSet < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { set . add ( a [ i ] ) ; } if ( set . size ( ) == 4 ) { System . out . println ( "Four" ) ; } else { System . out . println ( "Three" ) ; } sc . close ( ) ; }
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; String a [ ] = new String [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . next ( ) ; } Set < String > set = new HashSet < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { set . add ( a [ i ] ) ; } if ( set . size ( ) == 4 ) { System . out . println ( " Four " ) ; } else { System . out . println ( " Three " ) ; } 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 (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) dimensions: (dimensions) value: (array_creation_expression type: (type_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 (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))) (local_variable_declaration type: (generic_type (type_identifier) (type_arguments (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 (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: (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 IOException { BufferedReader stdin = new BufferedReader ( new InputStreamReader ( System . in ) ) ; stdin . readLine ( ) ; long cnt = Arrays . stream ( stdin . readLine ( ) . split ( " " ) ) . sorted ( ) . distinct ( ) . count ( ) ; String ans = cnt == 3 ? "Three" : "Four" ; System . out . println ( ans ) ; }
public static void main ( String [ ] args ) throws IOException { BufferedReader stdin = new BufferedReader ( new InputStreamReader ( System . in ) ) ; stdin . readLine ( ) ; long cnt = Arrays . stream ( stdin . readLine ( ) . split ( " ▁ " ) ) . sorted ( ) . distinct ( ) . count ( ) ; String ans = cnt == 3 ? " Three " : " Four " ; System . out . println ( ans ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) (throws (type_identifier)) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (method_invocation object: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) name: (identifier) arguments: (argument_list (string_literal))))) name: (identifier) arguments: (argument_list)) name: (identifier) arguments: (argument_list)) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (ternary_expression condition: (binary_expression left: (identifier) right: (decimal_integer_literal)) 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 ) { boolean P = false ; boolean W = false ; boolean G = false ; boolean Y = false ; int n = sc . nextInt ( ) ; String s ; for ( int i = 0 ; i < n ; i ++ ) { s = sc . next ( ) ; if ( s . equals ( "P" ) ) { P = true ; } else if ( s . equals ( "W" ) ) { W = true ; } else if ( s . equals ( "G" ) ) { G = true ; } else { Y = true ; } } int count = 0 ; if ( P == true ) { count ++ ; } if ( W == true ) { count ++ ; } if ( G == true ) { count ++ ; } if ( Y == true ) { count ++ ; } out . println ( count == 4 ? "Four" : "Three" ) ; }
public static void main ( String [ ] args ) { boolean P = false ; boolean W = false ; boolean G = false ; boolean Y = false ; int n = sc . nextInt ( ) ; String s ; for ( int i = 0 ; i < n ; i ++ ) { s = sc . next ( ) ; if ( s . equals ( " P " ) ) { P = true ; } else if ( s . equals ( " W " ) ) { W = true ; } else if ( s . equals ( " G " ) ) { G = true ; } else { Y = true ; } } int count = 0 ; if ( P == true ) { count ++ ; } if ( W == true ) { count ++ ; } if ( G == true ) { count ++ ; } if ( Y == true ) { count ++ ; } out . println ( count == 4 ? " Four " : " Three " ) ; }
(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: (boolean_type) declarator: (variable_declarator name: (identifier) value: (false))) (local_variable_declaration type: (boolean_type) declarator: (variable_declarator name: (identifier) value: (false))) (local_variable_declaration type: (boolean_type) declarator: (variable_declarator name: (identifier) value: (false))) (local_variable_declaration type: (boolean_type) declarator: (variable_declarator name: (identifier) value: (false))) (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))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (if_statement condition: (parenthesized_expression (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (string_literal)))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (true)))) alternative: (if_statement condition: (parenthesized_expression (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (string_literal)))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (true)))) alternative: (if_statement condition: (parenthesized_expression (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (string_literal)))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (true)))) alternative: (block (expression_statement (assignment_expression left: (identifier) right: (true))))))))) (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: (true))) consequence: (block (expression_statement (update_expression (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (true))) consequence: (block (expression_statement (update_expression (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (true))) consequence: (block (expression_statement (update_expression (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (true))) consequence: (block (expression_statement (update_expression (identifier))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (ternary_expression condition: (binary_expression left: (identifier) right: (decimal_integer_literal)) consequence: (string_literal) alternative: (string_literal)))))))
public static void main ( String [ ] args ) { Scanner reader = new Scanner ( System . in ) ; int N = reader . nextInt ( ) ; String ans = "Three" ; for ( int i = 0 ; i < N ; i ++ ) { char ch = reader . next ( ) . charAt ( 0 ) ; if ( ch == 'Y' ) { ans = "Four" ; } } System . out . print ( ans ) ; reader . close ( ) ; }
public static void main ( String [ ] args ) { Scanner reader = new Scanner ( System . in ) ; int N = reader . nextInt ( ) ; String ans = " Three " ; for ( int i = 0 ; i < N ; i ++ ) { char ch = reader . next ( ) . charAt ( 0 ) ; if ( ch == ' Y ' ) { ans = " Four " ; } } System . out . print ( ans ) ; reader . close ( ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (string_literal))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) name: (identifier) arguments: (argument_list (decimal_integer_literal))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (character_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (string_literal))))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier)))) (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 ) ) ; int n = Integer . parseInt ( input . readLine ( ) ) ; StringTokenizer tokenizer = new StringTokenizer ( input . readLine ( ) ) ; String [ ] charac = { "P" , "W" , "G" , "Y" }; boolean [ ] state = new boolean [ 4 ] ; String h ; for ( int i = 0 ; i < n ; i ++ ) { h = tokenizer . nextToken ( ) ; for ( int j = 0 ; j < 4 ; j ++ ) { if ( h . equals ( charac [ j ] ) ) { state [ j ] = true ; break ; } } } System . out . println ( state [ 3 ] ? "Four" : "Three" ) ; }
public static void main ( String [ ] args ) throws Exception { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( input . readLine ( ) ) ; StringTokenizer tokenizer = new StringTokenizer ( input . readLine ( ) ) ; String [ ] charac = { " P " , " W " , " G " , " Y " } ; boolean [ ] state = new boolean [ 4 ] ; String h ; for ( int i = 0 ; i < n ; i ++ ) { h = tokenizer . nextToken ( ) ; for ( int j = 0 ; j < 4 ; j ++ ) { if ( h . equals ( charac [ j ] ) ) { state [ j ] = true ; break ; } } } System . out . println ( state [ 3 ] ? " Four " : " Three " ) ; }
(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: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))) (local_variable_declaration type: (array_type element: (type_identifier) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_initializer (string_literal) (string_literal) (string_literal) (string_literal)))) (local_variable_declaration type: (array_type element: (boolean_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (boolean_type) dimensions: (dimensions_expr (decimal_integer_literal))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (decimal_integer_literal)) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (identifier))))) consequence: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (true))) (break_statement))))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (ternary_expression condition: (array_access array: (identifier) index: (decimal_integer_literal)) consequence: (string_literal) alternative: (string_literal)))))))
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) , m = sc . nextInt ( ) ; Map < Integer , Integer > map = new HashMap < > ( ) ; int [ ] sum = new int [ n + 1 ] ; long ans = 0 ; sum [ 0 ] = 0 ; map . put ( 0 , 1 ) ; for ( int i = 1 ; i < n + 1 ; i ++ ) { sum [ i ] = ( sum [ i - 1 ] + sc . nextInt ( ) ) % m ; if ( ! map . containsKey ( sum [ i ] ) ) { map . put ( sum [ i ] , 1 ) ; } else { map . put ( sum [ i ] , map . get ( sum [ i ] ) + 1 ) ; } ans += map . get ( sum [ i ] ) - 1 ; } System . out . println ( ans ) ; }
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) , m = sc . nextInt ( ) ; Map < Integer , Integer > map = new HashMap < > ( ) ; int [ ] sum = new int [ n + 1 ] ; long ans = 0 ; sum [ 0 ] = 0 ; map . put ( 0 , 1 ) ; for ( int i = 1 ; i < n + 1 ; i ++ ) { sum [ i ] = ( sum [ i - 1 ] + sc . nextInt ( ) ) % m ; if ( ! map . containsKey ( sum [ i ] ) ) { map . put ( sum [ i ] , 1 ) ; } else { map . put ( sum [ i ] , map . get ( sum [ i ] ) + 1 ) ; } ans += map . get ( sum [ i ] ) - 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)))))) (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)))) (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: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (binary_expression left: (identifier) right: (decimal_integer_literal)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (decimal_integer_literal))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal) (decimal_integer_literal)))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal))) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (binary_expression left: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) right: (identifier)))) (if_statement condition: (parenthesized_expression (unary_expression operand: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (identifier)))))) consequence: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (identifier)) (decimal_integer_literal))))) alternative: (block (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)))) right: (decimal_integer_literal))))))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (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 ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] a = new int [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } long [ ] sum = new long [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) { sum [ i ] = a [ i ] + sum [ i - 1 ] ; } HashMap < Long , Integer > map = new HashMap < Long , Integer > ( ) ; for ( int i = 1 ; i <= n ; i ++ ) { map . put ( sum [ i ] % m , 0 ) ; } for ( int i = 1 ; i <= n ; i ++ ) { int x = map . get ( sum [ i ] % m ) ; map . put ( sum [ i ] % m , x + 1 ) ; } long ans = 0 ; if ( map . containsKey ( 0l ) ) { ans = map . get ( 0l ) ; } for ( long i : map . keySet ( ) ) { if ( map . get ( i ) >= 2 ) { for ( int j = map . get ( i ) ; j > 1 ; j -- ) { ans += j - 1 ; } } } System . out . println ( ans ) ; }
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] a = new int [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } long [ ] sum = new long [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) { sum [ i ] = a [ i ] + sum [ i - 1 ] ; } HashMap < Long , Integer > map = new HashMap < Long , Integer > ( ) ; for ( int i = 1 ; i <= n ; i ++ ) { map . put ( sum [ i ] % m , 0 ) ; } for ( int i = 1 ; i <= n ; i ++ ) { int x = map . get ( sum [ i ] % m ) ; map . put ( sum [ i ] % m , x + 1 ) ; } long ans = 0 ; if ( map . containsKey ( 0l ) ) { ans = map . get ( 0l ) ; } for ( long i : map . keySet ( ) ) { if ( map . get ( i ) >= 2 ) { for ( int j = map . get ( i ) ; j > 1 ; j -- ) { ans += j - 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)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (binary_expression left: (identifier) right: (decimal_integer_literal)))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (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)))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (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 (type_identifier) (type_identifier))) arguments: (argument_list)))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier)) (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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier)))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier)) (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 (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal)))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal))))))) (enhanced_for_statement type: (integral_type) name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (decimal_integer_literal))) consequence: (block (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))) 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: (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 ) { int N = IN . nextInt ( ) ; int M = IN . nextInt ( ) ; int [ ] A = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { A [ i ] = IN . nextInt ( ) ; } HashMap < Integer , Integer > B = new HashMap < > ( ) ; B . put ( 0 , 1 ) ; long ans = 0 ; int tot = 0 ; for ( int a : A ) { tot = ( tot + a ) % M ; int tmp = B . getOrDefault ( tot , 0 ) ; ans += ( long ) tmp ; B . put ( tot , tmp + 1 ) ; } puts ( ans ) ; flush ( ) ; }
public static void main ( String ... args ) { int N = IN . nextInt ( ) ; int M = IN . nextInt ( ) ; int [ ] A = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { A [ i ] = IN . nextInt ( ) ; } HashMap < Integer , Integer > B = new HashMap < > ( ) ; B . put ( 0 , 1 ) ; long ans = 0 ; int tot = 0 ; for ( int a : A ) { tot = ( tot + a ) % M ; int tmp = B . getOrDefault ( tot , 0 ) ; ans += ( long ) tmp ; B . put ( tot , tmp + 1 ) ; } puts ( ans ) ; flush ( ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (spread_parameter (type_identifier) (variable_declarator name: (identifier)))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (identifier))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))) (local_variable_declaration type: (generic_type (type_identifier) (type_arguments (type_identifier) (type_identifier))) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (generic_type (type_identifier) (type_arguments)) arguments: (argument_list)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal) (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: (identifier) body: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) right: (identifier)))) (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 (assignment_expression left: (identifier) right: (cast_expression type: (integral_type) value: (identifier)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (binary_expression left: (identifier) right: (decimal_integer_literal))))))) (expression_statement (method_invocation name: (identifier) arguments: (argument_list (identifier)))) (expression_statement (method_invocation name: (identifier) arguments: (argument_list)))))
static < T > void puts ( T arg ) { OUT . println ( arg ) ; }
static < T > void puts ( T arg ) { OUT . println ( arg ) ; }
(method_declaration (modifiers) type_parameters: (type_parameters (type_parameter (type_identifier))) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) name: (identifier))) body: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))))
static void flush ( ) { OUT . flush ( ) ; }
static void flush ( ) { OUT . flush ( ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters) body: (block (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 ( ) ; long m = sc . nextLong ( ) ; long [ ] a = new long [ n ] ; HashMap < Long , Integer > map = new HashMap < > ( ) ; long ans = 0 ; a [ 0 ] = sc . nextLong ( ) ; for ( int i = 1 ; i < n ; i ++ ) { a [ i ] = sc . nextLong ( ) + a [ i - 1 ] ; } for ( int i = 0 ; i < n ; i ++ ) { if ( map . containsKey ( a [ i ] % m ) ) { map . put ( a [ i ] % m , map . get ( a [ i ] % m ) + 1 ) ; } else { map . put ( a [ i ] % m , 1 ) ; } } for ( long i : map . keySet ( ) ) { long q = map . get ( i ) ; if ( i == 0 ) { ans += q ; } ans += ( q * ( q - 1 ) ) / 2 ; } System . out . println ( ans ) ; }
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long m = sc . nextLong ( ) ; long [ ] a = new long [ n ] ; HashMap < Long , Integer > map = new HashMap < > ( ) ; long ans = 0 ; a [ 0 ] = sc . nextLong ( ) ; for ( int i = 1 ; i < n ; i ++ ) { a [ i ] = sc . nextLong ( ) + a [ i - 1 ] ; } for ( int i = 0 ; i < n ; i ++ ) { if ( map . containsKey ( a [ i ] % m ) ) { map . put ( a [ i ] % m , map . get ( a [ i ] % m ) + 1 ) ; } else { map . put ( a [ i ] % m , 1 ) ; } } for ( long i : map . keySet ( ) ) { long q = map . get ( i ) ; if ( i == 0 ) { ans += q ; } ans += ( q * ( q - 1 ) ) / 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) 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: (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: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (array_access array: (identifier) index: (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 (if_statement condition: (parenthesized_expression (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier))))) consequence: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier)) (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier)))) right: (decimal_integer_literal)))))) alternative: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier)) (decimal_integer_literal)))))))) (enhanced_for_statement type: (integral_type) name: (identifier) value: (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 (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))))) right: (decimal_integer_literal)))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier))))))
public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . next ( ) ) ; int M = Integer . parseInt ( sc . next ( ) ) ; Map < Integer , Integer > map = new HashMap < Integer , Integer > ( ) ; long sum [ ] = new long [ N + 1 ] ; int A [ ] = new int [ N + 1 ] ; A [ 1 ] = Integer . parseInt ( sc . next ( ) ) ; sum [ 0 ] = 0 ; sum [ 1 ] = A [ 1 ] ; map . put ( ( int ) ( sum [ 1 ] % M ) , 1 ) ; for ( int i = 2 ; i <= N ; i ++ ) { A [ i ] = Integer . parseInt ( sc . next ( ) ) ; sum [ i ] = sum [ i - 1 ] + A [ i ] ; int mod = ( int ) ( sum [ i ] % M ) ; if ( map . containsKey ( mod ) ) { map . put ( mod , map . get ( mod ) + 1 ) ; } else { map . put ( mod , 1 ) ; } } long ans = 0 ; Iterator < Map . Entry < Integer , Integer >> it = map . entrySet ( ) . iterator ( ) ; while ( it . hasNext ( ) ) { Map . Entry < Integer , Integer > mapEntry = it . next ( ) ; long temp = 0 ; if ( mapEntry . getKey ( ) == 0 ) { for ( long i = mapEntry . getValue ( ) ; i > 0 ; i -- ) { temp += i ; } } else { for ( long i = mapEntry . getValue ( ) - 1 ; i > 0 ; i -- ) { temp += i ; } } if ( temp != 0 || mapEntry . getKey ( ) == 0 ) { ans += temp ; } } System . out . println ( ans ) ; }
public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . next ( ) ) ; int M = Integer . parseInt ( sc . next ( ) ) ; Map < Integer , Integer > map = new HashMap < Integer , Integer > ( ) ; long sum [ ] = new long [ N + 1 ] ; int A [ ] = new int [ N + 1 ] ; A [ 1 ] = Integer . parseInt ( sc . next ( ) ) ; sum [ 0 ] = 0 ; sum [ 1 ] = A [ 1 ] ; map . put ( ( int ) ( sum [ 1 ] % M ) , 1 ) ; for ( int i = 2 ; i <= N ; i ++ ) { A [ i ] = Integer . parseInt ( sc . next ( ) ) ; sum [ i ] = sum [ i - 1 ] + A [ i ] ; int mod = ( int ) ( sum [ i ] % M ) ; if ( map . containsKey ( mod ) ) { map . put ( mod , map . get ( mod ) + 1 ) ; } else { map . put ( mod , 1 ) ; } } long ans = 0 ; Iterator < Map . Entry < Integer , Integer > > it = map . entrySet ( ) . iterator ( ) ; while ( it . hasNext ( ) ) { Map . Entry < Integer , Integer > mapEntry = it . next ( ) ; long temp = 0 ; if ( mapEntry . getKey ( ) == 0 ) { for ( long i = mapEntry . getValue ( ) ; i > 0 ; i -- ) { temp += i ; } } else { for ( long i = mapEntry . getValue ( ) - 1 ; i > 0 ; i -- ) { temp += i ; } } if ( temp != 0 || mapEntry . getKey ( ) == 0 ) { ans += temp ; } } System . out . println ( ans ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) name: (identifier) dimensions: (dimensions))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))) (local_variable_declaration type: (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 (type_identifier) (type_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 (binary_expression left: (identifier) right: (decimal_integer_literal)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) dimensions: (dimensions) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (binary_expression left: (identifier) right: (decimal_integer_literal)))))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (decimal_integer_literal))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (array_access array: (identifier) index: (decimal_integer_literal)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (cast_expression type: (integral_type) value: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (identifier)))) (decimal_integer_literal)))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (array_access array: (identifier) index: (identifier))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (cast_expression type: (integral_type) value: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier)))))) (if_statement condition: (parenthesized_expression (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) consequence: (block (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))) right: (decimal_integer_literal)))))) alternative: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (decimal_integer_literal)))))))) (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 (generic_type (scoped_type_identifier (type_identifier) (type_identifier)) (type_arguments (type_identifier) (type_identifier))))) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) name: (identifier) arguments: (argument_list)))) (while_statement condition: (parenthesized_expression (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) 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)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal))) consequence: (block (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) condition: (binary_expression left: (identifier) right: (decimal_integer_literal)) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (identifier) right: (identifier)))))) alternative: (block (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: (identifier) right: (decimal_integer_literal)) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (identifier) right: (identifier))))))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (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: (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 scanner = new Scanner ( System . in ) ; int total = scanner . nextInt ( ) ; int sum = 0 ; for ( int ix = 1 ; ix <= total ; ix ++ ) { sum += ix ; } System . out . println ( sum ) ; }
public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int total = scanner . nextInt ( ) ; int sum = 0 ; for ( int ix = 1 ; ix <= total ; ix ++ ) { sum += ix ; } 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: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (identifier) right: (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 keyboard = new Scanner ( System . in ) ; int N = keyboard . nextInt ( ) ; int ame = 0 ; for ( int i = 1 ; i <= N ; i ++ ) { ame += i ; } System . out . println ( ame ) ; keyboard . close ( ) ; }
public static void main ( String [ ] args ) { Scanner keyboard = new Scanner ( System . in ) ; int N = keyboard . nextInt ( ) ; int ame = 0 ; for ( int i = 1 ; i <= N ; i ++ ) { ame += i ; } System . out . println ( ame ) ; 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: (decimal_integer_literal))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (identifier) right: (identifier))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))
public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; System . out . println ( N * ( 1 + N ) / 2 ) ; }
public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; System . out . println ( N * ( 1 + N ) / 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 (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (identifier) right: (parenthesized_expression (binary_expression left: (decimal_integer_literal) right: (identifier)))) right: (decimal_integer_literal)))))))
public static void main ( String [ ] args ) { Main main = new Main ( ) ; main . solve ( ) ; }
public static void main ( String [ ] args ) { Main main = new Main ( ) ; main . solve ( ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (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 ) { try ( Scanner scanner = new Scanner ( System . in ) ) { int n = scanner . nextInt ( ) ; System . out . println ( n * ( n + 1 ) / 2 ) ; } }
public static void main ( String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { int n = scanner . 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 (try_with_resources_statement resources: (resource_specification (resource type: (type_identifier) name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (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 ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] p = { 2 , 3 , 5 , 7 , 11 , 13 , 17 , 19 , 23 , 29 , 31 , 37 , 41 , 43 , 47 , 53 , 59 , 61 , 67 , 71 , 73 , 79 , 83 , 89 , 97 }; int [ ] pTotal = new int [ p . length ] ; for ( int i = 0 ; i < p . length ; i ++ ) pTotal [ i ] = legendre ( N , p [ i ] ) ; int ans = 0 ; for ( int i = 0 ; i < p . length ; i ++ ) { if ( pTotal [ i ] >= 74 ) ans ++ ; } for ( int i = 0 ; i < p . length ; i ++ ) { for ( int j = 0 ; j < p . length ; j ++ ) { if ( i != j && pTotal [ i ] >= 2 && pTotal [ j ] >= 24 ) ans ++ ; } } for ( int i = 0 ; i < p . length ; i ++ ) { for ( int j = 0 ; j < p . length ; j ++ ) { if ( i != j && pTotal [ i ] >= 4 && pTotal [ j ] >= 14 ) ans ++ ; } } int plus = 0 ; for ( int i = 0 ; i < p . length ; i ++ ) { for ( int j = 0 ; j < p . length ; j ++ ) { for ( int k = 0 ; k < p . length ; k ++ ) { if ( i != j && j != k && k != i && pTotal [ i ] >= 2 && pTotal [ j ] >= 4 && pTotal [ k ] >= 4 ) plus ++ ; } } } ans += plus / 2 ; System . out . println ( ans ) ; }
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] p = { 2 , 3 , 5 , 7 , 11 , 13 , 17 , 19 , 23 , 29 , 31 , 37 , 41 , 43 , 47 , 53 , 59 , 61 , 67 , 71 , 73 , 79 , 83 , 89 , 97 } ; int [ ] pTotal = new int [ p . length ] ; for ( int i = 0 ; i < p . length ; i ++ ) pTotal [ i ] = legendre ( N , p [ i ] ) ; int ans = 0 ; for ( int i = 0 ; i < p . length ; i ++ ) { if ( pTotal [ i ] >= 74 ) ans ++ ; } for ( int i = 0 ; i < p . length ; i ++ ) { for ( int j = 0 ; j < p . length ; j ++ ) { if ( i != j && pTotal [ i ] >= 2 && pTotal [ j ] >= 24 ) ans ++ ; } } for ( int i = 0 ; i < p . length ; i ++ ) { for ( int j = 0 ; j < p . length ; j ++ ) { if ( i != j && pTotal [ i ] >= 4 && pTotal [ j ] >= 14 ) ans ++ ; } } int plus = 0 ; for ( int i = 0 ; i < p . length ; i ++ ) { for ( int j = 0 ; j < p . length ; j ++ ) { for ( int k = 0 ; k < p . length ; k ++ ) { if ( i != j && j != k && k != i && pTotal [ i ] >= 2 && pTotal [ j ] >= 4 && pTotal [ k ] >= 4 ) plus ++ ; } } } ans += plus / 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: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_initializer (decimal_integer_literal) (decimal_integer_literal) (decimal_integer_literal) (decimal_integer_literal) (decimal_integer_literal) (decimal_integer_literal) (decimal_integer_literal) (decimal_integer_literal) (decimal_integer_literal) (decimal_integer_literal) (decimal_integer_literal) (decimal_integer_literal) (decimal_integer_literal) (decimal_integer_literal) (decimal_integer_literal) (decimal_integer_literal) (decimal_integer_literal) (decimal_integer_literal) (decimal_integer_literal) (decimal_integer_literal) (decimal_integer_literal) (decimal_integer_literal) (decimal_integer_literal) (decimal_integer_literal) (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 (field_access object: (identifier) field: (identifier)))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (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 (identifier) (array_access array: (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: (field_access object: (identifier) field: (identifier))) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal))) consequence: (expression_statement (update_expression (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: (field_access object: (identifier) field: (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: (field_access object: (identifier) field: (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: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal))) right: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal)))) consequence: (expression_statement (update_expression (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: (field_access object: (identifier) field: (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: (field_access object: (identifier) field: (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: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal))) right: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal)))) consequence: (expression_statement (update_expression (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: (field_access object: (identifier) field: (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: (field_access object: (identifier) field: (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: (field_access object: (identifier) field: (identifier))) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (binary_expression left: (identifier) right: (identifier))) right: (binary_expression left: (identifier) right: (identifier))) right: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal))) right: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal))) right: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal)))) consequence: (expression_statement (update_expression (identifier)))))))))) (expression_statement (assignment_expression left: (identifier) 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))))))
static int legendre ( int n , int p ) { int c = 0 ; int m = p ; while ( m <= n ) { c += n / m ; m *= p ; } return c ; }
static int legendre ( int n , int p ) { int c = 0 ; int m = p ; while ( m <= n ) { c += n / m ; m *= p ; } return c ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (identifier))) (while_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) body: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (identifier))))) (return_statement (identifier))))
static void primeFactor ( int n ) { int a = 2 ; while ( a * a <= n ) { if ( n % a == 0 ) { pf . merge ( a , 1 , Integer :: sum ) ; n = n / a ; } else { a ++ ; } } pf . merge ( n , 1 , Integer :: sum ) ; }
static void primeFactor ( int n ) { int a = 2 ; while ( a * a <= n ) { if ( n % a == 0 ) { pf . merge ( a , 1 , Integer :: sum ) ; n = n / a ; } else { a ++ ; } } pf . merge ( n , 1 , Integer :: sum ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (while_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (identifier))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal))) consequence: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (decimal_integer_literal) (method_reference (identifier) (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (identifier))))) alternative: (block (expression_statement (update_expression (identifier))))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (decimal_integer_literal) (method_reference (identifier) (identifier)))))))
static int f ( int x ) { int cnt = 0 ; for ( Integer i : pf . values ( ) ) if ( x - 1 <= i ) cnt ++ ; return cnt ++ ; }
static int f ( int x ) { int cnt = 0 ; for ( Integer i : pf . values ( ) ) if ( x - 1 <= i ) cnt ++ ; return cnt ++ ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (enhanced_for_statement type: (type_identifier) name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) body: (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (identifier))) consequence: (expression_statement (update_expression (identifier))))) (return_statement (update_expression (identifier)))))
public static void main ( String [ ] args ) throws IOException { final String s ; try ( BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { s = reader . readLine ( ) ; } PrintWriter out = new PrintWriter ( System . out ) ; final String [ ] sl = s . split ( " " ) ; int N = Integer . parseInt ( sl [ 0 ] ) ; pf = new HashMap < > ( ) ; for ( int i = 2 ; i < N + 1 ; i ++ ) primeFactor ( i ) ; int ans = f ( 75 ) + f ( 25 ) * ( f ( 3 ) - 1 ) + f ( 15 ) * ( f ( 5 ) - 1 ) + f ( 5 ) * ( f ( 5 ) - 1 ) * ( f ( 3 ) - 2 ) / 2 ; out . println ( ans ) ; out . flush ( ) ; }
public static void main ( String [ ] args ) throws IOException { final String s ; try ( BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { s = reader . readLine ( ) ; } PrintWriter out = new PrintWriter ( System . out ) ; final String [ ] sl = s . split ( " ▁ " ) ; int N = Integer . parseInt ( sl [ 0 ] ) ; pf = new HashMap < > ( ) ; for ( int i = 2 ; i < N + 1 ; i ++ ) primeFactor ( i ) ; int ans = f ( 75 ) + f ( 25 ) * ( f ( 3 ) - 1 ) + f ( 15 ) * ( f ( 5 ) - 1 ) + f ( 5 ) * ( f ( 5 ) - 1 ) * ( f ( 3 ) - 2 ) / 2 ; out . println ( ans ) ; 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))) (throws (type_identifier)) body: (block (local_variable_declaration (modifiers) type: (type_identifier) declarator: (variable_declarator name: (identifier))) (try_with_resources_statement resources: (resource_specification (resource type: (type_identifier) 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)))))))) body: (block (expression_statement (assignment_expression left: (identifier) right: (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)))))) (local_variable_declaration (modifiers) 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)))))) (expression_statement (assignment_expression left: (identifier) right: (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: (binary_expression left: (identifier) right: (decimal_integer_literal))) update: (update_expression (identifier)) body: (expression_statement (method_invocation name: (identifier) arguments: (argument_list (identifier))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (binary_expression left: (binary_expression left: (method_invocation name: (identifier) arguments: (argument_list (decimal_integer_literal))) right: (binary_expression left: (method_invocation name: (identifier) arguments: (argument_list (decimal_integer_literal))) right: (parenthesized_expression (binary_expression left: (method_invocation name: (identifier) arguments: (argument_list (decimal_integer_literal))) right: (decimal_integer_literal))))) right: (binary_expression left: (method_invocation name: (identifier) arguments: (argument_list (decimal_integer_literal))) right: (parenthesized_expression (binary_expression left: (method_invocation name: (identifier) arguments: (argument_list (decimal_integer_literal))) right: (decimal_integer_literal))))) right: (binary_expression left: (binary_expression left: (binary_expression left: (method_invocation name: (identifier) arguments: (argument_list (decimal_integer_literal))) right: (parenthesized_expression (binary_expression left: (method_invocation name: (identifier) arguments: (argument_list (decimal_integer_literal))) right: (decimal_integer_literal)))) right: (parenthesized_expression (binary_expression left: (method_invocation name: (identifier) arguments: (argument_list (decimal_integer_literal))) right: (decimal_integer_literal)))) right: (decimal_integer_literal))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; HashMap < Integer , Integer > primeCount = new HashMap < > ( ) ; primeCount . put ( 1 , 1 ) ; for ( int i = 2 ; i <= N ; i ++ ) { int value = i ; for ( int j = 2 ; j <= i ; j ++ ) { while ( value % j == 0 ) { primeCount . put ( j , primeCount . containsKey ( j ) ? primeCount . get ( j ) + 1 : 1 ) ; value = value / j ; } } } int ans = 0 ; for ( Map . Entry < Integer , Integer > entry0 : primeCount . entrySet ( ) ) { for ( Map . Entry < Integer , Integer > entry1 : primeCount . entrySet ( ) ) { for ( Map . Entry < Integer , Integer > entry2 : primeCount . entrySet ( ) ) { if ( entry0 . getKey ( ) == entry1 . getKey ( ) ) continue ; if ( entry0 . getKey ( ) == entry2 . getKey ( ) ) continue ; if ( entry1 . getKey ( ) == entry2 . getKey ( ) ) continue ; if ( entry1 . getKey ( ) > entry2 . getKey ( ) ) continue ; if ( entry0 . getValue ( ) >= 2 && entry1 . getValue ( ) >= 4 && entry2 . getValue ( ) >= 4 ) ans ++ ; } } } for ( Map . Entry < Integer , Integer > entry0 : primeCount . entrySet ( ) ) { for ( Map . Entry < Integer , Integer > entry1 : primeCount . entrySet ( ) ) { if ( entry0 . getKey ( ) == entry1 . getKey ( ) ) continue ; if ( entry0 . getValue ( ) >= 4 && entry1 . getValue ( ) >= 14 ) ans ++ ; if ( entry0 . getValue ( ) >= 2 && entry1 . getValue ( ) >= 24 ) ans ++ ; } } for ( Integer count : primeCount . values ( ) ) { if ( count >= 74 ) ans ++ ; } System . out . println ( ans ) ; }
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; HashMap < Integer , Integer > primeCount = new HashMap < > ( ) ; primeCount . put ( 1 , 1 ) ; for ( int i = 2 ; i <= N ; i ++ ) { int value = i ; for ( int j = 2 ; j <= i ; j ++ ) { while ( value % j == 0 ) { primeCount . put ( j , primeCount . containsKey ( j ) ? primeCount . get ( j ) + 1 : 1 ) ; value = value / j ; } } } int ans = 0 ; for ( Map . Entry < Integer , Integer > entry0 : primeCount . entrySet ( ) ) { for ( Map . Entry < Integer , Integer > entry1 : primeCount . entrySet ( ) ) { for ( Map . Entry < Integer , Integer > entry2 : primeCount . entrySet ( ) ) { if ( entry0 . getKey ( ) == entry1 . getKey ( ) ) continue ; if ( entry0 . getKey ( ) == entry2 . getKey ( ) ) continue ; if ( entry1 . getKey ( ) == entry2 . getKey ( ) ) continue ; if ( entry1 . getKey ( ) > entry2 . getKey ( ) ) continue ; if ( entry0 . getValue ( ) >= 2 && entry1 . getValue ( ) >= 4 && entry2 . getValue ( ) >= 4 ) ans ++ ; } } } for ( Map . Entry < Integer , Integer > entry0 : primeCount . entrySet ( ) ) { for ( Map . Entry < Integer , Integer > entry1 : primeCount . entrySet ( ) ) { if ( entry0 . getKey ( ) == entry1 . getKey ( ) ) continue ; if ( entry0 . getValue ( ) >= 4 && entry1 . getValue ( ) >= 14 ) ans ++ ; if ( entry0 . getValue ( ) >= 2 && entry1 . getValue ( ) >= 24 ) ans ++ ; } } for ( Integer count : primeCount . values ( ) ) { if ( count >= 74 ) ans ++ ; } 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: (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)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal) (decimal_integer_literal)))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (identifier))) (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 (while_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal))) body: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (ternary_expression condition: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) consequence: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (decimal_integer_literal)) alternative: (decimal_integer_literal))))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (identifier)))))))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (enhanced_for_statement type: (generic_type (scoped_type_identifier (type_identifier) (type_identifier)) (type_arguments (type_identifier) (type_identifier))) name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) body: (block (enhanced_for_statement type: (generic_type (scoped_type_identifier (type_identifier) (type_identifier)) (type_arguments (type_identifier) (type_identifier))) name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) body: (block (enhanced_for_statement type: (generic_type (scoped_type_identifier (type_identifier) (type_identifier)) (type_arguments (type_identifier) (type_identifier))) name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) body: (block (if_statement 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: (continue_statement)) (if_statement 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: (continue_statement)) (if_statement 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: (continue_statement)) (if_statement 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: (continue_statement)) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal)) right: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal))) right: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal)))) consequence: (expression_statement (update_expression (identifier)))))))))) (enhanced_for_statement type: (generic_type (scoped_type_identifier (type_identifier) (type_identifier)) (type_arguments (type_identifier) (type_identifier))) name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) body: (block (enhanced_for_statement type: (generic_type (scoped_type_identifier (type_identifier) (type_identifier)) (type_arguments (type_identifier) (type_identifier))) name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) body: (block (if_statement 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: (continue_statement)) (if_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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal)))) consequence: (expression_statement (update_expression (identifier)))) (if_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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal)))) consequence: (expression_statement (update_expression (identifier)))))))) (enhanced_for_statement type: (type_identifier) name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (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 N = sc . nextInt ( ) ; sc . close ( ) ; int [ ] P = new int [ 48 ] ; int over74 = 0 ; int over24 = 0 ; int over14 = 0 ; int over4 = 0 ; int over2 = 0 ; for ( int i = 2 ; i <= N ; i ++ ) { int x = i ; for ( int j = 2 ; j < Math . min ( N , 48 ) ; j ++ ) { while ( x % j == 0 ) { x /= j ; P [ j ] ++ ; } } } for ( int p : P ) { if ( p > 1 ) over2 ++ ; if ( p > 3 ) over4 ++ ; if ( p > 13 ) over14 ++ ; if ( p > 23 ) over24 ++ ; if ( p > 73 ) over74 ++ ; } int ans = 0 ; ans += over74 ; if ( over14 > 0 && over4 > 1 ) ans += over14 * ( over4 - 1 ) ; if ( over24 > 0 && over2 > 1 ) ans += over24 * ( over2 - 1 ) ; if ( over4 > 1 && over2 > 2 ) ans += ( over4 * ( over4 - 1 ) / 2 ) * ( over2 - 2 ) ; System . out . println ( ans ) ; }
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; sc . close ( ) ; int [ ] P = new int [ 48 ] ; int over74 = 0 ; int over24 = 0 ; int over14 = 0 ; int over4 = 0 ; int over2 = 0 ; for ( int i = 2 ; i <= N ; i ++ ) { int x = i ; for ( int j = 2 ; j < Math . min ( N , 48 ) ; j ++ ) { while ( x % j == 0 ) { x /= j ; P [ j ] ++ ; } } } for ( int p : P ) { if ( p > 1 ) over2 ++ ; if ( p > 3 ) over4 ++ ; if ( p > 13 ) over14 ++ ; if ( p > 23 ) over24 ++ ; if ( p > 73 ) over74 ++ ; } int ans = 0 ; ans += over74 ; if ( over14 > 0 && over4 > 1 ) ans += over14 * ( over4 - 1 ) ; if ( over24 > 0 && over2 > 1 ) ans += over24 * ( over2 - 1 ) ; if ( over4 > 1 && over2 > 2 ) ans += ( over4 * ( over4 - 1 ) / 2 ) * ( over2 - 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)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (decimal_integer_literal))))) (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))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (identifier))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (decimal_integer_literal)))) update: (update_expression (identifier)) body: (block (while_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal))) body: (block (expression_statement (assignment_expression left: (identifier) right: (identifier))) (expression_statement (update_expression (array_access array: (identifier) index: (identifier)))))))))) (enhanced_for_statement type: (integral_type) name: (identifier) value: (identifier) body: (block (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: (identifier) right: (decimal_integer_literal))) consequence: (expression_statement (update_expression (identifier)))) (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: (identifier) right: (decimal_integer_literal))) consequence: (expression_statement (update_expression (identifier)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (expression_statement (update_expression (identifier)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (expression_statement (assignment_expression left: (identifier) right: (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 (assignment_expression left: (identifier) right: (binary_expression left: (identifier) 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: (binary_expression left: (identifier) right: (decimal_integer_literal)))) consequence: (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) 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: (binary_expression left: (identifier) 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: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal)))) right: (decimal_integer_literal))) right: (parenthesized_expression (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 [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; boolean [ ] pr = new boolean [ N + 1 ] ; int count = 0 ; for ( int i = 2 ; i < N + 1 ; i ++ ) pr [ i ] = true ; for ( int i = 2 ; i < N + 1 ; i ++ ) { if ( pr [ i ] ) { count ++ ; for ( int j = 2 * i ; j < N + 1 ; j += i ) pr [ j ] = false ; } } final int C = count ; int [ ] prn = new int [ C ] ; int id = 0 ; for ( int i = 0 ; i < N + 1 ; i ++ ) { if ( pr [ i ] ) { int b = i ; while ( b <= N ) { prn [ id ] += N / b ; b *= i ; } id ++ ; } } int ans = 0 ; for ( int i = 0 ; i < C ; i ++ ) { for ( int j = 0 ; j < C ; j ++ ) { for ( int k = j + 1 ; k < C ; k ++ ) { if ( i != j && i != k && prn [ i ] >= 2 && prn [ j ] >= 4 && prn [ k ] >= 4 ) ans ++ ; } } } for ( int i = 0 ; i < C ; i ++ ) { for ( int j = 0 ; j < C ; j ++ ) { if ( i != j && prn [ i ] >= 2 && prn [ j ] >= 24 ) ans ++ ; } } for ( int i = 0 ; i < C ; i ++ ) { for ( int j = 0 ; j < C ; j ++ ) { if ( i != j && prn [ i ] >= 4 && prn [ j ] >= 14 ) ans ++ ; } } if ( C > 0 && prn [ 0 ] >= 74 ) ans ++ ; System . out . println ( ans ) ; }
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; boolean [ ] pr = new boolean [ N + 1 ] ; int count = 0 ; for ( int i = 2 ; i < N + 1 ; i ++ ) pr [ i ] = true ; for ( int i = 2 ; i < N + 1 ; i ++ ) { if ( pr [ i ] ) { count ++ ; for ( int j = 2 * i ; j < N + 1 ; j += i ) pr [ j ] = false ; } } final int C = count ; int [ ] prn = new int [ C ] ; int id = 0 ; for ( int i = 0 ; i < N + 1 ; i ++ ) { if ( pr [ i ] ) { int b = i ; while ( b <= N ) { prn [ id ] += N / b ; b *= i ; } id ++ ; } } int ans = 0 ; for ( int i = 0 ; i < C ; i ++ ) { for ( int j = 0 ; j < C ; j ++ ) { for ( int k = j + 1 ; k < C ; k ++ ) { if ( i != j && i != k && prn [ i ] >= 2 && prn [ j ] >= 4 && prn [ k ] >= 4 ) ans ++ ; } } } for ( int i = 0 ; i < C ; i ++ ) { for ( int j = 0 ; j < C ; j ++ ) { if ( i != j && prn [ i ] >= 2 && prn [ j ] >= 24 ) ans ++ ; } } for ( int i = 0 ; i < C ; i ++ ) { for ( int j = 0 ; j < C ; j ++ ) { if ( i != j && prn [ i ] >= 4 && prn [ j ] >= 14 ) ans ++ ; } } if ( C > 0 && prn [ 0 ] >= 74 ) ans ++ ; 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: (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: (identifier) right: (decimal_integer_literal)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal))) update: (update_expression (identifier)) body: (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: (identifier) right: (decimal_integer_literal))) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (array_access array: (identifier) index: (identifier))) consequence: (block (expression_statement (update_expression (identifier))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (decimal_integer_literal) right: (identifier)))) condition: (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal))) update: (assignment_expression left: (identifier) right: (identifier)) body: (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (false)))))))) (local_variable_declaration (modifiers) type: (integral_type) declarator: (variable_declarator name: (identifier) value: (identifier))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (identifier))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal))) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (array_access array: (identifier) index: (identifier))) consequence: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (identifier))) (while_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) body: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (binary_expression left: (identifier) right: (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (identifier))))) (expression_statement (update_expression (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: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (decimal_integer_literal)))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (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: (identifier) index: (identifier)) right: (decimal_integer_literal))) right: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal))) right: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal)))) consequence: (expression_statement (update_expression (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 (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal))) right: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal)))) consequence: (expression_statement (update_expression (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 (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal))) right: (binary_expression left: (array_access array: (identifier) index: (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: (array_access array: (identifier) index: (decimal_integer_literal)) right: (decimal_integer_literal)))) consequence: (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 [ ] ) { ConsoleScanner cin = new ConsoleScanner ( ) ; PrintWriter cout = new PrintWriter ( System . out ) ; solve ( cin , cout ) ; cout . flush ( ) ; }
public static void main ( String args [ ] ) { ConsoleScanner cin = new ConsoleScanner ( ) ; PrintWriter cout = new PrintWriter ( System . out ) ; solve ( cin , cout ) ; cout . flush ( ) ; }
(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)))) (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 name: (identifier) arguments: (argument_list (identifier) (identifier)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))
static long now ( ) { return System . currentTimeMillis ( ) ; }
static long now ( ) { return System . currentTimeMillis ( ) ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters) body: (block (return_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))
static void trace ( Object ... objects ) { assert null != System . out . format ( "trace:%s\n" , Arrays . deepToString ( objects ) ) ; }
static void trace ( Object ... objects ) { assert null != System . out . format ( " trace : % s \n " , Arrays . deepToString ( objects ) ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (spread_parameter (type_identifier) (variable_declarator name: (identifier)))) body: (block (assert_statement (binary_expression left: (null_literal) right: (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal) (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))))))))
private static void solve ( ConsoleScanner cin , PrintWriter cout ) { int n = cin . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < a . length ; i ++ ) a [ i ] = cin . nextInt ( ) ; long start = now ( ) ; long ans = solve ( n , a ) ; cout . println ( ans ) ; trace ( "elapsed" , now ( ) - start ) ; }
private static void solve ( ConsoleScanner cin , PrintWriter cout ) { int n = cin . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < a . length ; i ++ ) a [ i ] = cin . nextInt ( ) ; long start = now ( ) ; long ans = solve ( n , a ) ; cout . println ( ans ) ; trace ( " elapsed " , now ( ) - start ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) name: (identifier)) (formal_parameter type: (type_identifier) name: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (identifier))))) (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 object: (identifier) name: (identifier) arguments: (argument_list))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation name: (identifier) arguments: (argument_list (identifier) (identifier))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) (expression_statement (method_invocation name: (identifier) arguments: (argument_list (string_literal) (binary_expression left: (method_invocation name: (identifier) arguments: (argument_list)) right: (identifier)))))))
private static long solve ( int n , int [ ] a ) { long total = Arrays . stream ( a ) . mapToLong ( x -> x ) . sum ( ) ; long ans = Long . MAX_VALUE ; long s = 0 ; for ( int i = 0 ; i < n - 1 ; i ++ ) { s += a [ i ] ; ans = Math . min ( ans , Math . abs ( total - 2 * s ) ) ; } return ans ; }
private static long solve ( int n , int [ ] a ) { long total = Arrays . stream ( a ) . mapToLong ( x -> x ) . sum ( ) ; long ans = Long . MAX_VALUE ; long s = 0 ; for ( int i = 0 ; i < n - 1 ; i ++ ) { s += a [ i ] ; ans = Math . min ( ans , Math . abs ( total - 2 * s ) ) ; } return ans ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (array_type element: (integral_type) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) name: (identifier) arguments: (argument_list (lambda_expression parameters: (identifier) body: (identifier)))) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (field_access object: (identifier) field: (identifier)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal))) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (identifier) right: (array_access array: (identifier) index: (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (binary_expression left: (decimal_integer_literal) right: (identifier))))))))))) (return_statement (identifier))))
private static long solve ( Scanner scanner ) { int N = Integer . parseInt ( scanner . nextLine ( ) ) ; long [ ] a = lineToNums ( scanner . nextLine ( ) ) ; long sumAll = Arrays . stream ( a ) . sum ( ) ; long [ ] xSum = new long [ N ] ; long [ ] ySum = new long [ N ] ; xSum [ 0 ] = a [ 0 ] ; ySum [ 0 ] = sumAll - xSum [ 0 ] ; long ret = Math . abs ( xSum [ 0 ] - ySum [ 0 ] ) ; for ( int i = 1 ; i < N - 1 ; i ++ ) { xSum [ i ] = xSum [ i - 1 ] + a [ i ] ; ySum [ i ] = sumAll - xSum [ i ] ; ret = Math . min ( ret , Math . abs ( xSum [ i ] - ySum [ i ] ) ) ; } return ret ; }
private static long solve ( Scanner scanner ) { int N = Integer . parseInt ( scanner . nextLine ( ) ) ; long [ ] a = lineToNums ( scanner . nextLine ( ) ) ; long sumAll = Arrays . stream ( a ) . sum ( ) ; long [ ] xSum = new long [ N ] ; long [ ] ySum = new long [ N ] ; xSum [ 0 ] = a [ 0 ] ; ySum [ 0 ] = sumAll - xSum [ 0 ] ; long ret = Math . abs ( xSum [ 0 ] - ySum [ 0 ] ) ; for ( int i = 1 ; i < N - 1 ; i ++ ) { xSum [ i ] = xSum [ i - 1 ] + a [ i ] ; ySum [ i ] = sumAll - xSum [ i ] ; ret = Math . min ( ret , Math . abs ( xSum [ i ] - ySum [ i ] ) ) ; } return ret ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) 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 (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (method_invocation name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (identifier))))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (identifier))))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (array_access array: (identifier) index: (decimal_integer_literal)))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (binary_expression left: (identifier) right: (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 (binary_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (array_access array: (identifier) index: (decimal_integer_literal))))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (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: (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (array_access array: (identifier) index: (identifier))))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (binary_expression left: (identifier) right: (array_access array: (identifier) index: (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (identifier))))))))))) (return_statement (identifier))))
public static void main ( String [ ] args ) { System . out . println ( solve ( new Scanner ( System . in ) ) ) ; }
public static void main ( String [ ] args ) { System . out . println ( solve ( new Scanner ( System . in ) ) ) ; }
(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 (method_invocation name: (identifier) arguments: (argument_list (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))))))))
private static long [ ] lineToNums ( String line ) { String [ ] strNums = line . split ( " " ) ; long [ ] ret = new long [ strNums . length ] ; for ( int i = 0 ; i < strNums . length ; i ++ ) { ret [ i ] = Long . parseLong ( strNums [ i ] ) ; } return ret ; }
private static long [ ] lineToNums ( String line ) { String [ ] strNums = line . split ( " ▁ " ) ; long [ ] ret = new long [ strNums . length ] ; for ( int i = 0 ; i < strNums . length ; i ++ ) { ret [ i ] = Long . parseLong ( strNums [ i ] ) ; } return ret ; }
(method_declaration (modifiers) type: (array_type element: (integral_type) dimensions: (dimensions)) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) name: (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: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (field_access object: (identifier) field: (identifier)))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (field_access object: (identifier) field: (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 (array_access array: (identifier) index: (identifier)))))))) (return_statement (identifier))))
public static void main ( String [ ] args ) throws Exception { BufferedReader stdReader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String c = stdReader . readLine ( ) ; String vals = stdReader . readLine ( ) ; long [ ] ls = new long [ Integer . valueOf ( c ) ] ; String [ ] ss = vals . split ( " " ) ; long total = 0 ; long [ ] sunu = new long [ Integer . valueOf ( c ) ] ; for ( int i = 0 ; i < ls . length ; i ++ ) { long v = Long . valueOf ( ss [ i ] ) ; ls [ i ] = v ; total += v ; sunu [ i ] = total ; } long min = 0 ; for ( int i = 0 ; i < ls . length - 1 ; i ++ ) { long arai = total - sunu [ i ] ; long current = Math . abs ( arai - sunu [ i ] ) ; if ( i == 0 ) { min = current ; } min = Math . min ( min , current ) ; } System . out . println ( min ) ; }
public static void main ( String [ ] args ) throws Exception { BufferedReader stdReader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String c = stdReader . readLine ( ) ; String vals = stdReader . readLine ( ) ; long [ ] ls = new long [ Integer . valueOf ( c ) ] ; String [ ] ss = vals . split ( " ▁ " ) ; long total = 0 ; long [ ] sunu = new long [ Integer . valueOf ( c ) ] ; for ( int i = 0 ; i < ls . length ; i ++ ) { long v = Long . valueOf ( ss [ i ] ) ; ls [ i ] = v ; total += v ; sunu [ i ] = total ; } long min = 0 ; for ( int i = 0 ; i < ls . length - 1 ; i ++ ) { long arai = total - sunu [ i ] ; long current = Math . abs ( arai - sunu [ i ] ) ; if ( i == 0 ) { min = current ; } min = Math . min ( min , current ) ; } System . out . println ( min ) ; }
(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: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))))) (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: (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 (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (field_access object: (identifier) field: (identifier))) update: (update_expression (identifier)) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (identifier)))))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier))) (expression_statement (assignment_expression left: (identifier) right: (identifier))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (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: (field_access object: (identifier) field: (identifier)) right: (decimal_integer_literal))) update: (update_expression (identifier)) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (array_access array: (identifier) index: (identifier))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (array_access array: (identifier) index: (identifier))))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (identifier))))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier))))))
public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; MyReader in = new MyReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskC solver = new TaskC ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }
public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; MyReader in = new MyReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskC solver = new TaskC ( ) ; 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 input ( ) { Scanner scan = new Scanner ( System . in ) ; N = scan . nextInt ( ) ; a = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { a [ i ] = scan . nextInt ( ) ; } }
public static void input ( ) { Scanner scan = new Scanner ( System . in ) ; N = scan . nextInt ( ) ; a = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { a [ i ] = scan . nextInt ( ) ; } }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (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))))) (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))))))))
public static void main ( String args [ ] ) { input ( ) ; x = a [ 0 ] ; for ( int i = 1 ; i < N ; i ++ ) { y += a [ i ] ; } ans = Math . abs ( x - y ) ; for ( int i = 1 ; i < N - 1 ; i ++ ) { x += a [ i ] ; y -= a [ i ] ; ans = Math . min ( Math . abs ( x - y ) , ans ) ; } System . out . println ( ans ) ; }
public static void main ( String args [ ] ) { input ( ) ; x = a [ 0 ] ; for ( int i = 1 ; i < N ; i ++ ) { y += a [ i ] ; } ans = Math . abs ( x - y ) ; for ( int i = 1 ; i < N - 1 ; i ++ ) { x += a [ i ] ; y -= a [ i ] ; ans = Math . min ( Math . abs ( x - y ) , ans ) ; } System . out . println ( ans ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) name: (identifier) dimensions: (dimensions))) body: (block (expression_statement (method_invocation name: (identifier) arguments: (argument_list))) (expression_statement (assignment_expression left: (identifier) right: (array_access array: (identifier) index: (decimal_integer_literal)))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (identifier) right: (array_access array: (identifier) index: (identifier)))))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (identifier)))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal))) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (identifier) right: (array_access array: (identifier) index: (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (array_access array: (identifier) index: (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 (binary_expression left: (identifier) right: (identifier)))) (identifier))))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier))))))
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int t = sc . nextInt ( ) ; int weight = 0 ; int output = 0 ; for ( int i = 0 ; i < n ; i ++ ) { weight += sc . nextInt ( ) ; if ( weight >= s && weight <= t ) { output ++ ; } } System . out . println ( output ) ; }
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int t = sc . nextInt ( ) ; int weight = 0 ; int output = 0 ; for ( int i = 0 ; i < n ; i ++ ) { weight += sc . nextInt ( ) ; if ( weight >= s && weight <= t ) { output ++ ; } } 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: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (identifier) right: (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 (update_expression (identifier))))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier))))))
static int nextInt ( ) { return Integer . parseInt ( sc . next ( ) ) ; }
static int nextInt ( ) { return Integer . parseInt ( sc . next ( ) ) ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters) body: (block (return_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))))
static int [ ] nextIntArray ( int n ) { return IntStream . range ( 0 , n ) . map ( i -> nextInt ( ) ) . toArray ( ) ; }
static int [ ] nextIntArray ( int n ) { return IntStream . range ( 0 , n ) . map ( i -> nextInt ( ) ) . toArray ( ) ; }
(method_declaration (modifiers) type: (array_type element: (integral_type) dimensions: (dimensions)) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier))) body: (block (return_statement (method_invocation object: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal) (identifier))) name: (identifier) arguments: (argument_list (lambda_expression parameters: (identifier) body: (method_invocation name: (identifier) arguments: (argument_list))))) name: (identifier) arguments: (argument_list)))))
static int max ( int ... ar ) { Arrays . sort ( ar ) ; return ar [ ar . length - 1 ] ; }
static int max ( int ... ar ) { Arrays . sort ( ar ) ; return ar [ ar . length - 1 ] ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (spread_parameter (integral_type) (variable_declarator name: (identifier)))) body: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) (return_statement (array_access array: (identifier) index: (binary_expression left: (field_access object: (identifier) field: (identifier)) right: (decimal_integer_literal))))))
static int min ( int ... ar ) { Arrays . sort ( ar ) ; return ar [ 0 ] ; }
static int min ( int ... ar ) { Arrays . sort ( ar ) ; return ar [ 0 ] ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (spread_parameter (integral_type) (variable_declarator name: (identifier)))) body: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) (return_statement (array_access array: (identifier) index: (decimal_integer_literal)))))
public static void main ( String [ ] args ) { int n = nextInt ( ) , s = nextInt ( ) , t = nextInt ( ) ; int w = nextInt ( ) ; int ans = 0 ; if ( s <= w && w <= t ) { ans ++ ; } for ( int i = 0 ; i < n - 1 ; i ++ ) { w += nextInt ( ) ; if ( s <= w && w <= t ) { ans ++ ; } } out . println ( ans ) ; }
public static void main ( String [ ] args ) { int n = nextInt ( ) , s = nextInt ( ) , t = nextInt ( ) ; int w = nextInt ( ) ; int ans = 0 ; if ( s <= w && w <= t ) { ans ++ ; } for ( int i = 0 ; i < n - 1 ; i ++ ) { w += nextInt ( ) ; if ( s <= w && w <= t ) { 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: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation name: (identifier) arguments: (argument_list))) declarator: (variable_declarator name: (identifier) value: (method_invocation name: (identifier) arguments: (argument_list))) declarator: (variable_declarator name: (identifier) value: (method_invocation name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (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 (update_expression (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 (expression_statement (assignment_expression left: (identifier) right: (method_invocation 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 (update_expression (identifier))))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))))
public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; Task solver = new Task ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }
public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; Task solver = new Task ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (field_access object: (identifier) field: (identifier)))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (field_access object: (identifier) field: (identifier)))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (identifier))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (identifier))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal) (identifier) (identifier)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))
public static void main ( String [ ] args ) { MyScanner sc = new MyScanner ( ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int ans = 0 ; int g [ ] = new int [ a ] ; g [ 0 ] = sc . nextInt ( ) ; if ( b <= g [ 0 ] && g [ 0 ] <= c ) { ans ++ ; } for ( int i = 1 ; i < a ; i ++ ) { g [ i ] = g [ i - 1 ] + sc . nextInt ( ) ; if ( b <= g [ i ] && g [ i ] <= c ) { ans ++ ; } } System . out . println ( ans ) ; }
public static void main ( String [ ] args ) { MyScanner sc = new MyScanner ( ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int ans = 0 ; int g [ ] = new int [ a ] ; g [ 0 ] = sc . nextInt ( ) ; if ( b <= g [ 0 ] && g [ 0 ] <= c ) { ans ++ ; } for ( int i = 1 ; i < a ; i ++ ) { g [ i ] = g [ i - 1 ] + sc . nextInt ( ) ; if ( b <= g [ i ] && g [ i ] <= c ) { ans ++ ; } } System . out . println ( ans ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) dimensions: (dimensions) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (identifier))))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (array_access array: (identifier) index: (decimal_integer_literal))) right: (binary_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (identifier)))) consequence: (block (expression_statement (update_expression (identifier))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (array_access array: (identifier) index: (identifier))) right: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier)))) consequence: (block (expression_statement (update_expression (identifier))))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier))))))
static int l_min ( int [ ] a ) { Arrays . sort ( a ) ; return a [ 0 ] ; }
static int l_min ( int [ ] a ) { Arrays . sort ( a ) ; return a [ 0 ] ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (integral_type) dimensions: (dimensions)) name: (identifier))) body: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) (return_statement (array_access array: (identifier) index: (decimal_integer_literal)))))
static int l_max ( int [ ] a ) { int l = a . length ; Arrays . sort ( a ) ; return a [ l - 1 ] ; }
static int l_max ( int [ ] a ) { int l = a . length ; Arrays . sort ( a ) ; return a [ l - 1 ] ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (integral_type) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (field_access object: (identifier) field: (identifier)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) (return_statement (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))))))
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int t = sc . nextInt ( ) ; int w = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 1 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } sc . close ( ) ; int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { w += a [ i ] ; if ( s <= w && w <= t ) { ans ++ ; } } System . out . println ( ans ) ; }
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int t = sc . nextInt ( ) ; int w = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 1 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } sc . close ( ) ; int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { w += a [ i ] ; if ( s <= w && w <= t ) { ans ++ ; } } 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: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (identifier))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (identifier) right: (array_access array: (identifier) index: (identifier)))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (binary_expression left: (identifier) right: (identifier)))) 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 N = sc . nextInt ( ) ; int X = sc . nextInt ( ) ; w = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { w [ i ] = sc . nextInt ( ) ; } a = N / 2 ; int ans = 0 ; pack ( 0 , a , left , 0 ) ; pack ( a , N , right , 0 ) ; for ( int c : left . keySet ( ) ) { if ( right . containsKey ( X - c ) ) { ans += left . get ( c ) * right . get ( X - c ) ; } } System . out . println ( ans ) ; }
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int X = sc . nextInt ( ) ; w = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { w [ i ] = sc . nextInt ( ) ; } a = N / 2 ; int ans = 0 ; pack ( 0 , a , left , 0 ) ; pack ( a , N , right , 0 ) ; for ( int c : left . keySet ( ) ) { if ( right . containsKey ( X - c ) ) { ans += left . get ( c ) * right . get ( X - c ) ; } } 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)))) (expression_statement (assignment_expression left: (identifier) right: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (identifier))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (expression_statement (method_invocation name: (identifier) arguments: (argument_list (decimal_integer_literal) (identifier) (identifier) (decimal_integer_literal)))) (expression_statement (method_invocation name: (identifier) arguments: (argument_list (identifier) (identifier) (identifier) (decimal_integer_literal)))) (enhanced_for_statement type: (integral_type) name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) body: (block (if_statement condition: (parenthesized_expression (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (identifier))))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (identifier))))))))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier))))))
static void pack ( int s , int g , HashMap < Integer , Integer > map , int W ) { if ( s == g ) { if ( map . containsKey ( W ) ) { map . put ( W , map . get ( W ) + 1 ) ; } else { map . put ( W , 1 ) ; } } else { pack ( s + 1 , g , map , W ) ; pack ( s + 1 , g , map , W + w [ s ] ) ; } }
static void pack ( int s , int g , HashMap < Integer , Integer > map , int W ) { if ( s == g ) { if ( map . containsKey ( W ) ) { map . put ( W , map . get ( W ) + 1 ) ; } else { map . put ( W , 1 ) ; } } else { pack ( s + 1 , g , map , W ) ; pack ( s + 1 , g , map , W + w [ s ] ) ; } }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (generic_type (type_identifier) (type_arguments (type_identifier) (type_identifier))) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (if_statement condition: (parenthesized_expression (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) consequence: (block (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))) right: (decimal_integer_literal)))))) alternative: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (decimal_integer_literal))))))) alternative: (block (expression_statement (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)) (identifier) (identifier) (identifier)))) (expression_statement (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)) (identifier) (identifier) (binary_expression left: (identifier) right: (array_access array: (identifier) index: (identifier))))))))))
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long x = sc . nextLong ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = sc . nextInt ( ) ; Arrays . sort ( a ) ; HashMap < Long , Long > map1 = new HashMap < > ( ) ; HashMap < Long , Long > map2 = new HashMap < > ( ) ; int zen = n / 2 ; int c = 1 ; for ( int i = 0 ; i < zen ; i ++ ) c *= 2 ; for ( int i = 0 ; i < c ; i ++ ) { int d = i ; long v = 0 ; for ( int j = 0 ; j < zen ; j ++ ) { if ( d % 2 == 0 ) v += a [ j ] ; d /= 2 ; } if ( map1 . containsKey ( v ) ) map1 . put ( v , map1 . get ( v ) + 1 ) ; else map1 . put ( v , 1L ) ; } c = 1 ; for ( int i = zen ; i < n ; i ++ ) c *= 2 ; for ( int i = 0 ; i < c ; i ++ ) { int d = i ; long v = 0 ; for ( int j = zen ; j < n ; j ++ ) { if ( d % 2 == 0 ) v += a [ j ] ; d /= 2 ; } if ( map2 . containsKey ( v ) ) map2 . put ( v , map2 . get ( v ) + 1 ) ; else map2 . put ( v , 1L ) ; } long res = 0 ; Set < Long > set = map1 . keySet ( ) ; for ( long lo : set ) { if ( map2 . containsKey ( x - lo ) ) { res += map1 . get ( lo ) * map2 . get ( x - lo ) ; } } System . out . println ( res ) ; }
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long x = sc . nextLong ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = sc . nextInt ( ) ; Arrays . sort ( a ) ; HashMap < Long , Long > map1 = new HashMap < > ( ) ; HashMap < Long , Long > map2 = new HashMap < > ( ) ; int zen = n / 2 ; int c = 1 ; for ( int i = 0 ; i < zen ; i ++ ) c *= 2 ; for ( int i = 0 ; i < c ; i ++ ) { int d = i ; long v = 0 ; for ( int j = 0 ; j < zen ; j ++ ) { if ( d % 2 == 0 ) v += a [ j ] ; d /= 2 ; } if ( map1 . containsKey ( v ) ) map1 . put ( v , map1 . get ( v ) + 1 ) ; else map1 . put ( v , 1L ) ; } c = 1 ; for ( int i = zen ; i < n ; i ++ ) c *= 2 ; for ( int i = 0 ; i < c ; i ++ ) { int d = i ; long v = 0 ; for ( int j = zen ; j < n ; j ++ ) { if ( d % 2 == 0 ) v += a [ j ] ; d /= 2 ; } if ( map2 . containsKey ( v ) ) map2 . put ( v , map2 . get ( v ) + 1 ) ; else map2 . put ( v , 1L ) ; } long res = 0 ; Set < Long > set = map1 . keySet ( ) ; for ( long lo : set ) { if ( map2 . containsKey ( x - lo ) ) { res += map1 . get ( lo ) * map2 . get ( x - lo ) ; } } 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)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (identifier))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (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 (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)))) (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: (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))) (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: (identifier) right: (decimal_integer_literal)))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (identifier))) (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: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal))) consequence: (expression_statement (assignment_expression left: (identifier) right: (array_access array: (identifier) index: (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))))) (if_statement condition: (parenthesized_expression (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) consequence: (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))) right: (decimal_integer_literal))))) alternative: (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (decimal_integer_literal))))))) (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: (identifier))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (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 (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (identifier))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (identifier))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal))) consequence: (expression_statement (assignment_expression left: (identifier) right: (array_access array: (identifier) index: (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))))) (if_statement condition: (parenthesized_expression (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) consequence: (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))) right: (decimal_integer_literal))))) alternative: (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (decimal_integer_literal))))))) (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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (enhanced_for_statement type: (integral_type) name: (identifier) value: (identifier) body: (block (if_statement condition: (parenthesized_expression (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (identifier))))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (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 ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; long x = scan . nextInt ( ) ; long [ ] w = new long [ n ] ; for ( int i = 0 ; i < n ; ++ i ) w [ i ] = scan . nextInt ( ) ; int m = n / 2 ; long [ ] f = new long [ 1 << m ] ; long [ ] s = new long [ 1 << n - m ] ; for ( int i = 0 ; i < 1 << m ; ++ i ) for ( int j = 0 ; j < m ; ++ j ) if ( ( i & 1 << j ) != 0 ) f [ i ] += w [ j ] ; for ( int i = 0 ; i < 1 << n - m ; ++ i ) for ( int j = 0 ; j < n - m ; ++ j ) if ( ( i & 1 << j ) != 0 ) s [ i ] += w [ m + j ] ; Map < Long , Integer > hs = new HashMap < Long , Integer > ( ) ; for ( long ss : s ) if ( ! hs . containsKey ( ss ) ) hs . put ( ss , 1 ) ; else hs . put ( ss , hs . get ( ss ) + 1 ) ; long total = 0 ; for ( long ff : f ) if ( hs . containsKey ( x - ff ) ) total += hs . get ( x - ff ) ; System . out . println ( total ) ; }
public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; long x = scan . nextInt ( ) ; long [ ] w = new long [ n ] ; for ( int i = 0 ; i < n ; ++ i ) w [ i ] = scan . nextInt ( ) ; int m = n / 2 ; long [ ] f = new long [ 1 << m ] ; long [ ] s = new long [ 1 << n - m ] ; for ( int i = 0 ; i < 1 << m ; ++ i ) for ( int j = 0 ; j < m ; ++ j ) if ( ( i & 1 << j ) != 0 ) f [ i ] += w [ j ] ; for ( int i = 0 ; i < 1 << n - m ; ++ i ) for ( int j = 0 ; j < n - m ; ++ j ) if ( ( i & 1 << j ) != 0 ) s [ i ] += w [ m + j ] ; Map < Long , Integer > hs = new HashMap < Long , Integer > ( ) ; for ( long ss : s ) if ( ! hs . containsKey ( ss ) ) hs . put ( ss , 1 ) ; else hs . put ( ss , hs . get ( ss ) + 1 ) ; long total = 0 ; for ( long ff : f ) if ( hs . containsKey ( x - ff ) ) total += hs . get ( x - ff ) ; 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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (identifier))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (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: (binary_expression left: (identifier) right: (decimal_integer_literal)))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (binary_expression left: (decimal_integer_literal) right: (identifier)))))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (binary_expression left: (decimal_integer_literal) right: (binary_expression left: (identifier) right: (identifier))))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (binary_expression left: (decimal_integer_literal) 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: (if_statement condition: (parenthesized_expression (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (binary_expression left: (decimal_integer_literal) right: (identifier)))) right: (decimal_integer_literal))) consequence: (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (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: (decimal_integer_literal) right: (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: (binary_expression left: (identifier) right: (identifier))) update: (update_expression (identifier)) body: (if_statement condition: (parenthesized_expression (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (binary_expression left: (decimal_integer_literal) right: (identifier)))) right: (decimal_integer_literal))) consequence: (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (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 (type_identifier) (type_identifier))) arguments: (argument_list)))) (enhanced_for_statement type: (integral_type) name: (identifier) value: (identifier) body: (if_statement condition: (parenthesized_expression (unary_expression operand: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))) consequence: (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (decimal_integer_literal)))) alternative: (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))) right: (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: (identifier) body: (if_statement condition: (parenthesized_expression (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (identifier))))) consequence: (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (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 ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int X = sc . nextInt ( ) ; int [ ] w = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) w [ i ] = sc . nextInt ( ) ; long ans = help ( w , X ) ; System . out . println ( ans ) ; }
public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int X = sc . nextInt ( ) ; int [ ] w = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) w [ i ] = sc . nextInt ( ) ; long ans = help ( w , X ) ; System . out . println ( ans ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) (throws (type_identifier)) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (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: (method_invocation name: (identifier) arguments: (argument_list (identifier) (identifier))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier))))))
static long help ( int [ ] w , int X ) { int n = w . length ; if ( n == 1 ) { return w [ 0 ] == X ? 1 : 0 ; } int ans = 0 ; int p = n / 2 ; HashMap < Integer , Integer > dic = getDic ( Arrays . copyOfRange ( w , p , n ) ) ; int [ ] first = Arrays . copyOfRange ( w , 0 , p ) ; for ( int i = 0 ; i < ( 1 << p ) ; i ++ ) { int cur = getSum ( first , i ) ; ans += dic . getOrDefault ( X - cur , 0 ) ; } return ans ; }
static long help ( int [ ] w , int X ) { int n = w . length ; if ( n == 1 ) { return w [ 0 ] == X ? 1 : 0 ; } int ans = 0 ; int p = n / 2 ; HashMap < Integer , Integer > dic = getDic ( Arrays . copyOfRange ( w , p , n ) ) ; int [ ] first = Arrays . copyOfRange ( w , 0 , p ) ; for ( int i = 0 ; i < ( 1 << p ) ; i ++ ) { int cur = getSum ( first , i ) ; ans += dic . getOrDefault ( X - cur , 0 ) ; } return ans ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (integral_type) dimensions: (dimensions)) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (field_access object: (identifier) field: (identifier)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (return_statement (ternary_expression condition: (binary_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (identifier)) consequence: (decimal_integer_literal) alternative: (decimal_integer_literal))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (decimal_integer_literal)))) (local_variable_declaration type: (generic_type (type_identifier) (type_arguments (type_identifier) (type_identifier))) declarator: (variable_declarator name: (identifier) value: (method_invocation name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (identifier) (identifier))))))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (decimal_integer_literal) (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: (parenthesized_expression (binary_expression left: (decimal_integer_literal) right: (identifier)))) update: (update_expression (identifier)) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation name: (identifier) arguments: (argument_list (identifier) (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (identifier)) (decimal_integer_literal))))))) (return_statement (identifier))))
static HashMap < Integer , Integer > getDic ( int [ ] a ) { int q = a . length ; HashMap < Integer , Integer > ans = new HashMap < > ( ) ; for ( int i = 0 ; i < ( 1 << q ) ; i ++ ) { int cur = getSum ( a , i ) ; int val = ans . getOrDefault ( cur , 0 ) + 1 ; ans . put ( cur , val ) ; } return ans ; }
static HashMap < Integer , Integer > getDic ( int [ ] a ) { int q = a . length ; HashMap < Integer , Integer > ans = new HashMap < > ( ) ; for ( int i = 0 ; i < ( 1 << q ) ; i ++ ) { int cur = getSum ( a , i ) ; int val = ans . getOrDefault ( cur , 0 ) + 1 ; ans . put ( cur , val ) ; } return ans ; }
(method_declaration (modifiers) type: (generic_type (type_identifier) (type_arguments (type_identifier) (type_identifier))) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (integral_type) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (field_access object: (identifier) field: (identifier)))) (local_variable_declaration type: (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: (parenthesized_expression (binary_expression left: (decimal_integer_literal) right: (identifier)))) update: (update_expression (identifier)) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation name: (identifier) arguments: (argument_list (identifier) (identifier))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (decimal_integer_literal))) right: (decimal_integer_literal)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (identifier)))))) (return_statement (identifier))))
static int getSum ( int [ ] a , int mask ) { int sum = 0 ; for ( int i = 0 ; i < a . length ; i ++ ) { if ( ( mask & ( 1 << i ) ) > 0 ) sum += a [ i ] ; } return sum ; }
static int getSum ( int [ ] a , int mask ) { int sum = 0 ; for ( int i = 0 ; i < a . length ; i ++ ) { if ( ( mask & ( 1 << i ) ) > 0 ) sum += a [ i ] ; } return sum ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (integral_type) dimensions: (dimensions)) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (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 (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (parenthesized_expression (binary_expression left: (decimal_integer_literal) right: (identifier))))) right: (decimal_integer_literal))) consequence: (expression_statement (assignment_expression left: (identifier) right: (array_access array: (identifier) index: (identifier))))))) (return_statement (identifier))))
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int num = sc . nextInt ( ) * 2 ; long length [ ] = new long [ num ] ; for ( int i = 0 ; i < num ; i ++ ) { length [ i ] = sc . nextLong ( ) ; } Arrays . sort ( length ) ; long ans = 0 ; for ( int i = 0 ; i < num ; i += 2 ) { ans += length [ i ] ; } System . out . println ( ans ) ; }
public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int num = sc . nextInt ( ) * 2 ; long length [ ] = new long [ num ] ; for ( int i = 0 ; i < num ; i ++ ) { length [ i ] = sc . nextLong ( ) ; } Arrays . sort ( length ) ; long ans = 0 ; for ( int i = 0 ; i < num ; i += 2 ) { ans += length [ i ] ; } System . out . println ( ans ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) dimensions: (dimensions) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (identifier))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (assignment_expression left: (identifier) right: (decimal_integer_literal)) body: (block (expression_statement (assignment_expression left: (identifier) right: (array_access array: (identifier) index: (identifier)))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier))))))