import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { try { Scanner sc = new Scanner ( System . in ) ; int n , ans = 0 ; n = Integer . parseInt ( sc . next ( ) ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = Integer . parseInt ( sc . next ( ) ) ; if ( a [ i ] == 2 || a [ i ] == 4 || a [ i ] == 8 ) { ans ++ ; } else if ( a [ i ] == 5 ) { ans = ans + 2 ; } else if ( a [ i ] == 6 ) { ans = ans + 3 ; } } System . out . println ( ans ) ; } catch ( Exception e ) { System . out . println ( " out " ) ; } } }


_ , a = open ( 0 ) ; print ( sum ( int ( '301012' [ int ( i ) % 6 ] ) for i in a . split ( ) ) ) NEW_LINE


n = int ( input ( ) ) NEW_LINE flowers = [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE petals = 0 NEW_LINE for i in flowers : NEW_LINE INDENT if i == 6 : NEW_LINE INDENT petals += 3 NEW_LINE DEDENT elif i == 5 : NEW_LINE INDENT petals += 2 NEW_LINE DEDENT elif i == 8 or i == 4 or i == 2 : NEW_LINE INDENT petals += 1 NEW_LINE DEDENT DEDENT print ( petals ) NEW_LINE


from statistics import mean , median , variance , stdev NEW_LINE import sys NEW_LINE import math NEW_LINE import fractions NEW_LINE def j ( a ) : NEW_LINE INDENT if a == 1 : print ( " YES " ) NEW_LINE else : print ( " NO " ) NEW_LINE DEDENT def ct ( x , y ) : NEW_LINE INDENT if ( x > y ) : print ( " " ) NEW_LINE elif ( x < y ) : print ( " " ) NEW_LINE else : print ( " " ) NEW_LINE DEDENT n = int ( input ( ) ) NEW_LINE a = [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE s = 0 NEW_LINE for i in range ( n ) : NEW_LINE INDENT while not ( ( a [ i ] % 3 == 0 or a [ i ] % 3 == 1 ) and a [ i ] % 2 ) : NEW_LINE INDENT a [ i ] -= 1 NEW_LINE s += 1 NEW_LINE DEDENT DEDENT print ( s ) NEW_LINE


n = int ( input ( ) ) NEW_LINE c = [ 0 , 1 , 0 , 1 , 2 , 3 , 0 , 1 , 0 ] NEW_LINE ans = 0 NEW_LINE for b in map ( int , input ( ) . split ( ) ) : NEW_LINE INDENT ans += c [ b - 1 ] NEW_LINE DEDENT print ( ans ) NEW_LINE


import java . io . PrintWriter ; import java . util . * ; public class Main { static final long MOD = 1000000007 ; static class Comb { int a ; int b ; long pre ; public Comb ( int a ) { this . a = a ; } public long get ( int b ) { if ( b == 0 ) pre = 1 ; else if ( b == 1 ) pre = a ; this . b = b + 1 ; return pre ; } public long getNext ( ) { long ans = ( pre * ( a - b + 1 ) ) % MOD ; ans = ( ans * rev ( b ) ) % MOD ; b ++ ; pre = ans ; return ans ; } long rev ( long a ) { return pow ( a , MOD - 2 ) ; } long pow ( long a , long b ) { long ans = 1 ; while ( b > 0 ) { if ( ( b & 1 ) != 0 ) { ans = ( ans * a ) % MOD ; } a = ( a * a ) % MOD ; b >>= 1 ; } return ans ; } } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; PrintWriter pw = new PrintWriter ( System . out ) ; int N = sc . nextInt ( ) ; int [ ] ra = new int [ N ] ; int L = 0 ; Arrays . fill ( ra , - 1 ) ; for ( int i = 0 ; i < N + 1 ; i ++ ) { int a = sc . nextInt ( ) - 1 ; if ( ra [ a ] < 0 ) ra [ a ] = i ; else L = ra [ a ] + ( N + 1 - i - 1 ) ; } Comb comb1 = new Comb ( N + 1 ) ; Comb comb2 = new Comb ( L ) ; for ( int i = 0 ; i < N + 1 ; i ++ ) { if ( i == 0 ) pw . println ( ( comb1 . get ( i + 1 ) - comb2 . get ( i ) + MOD ) % MOD ) ; else pw . println ( ( comb1 . getNext ( ) - comb2 . getNext ( ) + MOD ) % MOD ) ; } sc . close ( ) ; pw . close ( ) ; } }

MOD = 10 ** 9 + 7 NEW_LINE def egcd ( a , b ) : NEW_LINE INDENT if a == 0 : NEW_LINE INDENT return ( b , 0 , 1 ) NEW_LINE DEDENT else : NEW_LINE INDENT g , y , x = egcd ( b % a , a ) NEW_LINE return ( g , x - ( b // a ) * y , y ) NEW_LINE DEDENT DEDENT def modinv ( a , m ) : NEW_LINE INDENT g , x , y = egcd ( a , m ) NEW_LINE if g != 1 : NEW_LINE INDENT raise Exception ( ' modular ▁ inverse ▁ does ▁ not ▁ exist ' ) NEW_LINE DEDENT else : NEW_LINE INDENT return x % m NEW_LINE DEDENT DEDENT n = int ( input ( ) ) NEW_LINE L = n + 1 NEW_LINE inv = [ None ] * ( n + 2 ) NEW_LINE for i , a in enumerate ( map ( int , input ( ) . split ( ) ) ) : NEW_LINE INDENT if inv [ a - 1 ] is None : NEW_LINE INDENT inv [ a - 1 ] = i NEW_LINE DEDENT else : NEW_LINE INDENT m = n - i + inv [ a - 1 ] NEW_LINE break NEW_LINE DEDENT DEDENT b = 1 NEW_LINE for i in range ( 2 , m + 1 ) : NEW_LINE INDENT b *= i NEW_LINE b %= MOD NEW_LINE DEDENT a = b NEW_LINE for i in range ( m + 1 , L + 1 ) : NEW_LINE INDENT a *= i NEW_LINE a %= MOD NEW_LINE DEDENT ik = modinv ( a , MOD ) NEW_LINE for i in reversed ( range ( L + 1 ) ) : NEW_LINE INDENT inv [ i ] = ik NEW_LINE ik *= i NEW_LINE ik %= MOD NEW_LINE DEDENT r1 = [ ( a * inv [ k ] * inv [ L - k ] ) % MOD for k in range ( L // 2 + 1 ) ] NEW_LINE r2 = [ ( b * inv [ k ] * inv [ m - k ] ) % MOD for k in range ( m // 2 + 1 ) ] NEW_LINE for k in range ( 1 , m + 2 ) : NEW_LINE INDENT print ( ( r1 [ min ( k , L - k ) ] - r2 [ min ( k - 1 , m - k + 1 ) ] ) % MOD ) NEW_LINE DEDENT for k in range ( m + 2 , n + 2 ) : NEW_LINE INDENT print ( r1 [ min ( k , L - k ) ] % MOD ) NEW_LINE DEDENT


ai = lambda : list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE ai_ = lambda : [ int ( x ) - 1 for x in input ( ) . split ( ) ] NEW_LINE n = int ( input ( ) ) NEW_LINE a = ai ( ) NEW_LINE dup = sum ( a ) - n * ( n + 1 ) // 2 NEW_LINE ant = a . index ( dup ) NEW_LINE post = a [ : : - 1 ] . index ( dup ) NEW_LINE mod = 10 ** 9 + 7 NEW_LINE factorial = [ 1 ] NEW_LINE for i in range ( 1 , n + 2 ) : NEW_LINE INDENT factorial . append ( factorial [ i - 1 ] * i % mod ) NEW_LINE DEDENT inverse = [ 0 ] * ( n + 2 ) NEW_LINE inverse [ n + 2 - 1 ] = pow ( factorial [ n + 2 - 1 ] , mod - 2 , mod ) NEW_LINE for i in range ( n + 2 - 2 , - 1 , - 1 ) : NEW_LINE INDENT inverse [ i ] = inverse [ i + 1 ] * ( i + 1 ) % mod NEW_LINE DEDENT def nCr ( n , r ) : NEW_LINE INDENT if n < r or n == 0 or r == 0 : NEW_LINE INDENT return 0 NEW_LINE DEDENT return factorial [ n ] * inverse [ r ] * inverse [ n - r ] % mod NEW_LINE DEDENT for k in range ( 1 , n + 2 ) : NEW_LINE INDENT if k == 1 : NEW_LINE INDENT print ( n ) NEW_LINE DEDENT else : NEW_LINE INDENT ans = nCr ( n + 1 , k ) - nCr ( ant + post , k - 1 ) NEW_LINE if ans < 0 : NEW_LINE INDENT ans += mod NEW_LINE DEDENT print ( ans ) NEW_LINE DEDENT DEDENT


MOD = 10 ** 9 + 7 NEW_LINE n = int ( input ( ) ) NEW_LINE A = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE fact = { i : None for i in range ( n + 2 ) } NEW_LINE inverse = { i : None for i in range ( 1 , n + 2 ) } NEW_LINE fact_inverse = { i : None for i in range ( n + 2 ) } NEW_LINE fact [ 0 ] = fact [ 1 ] = 1 NEW_LINE fact_inverse [ 0 ] = fact_inverse [ 1 ] = 1 NEW_LINE inverse [ 1 ] = 1 NEW_LINE for i in range ( 2 , n + 2 ) : NEW_LINE INDENT fact [ i ] = i * fact [ i - 1 ] % MOD NEW_LINE inverse [ i ] = - inverse [ MOD % i ] * ( MOD // i ) % MOD NEW_LINE fact_inverse [ i ] = inverse [ i ] * fact_inverse [ i - 1 ] % MOD NEW_LINE DEDENT def combination ( n , r ) : NEW_LINE INDENT if n < r or n < 0 or r < 0 : NEW_LINE INDENT return 0 NEW_LINE DEDENT else : NEW_LINE INDENT return fact [ n ] * ( fact_inverse [ r ] * fact_inverse [ n - r ] % MOD ) % MOD NEW_LINE DEDENT DEDENT dup_num = sum ( A ) - n * ( n + 1 ) // 2 NEW_LINE dup_idx = [ ] NEW_LINE for i , a in enumerate ( A ) : NEW_LINE INDENT if a == dup_num : NEW_LINE INDENT dup_idx . append ( i ) NEW_LINE DEDENT DEDENT left , right = dup_idx [ 0 ] , dup_idx [ 1 ] NEW_LINE for k in range ( 1 , n + 2 ) : NEW_LINE INDENT print ( ( combination ( n + 1 , k ) - combination ( n + 1 - ( right - left + 1 ) , k - 1 ) ) % MOD ) NEW_LINE DEDENT


from collections import Counter NEW_LINE N = int ( input ( ) ) NEW_LINE A = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE MOD = 10 ** 9 + 7 NEW_LINE ctr = Counter ( A ) NEW_LINE doub = ctr . most_common ( ) [ 0 ] [ 0 ] NEW_LINE i1 = A . index ( doub ) NEW_LINE i2 = N - A [ : : - 1 ] . index ( doub ) NEW_LINE l = N - ( i2 - i1 ) NEW_LINE fac = [ 1 , 1 ] + [ 0 ] * N NEW_LINE finv = [ 1 , 1 ] + [ 0 ] * N NEW_LINE inv = [ 0 , 1 ] + [ 0 ] * N NEW_LINE for i in range ( 2 , N + 2 ) : NEW_LINE INDENT fac [ i ] = fac [ i - 1 ] * i % MOD NEW_LINE inv [ i ] = - inv [ MOD % i ] * ( MOD // i ) % MOD NEW_LINE finv [ i ] = finv [ i - 1 ] * inv [ i ] % MOD NEW_LINE DEDENT def ncr ( n , r ) : NEW_LINE INDENT if n < r : return 0 NEW_LINE if n < 0 or r < 0 : return 0 NEW_LINE return fac [ n ] * ( finv [ r ] * finv [ n - r ] % MOD ) % MOD NEW_LINE DEDENT ans = [ ] NEW_LINE for n in range ( 1 , N + 2 ) : NEW_LINE INDENT ans . append ( ncr ( N + 1 , n ) ) NEW_LINE DEDENT for i in range ( l + 1 ) : NEW_LINE INDENT ans [ i ] -= ncr ( l , i ) NEW_LINE ans [ i ] %= MOD NEW_LINE DEDENT print ( * ans , sep = ' \n ' ) NEW_LINE


from collections import Counter NEW_LINE mod = 10 ** 9 + 7 NEW_LINE N = 10 ** 5 + 11 NEW_LINE fac , finv , inv = [ 0 ] * N , [ 0 ] * N , [ 0 ] * N NEW_LINE def cmb_init ( ) : NEW_LINE INDENT fac [ 0 ] = fac [ 1 ] = finv [ 0 ] = finv [ 1 ] = inv [ 1 ] = 1 NEW_LINE for i in range ( 2 , N ) : NEW_LINE INDENT fac [ i ] = fac [ i - 1 ] * i % mod NEW_LINE inv [ i ] = mod - inv [ mod % i ] * ( mod // i ) % mod NEW_LINE finv [ i ] = finv [ i - 1 ] * inv [ i ] % mod NEW_LINE DEDENT DEDENT def cmb_mod ( n , k ) : NEW_LINE INDENT if n < k : return 0 NEW_LINE return fac [ n ] * ( finv [ k ] * finv [ n - k ] % mod ) % mod NEW_LINE DEDENT n = int ( input ( ) ) NEW_LINE a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE ac = Counter ( a ) . most_common ( ) [ 0 ] [ 0 ] NEW_LINE sames = [ i for i , x in enumerate ( a ) if x == ac ] NEW_LINE same_len = sames [ 0 ] + ( n - sames [ 1 ] ) NEW_LINE cmb_init ( ) NEW_LINE print ( n ) NEW_LINE for i in range ( 1 , n ) : NEW_LINE INDENT nums = cmb_mod ( n + 1 , i + 1 ) - cmb_mod ( same_len , i ) NEW_LINE if nums < 0 : nums += mod NEW_LINE print ( nums ) NEW_LINE DEDENT print ( 1 ) NEW_LINE


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) , M = sc . nextInt ( ) ; int x = 1900 * M + 100 * ( N - M ) ; System . out . println ( ( int ) ( x * Math . pow ( 2 , M ) ) ) ; } }

N , M = map ( int , input ( ) . split ( ) ) NEW_LINE m = 2 ** M NEW_LINE ans = 0 NEW_LINE i = 1 NEW_LINE while True : NEW_LINE INDENT k = ( ( 1 * ( ( 1 / m ) ) ) * ( ( ( ( m - 1 ) / m ) ** ( i - 1 ) ) ) ) * ( 1900 * M * i + ( N - M ) * 100 * i ) NEW_LINE ans += k NEW_LINE i += 1 NEW_LINE if ( i > 10000 ) : NEW_LINE INDENT break NEW_LINE DEDENT DEDENT print ( int ( ans + 0.5 ) ) NEW_LINE


def solve ( n , m ) : NEW_LINE INDENT return ( 100 * n + 1800 * m ) * ( 2 ** m ) NEW_LINE DEDENT def main ( ) : NEW_LINE INDENT n , m = input ( ) . split ( ) NEW_LINE n = int ( n ) NEW_LINE m = int ( m ) NEW_LINE print ( solve ( n , m ) ) NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT main ( ) NEW_LINE DEDENT


def inpl ( ) : return [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE N , M = inpl ( ) NEW_LINE print ( 2 ** M * ( 1800 * M + 100 * N ) ) NEW_LINE


N , M = map ( int , input ( ) . split ( ) ) NEW_LINE total_time = M * 1900 + ( N - M ) * 100 NEW_LINE e = 0 NEW_LINE err = 10 ** ( - 3 ) NEW_LINE prev = - 1 NEW_LINE i = 0 NEW_LINE while abs ( prev - e ) > err : NEW_LINE INDENT prev = e NEW_LINE e += ( 1 - ( 1 / 2 ) ** M ) ** i * ( 1 / 2 ) ** M * total_time * ( i + 1 ) NEW_LINE i += 1 NEW_LINE DEDENT def floor ( x , y ) : NEW_LINE INDENT return ( ( - x ) // y ) * ( - 1 ) NEW_LINE DEDENT print ( int ( floor ( e , 1 ) ) ) NEW_LINE


N , M = map ( int , input ( ) . split ( ) ) NEW_LINE E = 0 NEW_LINE i = 1 NEW_LINE a = ( 1900 * ( M ) + 100 * ( N - M ) ) * ( 0.5 ) ** ( M ) NEW_LINE while a > 10e-10 : NEW_LINE INDENT a = ( 1900 * ( M * i ) + 100 * ( N - M ) * i ) * ( ( ( 2 ** M - 1 ) * ( 0.5 ) ** M ) ** ( i - 1 ) ) * ( 0.5 ) ** M NEW_LINE E += a NEW_LINE i += 1 NEW_LINE DEDENT print ( int ( E ) + 1 ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class Main { int n , m ; public static void main ( String args [ ] ) { new Main ( ) . run ( ) ; } void run ( ) { FastReader sc = new FastReader ( ) ; n = sc . nextInt ( ) ; m = sc . nextInt ( ) ; solve ( ) ; } void solve ( ) { int ans = n * 100 + 1800 * m ; System . out . println ( ans * pow ( 2 , m ) ) ; } long pow ( long x , int n ) { long ans = 1 ; while ( n > 0 ) { if ( ( n & 1 ) == 1 ) { ans = ans * x ; } x = x * x ; n >>= 1 ; } return ans ; } static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } }


import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; import java . io . IOException ; import java . util . InputMismatchException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskC solver = new TaskC ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskC { public void solve ( int testNumber , InputReader in , PrintWriter out ) { int n = in . nextInt ( ) ; int m = in . nextInt ( ) ; long ans = 1900 * m + 100 * ( n - m ) ; for ( int i = 0 ; i < m ; i ++ ) { ans *= 2 ; } out . println ( ans ) ; } } static class InputReader { BufferedReader in ; StringTokenizer tok ; public String nextString ( ) { while ( ! tok . hasMoreTokens ( ) ) { try { tok = new StringTokenizer ( in . readLine ( ) , " ▁ " ) ; } catch ( IOException e ) { throw new InputMismatchException ( ) ; } } return tok . nextToken ( ) ; } public int nextInt ( ) { return Integer . parseInt ( nextString ( ) ) ; } public InputReader ( InputStream inputStream ) { in = new BufferedReader ( new InputStreamReader ( inputStream ) ) ; tok = new StringTokenizer ( " " ) ; } } }


import java . util . * ; import java . lang . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . next ( ) ) ; int M = Integer . parseInt ( sc . next ( ) ) ; double c = 1900.0 * M + 100.0 * ( N - M ) ; double p = 1.0 ; double res = 0.0 ; double q = 1.0 ; for ( int i = 0 ; i < M ; i ++ ) p *= 0.5 ; for ( int i = 1 ; i < 3000000 ; i ++ ) { res += i * c * p * q ; q *= 1 - p ; } double eps = 0.0000001 ; int ret = ( int ) Math . floor ( res + eps ) ; System . out . println ( ret ) ; } }


import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Main m = new Main ( ) ; m . run ( ) ; } Scanner sc = new Scanner ( System . in ) ; void run ( ) { int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; long base = n * 100 + m * 1800 ; System . out . println ( base << m ) ; } }


import java . math . BigDecimal ; import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Main { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { BigDecimal x1 = new BigDecimal ( Integer . parseInt ( sc . next ( ) ) ) ; BigDecimal y1 = new BigDecimal ( Integer . parseInt ( sc . next ( ) ) ) ; BigDecimal x2 = new BigDecimal ( Integer . parseInt ( sc . next ( ) ) ) ; BigDecimal y2 = new BigDecimal ( Integer . parseInt ( sc . next ( ) ) ) ; BigDecimal x3 = new BigDecimal ( Integer . parseInt ( sc . next ( ) ) ) ; BigDecimal y3 = new BigDecimal ( Integer . parseInt ( sc . next ( ) ) ) ; double c = 0 ; BigDecimal bd = new BigDecimal ( c ) ; BigDecimal two = new BigDecimal ( 2.0 ) ; bd = x1 . multiply ( y2 ) . add ( x2 . multiply ( y3 ) ) . add ( x3 . multiply ( y1 ) ) . subtract ( y1 . multiply ( x2 ) ) . subtract ( y2 . multiply ( x3 ) ) . subtract ( y3 . multiply ( x1 ) ) . divide ( two ) ; bd . setScale ( 3 , BigDecimal . ROUND_HALF_UP ) ; System . out . println ( bd . abs ( ) ) ; System . out . flush ( ) ; sc . close ( ) ; } }

x1 , y1 , x2 , y2 , x3 , y3 = map ( int , input ( ) . split ( ) ) NEW_LINE a = x2 - x1 NEW_LINE b = y2 - y1 NEW_LINE c = x3 - x1 NEW_LINE d = y3 - y1 NEW_LINE print ( abs ( a * d - b * c ) / 2 ) NEW_LINE


from operator import itemgetter NEW_LINE from math import sqrt NEW_LINE x1 , y1 , x2 , y2 , x3 , y3 = map ( int , input ( ) . split ( ) ) NEW_LINE xy = [ ( x1 , y1 ) , ( x2 , y2 ) , ( x3 , y3 ) ] NEW_LINE def edge_len ( x1 , y1 , x2 , y2 ) : NEW_LINE INDENT return sqrt ( ( x1 - x2 ) ** 2 + ( y1 - y2 ) ** 2 ) NEW_LINE DEDENT ls = [ edge_len ( x1 , y1 , x2 , y2 ) , edge_len ( x1 , y1 , x3 , y3 ) , edge_len ( x2 , y2 , x3 , y3 ) ] NEW_LINE s = sum ( ls ) / 2 NEW_LINE print ( sqrt ( s * ( s - ls [ 0 ] ) * ( s - ls [ 1 ] ) * ( s - ls [ 2 ] ) ) ) NEW_LINE


import math NEW_LINE xa , ya , xb , yb , xc , yc = map ( int , input ( ) . split ( ) ) NEW_LINE a = math . sqrt ( ( xa - xb ) ** 2 + ( ya - yb ) ** 2 ) NEW_LINE b = math . sqrt ( ( xb - xc ) ** 2 + ( yb - yc ) ** 2 ) NEW_LINE c = math . sqrt ( ( xc - xa ) ** 2 + ( yc - ya ) ** 2 ) NEW_LINE s = ( a + b + c ) / 2 NEW_LINE S = math . sqrt ( s * ( s - a ) * ( s - b ) * ( s - c ) ) NEW_LINE print ( str ( S ) + " \n " ) NEW_LINE


from operator import itemgetter NEW_LINE import numpy as np NEW_LINE from math import atan , cos , sin NEW_LINE x1 , y1 , x2 , y2 , x3 , y3 = map ( int , input ( ) . split ( ) ) NEW_LINE xy = [ ( x1 , y1 ) , ( x2 , y2 ) , ( x3 , y3 ) ] NEW_LINE xy . sort ( key = itemgetter ( 1 ) ) NEW_LINE xy . sort ( key = itemgetter ( 0 ) ) NEW_LINE x1 , y1 = xy [ 0 ] NEW_LINE x2 , y2 = xy [ 1 ] NEW_LINE x3 , y3 = xy [ 2 ] NEW_LINE if x2 - x1 == 0 : NEW_LINE INDENT x2 , x3 = x3 , x2 NEW_LINE y2 , y3 = y3 , y2 NEW_LINE DEDENT theta = atan ( ( y2 - y1 ) / ( x2 - x1 ) ) NEW_LINE def rotate ( x , y , theta , a , b ) : NEW_LINE INDENT rot = np . array ( [ [ cos ( theta ) , - sin ( theta ) ] , [ sin ( theta ) , cos ( theta ) ] ] ) NEW_LINE pos = np . dot ( rot , np . array ( [ [ x - a ] , [ y - b ] ] ) ) NEW_LINE return pos [ 0 ] [ 0 ] + a , pos [ 1 ] [ 0 ] + b NEW_LINE DEDENT x2 , y2 = rotate ( x2 , y2 , - theta , x1 , y1 ) NEW_LINE x3 , y3 = rotate ( x3 , y3 , - theta , x1 , y1 ) NEW_LINE width = x2 - x1 NEW_LINE height = y3 - y1 NEW_LINE print ( abs ( 1 / 2 * width * height ) ) NEW_LINE


a , b , c , d , e , f = map ( int , input ( ) . split ( ) ) NEW_LINE X1 = c - a NEW_LINE Y1 = d - b NEW_LINE X2 = e - a NEW_LINE Y2 = f - b NEW_LINE S = float ( X1 * Y2 - X2 * Y1 ) / 2 NEW_LINE if S > 0 : NEW_LINE INDENT print ( S ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( float ( - S ) ) NEW_LINE DEDENT


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Double x1 = sc . nextDouble ( ) ; Double y1 = sc . nextDouble ( ) ; Double x2 = sc . nextDouble ( ) ; Double y2 = sc . nextDouble ( ) ; Double x3 = sc . nextDouble ( ) ; Double y3 = sc . nextDouble ( ) ; x3 -= x1 ; y3 -= y1 ; x2 -= x1 ; y2 -= y1 ; x1 -= x1 ; y1 -= y1 ; System . out . println ( Math . abs ( ( x3 * y2 ) - x2 * y3 ) / 2 ) ; } }


import java . util . Arrays ; import java . util . Scanner ; public class Main { void run ( ) { Scanner sc = new Scanner ( System . in ) ; int [ ] x = new int [ 3 ] ; int [ ] y = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i ++ ) { x [ i ] = sc . nextInt ( ) ; y [ i ] = sc . nextInt ( ) ; } for ( int i = 2 ; i >= 0 ; i -- ) { x [ i ] -= x [ 0 ] ; y [ i ] -= y [ 0 ] ; } debug ( x , y ) ; System . out . println ( area ( x [ 1 ] , y [ 1 ] , x [ 2 ] , y [ 2 ] ) ) ; } double area ( int x1 , int y1 , int x2 , int y2 ) { return Math . abs ( 1.0 * x1 * y2 - 1.0 * x2 * y1 ) / 2 ; } void debug ( Object ... os ) { System . err . println ( Arrays . deepToString ( os ) ) ; } public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } }


import java . util . Scanner ; import static java . lang . Math . abs ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x1 = sc . nextInt ( ) ; int y1 = sc . nextInt ( ) ; int x2 = sc . nextInt ( ) ; int y2 = sc . nextInt ( ) ; int x3 = sc . nextInt ( ) ; int y3 = sc . nextInt ( ) ; x2 -= x1 ; x3 -= x1 ; y2 -= y1 ; y3 -= y1 ; System . out . println ( MyMath . area_of_triangle ( new Point ( x2 , y2 ) , new Point ( x3 , y3 ) ) ) ; } } class MyMath { static double crossProduct ( Point a , Point b ) { return a . x * b . y - a . y * b . x ; } static double area_of_triangle ( Point a , Point b ) { return abs ( crossProduct ( a , b ) ) / 2.0 ; } } class Point { double x ; double y ; Point ( double x , double y ) { this . x = x ; this . y = y ; } }


import java . util . * ; import static java . lang . System . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] xy = new int [ 3 ] [ 2 ] ; for ( int i = 0 ; i < 3 ; i ++ ) { xy [ i ] [ 0 ] = sc . nextInt ( ) ; xy [ i ] [ 1 ] = sc . nextInt ( ) ; } int xMove = - xy [ 0 ] [ 0 ] ; int yMove = - xy [ 0 ] [ 1 ] ; for ( int i = 0 ; i < 3 ; i ++ ) { xy [ i ] [ 0 ] += xMove ; xy [ i ] [ 1 ] += yMove ; } out . println ( Math . abs ( xy [ 1 ] [ 0 ] * xy [ 2 ] [ 1 ] - xy [ 1 ] [ 1 ] * xy [ 2 ] [ 0 ] ) / 2.0 ) ; } }


import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; int N = scn . nextInt ( ) ; long [ ] A = new long [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { A [ i ] = scn . nextLong ( ) ; } Arrays . sort ( A ) ; int ans = 0 ; int count = 0 ; long buf = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( buf == A [ i ] ) { count ++ ; } else { if ( count % 2 == 1 && count != 0 ) { ans ++ ; } count = 1 ; buf = A [ i ] ; } } if ( count % 2 == 1 ) { ans ++ ; } System . out . println ( ans ) ; } }

n = int ( input ( ) ) NEW_LINE S = set ( ) NEW_LINE for i in range ( n ) : NEW_LINE INDENT S ^= set ( [ input ( ) ] ) NEW_LINE DEDENT print ( len ( S ) ) NEW_LINE


import math , string , itertools , fractions , heapq , collections , re , array , bisect , sys , random , time , copy , functools NEW_LINE sys . setrecursionlimit ( 10 ** 7 ) NEW_LINE inf = 10 ** 20 NEW_LINE eps = 1.0 / 10 ** 10 NEW_LINE mod = 10 ** 9 + 7 NEW_LINE dd = [ ( - 1 , 0 ) , ( 0 , 1 ) , ( 1 , 0 ) , ( 0 , - 1 ) ] NEW_LINE ddn = [ ( - 1 , 0 ) , ( - 1 , 1 ) , ( 0 , 1 ) , ( 1 , 1 ) , ( 1 , 0 ) , ( 1 , - 1 ) , ( 0 , - 1 ) , ( - 1 , - 1 ) ] NEW_LINE def LI ( ) : return [ int ( x ) for x in sys . stdin . readline ( ) . split ( ) ] NEW_LINE def LI_ ( ) : return [ int ( x ) - 1 for x in sys . stdin . readline ( ) . split ( ) ] NEW_LINE def LF ( ) : return [ float ( x ) for x in sys . stdin . readline ( ) . split ( ) ] NEW_LINE def LS ( ) : return sys . stdin . readline ( ) . split ( ) NEW_LINE def I ( ) : return int ( sys . stdin . readline ( ) ) NEW_LINE def F ( ) : return float ( sys . stdin . readline ( ) ) NEW_LINE def pf ( s ) : return print ( s , flush = True ) NEW_LINE N = I ( ) NEW_LINE A = [ I ( ) for i in range ( N ) ] NEW_LINE counts = collections . Counter ( A ) NEW_LINE ans = 0 NEW_LINE for i in counts . values ( ) : NEW_LINE INDENT if i % 2 == 1 : NEW_LINE INDENT ans += 1 NEW_LINE DEDENT DEDENT print ( ans ) NEW_LINE


def main ( ) : NEW_LINE INDENT N = int ( input ( ) ) NEW_LINE Ai_to_num = { } NEW_LINE for _ in range ( N ) : NEW_LINE INDENT Ai = input ( ) NEW_LINE if Ai in Ai_to_num . keys ( ) : NEW_LINE INDENT Ai_to_num [ Ai ] += 1 NEW_LINE DEDENT else : NEW_LINE INDENT Ai_to_num [ Ai ] = 1 NEW_LINE DEDENT DEDENT ct = 0 NEW_LINE for num_i in Ai_to_num . values ( ) : NEW_LINE INDENT if num_i % 2 : NEW_LINE INDENT ct += 1 NEW_LINE DEDENT DEDENT print ( ct ) NEW_LINE DEDENT main ( ) NEW_LINE


import itertools NEW_LINE import collections NEW_LINE import bisect NEW_LINE def main ( ) : NEW_LINE INDENT N = int ( input ( ) ) NEW_LINE A = [ int ( input ( ) ) for _ in range ( N ) ] NEW_LINE c = collections . Counter ( A ) NEW_LINE ans = 0 NEW_LINE for pair in c . items ( ) : NEW_LINE INDENT if pair [ 1 ] % 2 == 1 : NEW_LINE INDENT ans += 1 NEW_LINE DEDENT DEDENT print ( ans ) NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT main ( ) NEW_LINE DEDENT


from collections import Counter NEW_LINE n = int ( input ( ) ) NEW_LINE inputs = [ int ( input ( ) ) for _ in range ( n ) ] NEW_LINE counter = Counter ( inputs ) NEW_LINE answer = 0 NEW_LINE for number , count in counter . items ( ) : NEW_LINE INDENT if count % 2 != 0 : NEW_LINE INDENT answer += 1 NEW_LINE DEDENT DEDENT print ( answer ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . HashSet ; import java . util . Set ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s = br . readLine ( ) ; int n = Integer . parseInt ( s ) ; HashSet < Integer > set = new HashSet < Integer > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { s = br . readLine ( ) ; int a = Integer . parseInt ( s ) ; if ( set . contains ( a ) ) set . remove ( a ) ; else set . add ( a ) ; } System . out . println ( set . size ( ) ) ; } }


import java . util . stream . Collectors ; import java . util . stream . IntStream ; public class Main { private static java . util . Scanner scanner = new java . util . Scanner ( System . in ) ; public static void main ( String [ ] args ) { System . out . println ( IntStream . range ( 0 , scanner . nextInt ( ) ) . boxed ( ) . collect ( Collectors . groupingBy ( i -> scanner . nextInt ( ) , Collectors . reducing ( false , i -> true , ( a , b ) -> a ^ b ) ) ) . values ( ) . stream ( ) . filter ( Boolean :: booleanValue ) . count ( ) ) ; } }


import java . util . HashMap ; import java . util . HashSet ; import java . util . Map . Entry ; import java . util . Scanner ; import java . util . Set ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; HashMap < Integer , Integer > mp = new HashMap < Integer , Integer > ( ) ; Set < Integer > set = new HashSet < Integer > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { int m = scan . nextInt ( ) ; if ( set . contains ( m ) ) { if ( mp . containsKey ( m ) ) { int value = mp . get ( m ) ; mp . put ( m , value + 1 ) ; } else { mp . put ( m , 1 ) ; } } set . add ( m ) ; } int count = 0 ; for ( Entry < Integer , Integer > entry : mp . entrySet ( ) ) { Integer key = entry . getKey ( ) ; Integer value = entry . getValue ( ) ; if ( value % 2 == 1 ) { count ++ ; } } System . out . println ( set . size ( ) - count ) ; } }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . HashSet ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; HashSet < String > in ; in = new HashSet < > ( ) ; int count = Integer . parseInt ( reader . readLine ( ) ) ; for ( int i = 0 ; i < count ; i ++ ) { String number = reader . readLine ( ) ; if ( in . contains ( number ) ) { in . remove ( number ) ; } else { in . add ( number ) ; } } System . out . println ( in . size ( ) ) ; } }


import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; int N = scan . nextInt ( ) ; int max = 0 ; int id = 0 ; int max_ ; for ( int i = 2 ; i <= N ; i ++ ) { out . printf ( " ? ▁ % d ▁ % d \n " , 1 , i ) ; out . flush ( ) ; scan = new Scanner ( System . in ) ; max_ = scan . nextInt ( ) ; if ( max_ > max ) { id = i ; max = max_ ; } } for ( int i = 2 ; i <= N ; i ++ ) { if ( i != id ) { out . printf ( " ? ▁ % d ▁ % d \n " , id , i ) ; out . flush ( ) ; scan = new Scanner ( System . in ) ; max_ = scan . nextInt ( ) ; if ( max_ > max ) { max = max_ ; } } } out . printf ( " ! ▁ % d \n " , max ) ; out . flush ( ) ; } }

n = int ( input ( ) ) NEW_LINE a = 1 NEW_LINE b = 2 NEW_LINE c = 3 NEW_LINE ma = 1 NEW_LINE for i in range ( 2 , n + 1 ) : NEW_LINE INDENT print ( " ? " , a , i ) NEW_LINE t = int ( input ( ) ) NEW_LINE if t >= ma : NEW_LINE INDENT ma = t NEW_LINE b = i NEW_LINE DEDENT DEDENT ma = 0 NEW_LINE for i in range ( 1 , n + 1 ) : NEW_LINE INDENT if b == i : NEW_LINE INDENT continue NEW_LINE DEDENT print ( " ? " , b , i ) NEW_LINE t = int ( input ( ) ) NEW_LINE if t >= ma : NEW_LINE INDENT ma = t NEW_LINE c = i NEW_LINE DEDENT DEDENT print ( " ! " , ma ) NEW_LINE


def query ( a , b ) : NEW_LINE INDENT print ( " ? ▁ { } ▁ { } " . format ( a , b ) ) NEW_LINE return int ( input ( ) ) NEW_LINE DEDENT N = int ( input ( ) ) NEW_LINE ans = 0 NEW_LINE v = 1 NEW_LINE for i in range ( 2 , N + 1 ) : NEW_LINE INDENT dist = query ( 1 , i ) NEW_LINE if ans < dist : NEW_LINE INDENT ans = dist NEW_LINE v = i NEW_LINE DEDENT DEDENT for i in range ( 1 , N + 1 ) : NEW_LINE INDENT if i == v : NEW_LINE INDENT continue NEW_LINE DEDENT ans = max ( ans , query ( v , i ) ) NEW_LINE DEDENT print ( " ! " , ans ) NEW_LINE


import sys NEW_LINE stdin = sys . stdin NEW_LINE sys . setrecursionlimit ( 10 ** 5 ) NEW_LINE def li ( ) : return map ( int , stdin . readline ( ) . split ( ) ) NEW_LINE def li_ ( ) : return map ( lambda x : int ( x ) - 1 , stdin . readline ( ) . split ( ) ) NEW_LINE def lf ( ) : return map ( float , stdin . readline ( ) . split ( ) ) NEW_LINE def ls ( ) : return stdin . readline ( ) . split ( ) NEW_LINE def ns ( ) : return stdin . readline ( ) . rstrip ( ) NEW_LINE def lc ( ) : return list ( ns ( ) ) NEW_LINE def ni ( ) : return int ( stdin . readline ( ) ) NEW_LINE def nf ( ) : return float ( stdin . readline ( ) ) NEW_LINE n = ni ( ) NEW_LINE dist = 0 NEW_LINE far = 1 NEW_LINE for i in range ( 2 , n + 1 ) : NEW_LINE INDENT print ( " ? ▁ 1 ▁ { } " . format ( i ) , flush = True ) NEW_LINE nex_dist = ni ( ) NEW_LINE if dist < nex_dist : NEW_LINE INDENT dist = nex_dist NEW_LINE far = i NEW_LINE DEDENT DEDENT ans = 0 NEW_LINE for j in range ( 1 , n + 1 ) : NEW_LINE INDENT if j == far : NEW_LINE INDENT continue NEW_LINE DEDENT print ( " ? ▁ { } ▁ { } " . format ( far , j ) , flush = True ) NEW_LINE nex = ni ( ) NEW_LINE ans = max ( ans , nex ) NEW_LINE DEDENT print ( " ! ▁ { } " . format ( ans ) , flush = True ) NEW_LINE


pointnum = int ( input ( ) ) NEW_LINE points = [ ] NEW_LINE for i in range ( pointnum ) : NEW_LINE INDENT points . append ( i + 1 ) NEW_LINE DEDENT d_list = [ ] NEW_LINE for i in points : NEW_LINE INDENT if i < len ( points ) : NEW_LINE INDENT print ( " ? ▁ { 0 } ▁ { 1 } " . format ( points [ 0 ] , points [ i ] ) ) NEW_LINE d_list . append ( int ( input ( ) ) ) NEW_LINE DEDENT DEDENT one_edge = d_list . index ( max ( d_list ) ) + 2 NEW_LINE e_list = [ ] NEW_LINE points . remove ( one_edge ) NEW_LINE for i in points : NEW_LINE INDENT print ( " ? ▁ { 0 } ▁ { 1 } " . format ( one_edge , i ) ) NEW_LINE e_list . append ( int ( input ( ) ) ) NEW_LINE DEDENT print ( " ! ▁ { } " . format ( ( max ( e_list ) ) ) ) NEW_LINE


import sys NEW_LINE input = sys . stdin . readline NEW_LINE def fQ ( i : int , i2 : int ) : NEW_LINE INDENT sys . stdout . write ( " ▁ " . join ( ( " ? " , str ( i ) , str ( i2 ) ) ) ) NEW_LINE sys . stdout . write ( " \n " ) NEW_LINE sys . stdout . flush ( ) NEW_LINE DEDENT N = int ( input ( ) ) NEW_LINE dMax = 0 NEW_LINE iP = 0 NEW_LINE for i in range ( 2 , N + 1 ) : NEW_LINE INDENT fQ ( 1 , i ) NEW_LINE d = int ( input ( ) ) NEW_LINE if dMax < d : NEW_LINE INDENT dMax = d NEW_LINE iP = i NEW_LINE DEDENT DEDENT for i in range ( 1 , N + 1 ) : NEW_LINE INDENT if i == iP : NEW_LINE INDENT continue NEW_LINE DEDENT else : NEW_LINE INDENT fQ ( iP , i ) NEW_LINE d = int ( input ( ) ) NEW_LINE if dMax < d : NEW_LINE INDENT dMax = d NEW_LINE DEDENT DEDENT DEDENT print ( " ! " , dMax ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class Main { int n ; public static void main ( String args [ ] ) { new Main ( ) . run ( ) ; } void run ( ) { FastReader sc = new FastReader ( ) ; n = sc . nextInt ( ) ; int max = 0 ; int maxIndex = 1 ; for ( int i = 2 ; i <= n ; i ++ ) { System . out . println ( " ? ▁ 1 ▁ " + i ) ; int temp = sc . nextInt ( ) ; if ( max < temp ) { max = temp ; maxIndex = i ; } } int distance = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { if ( i == maxIndex ) { continue ; } System . out . printf ( " ? ▁ % d ▁ % d \n " , maxIndex , i ) ; int temp = sc . nextInt ( ) ; if ( distance < temp ) { distance = temp ; } } System . out . println ( " ! ▁ " + distance ) ; } static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } }


import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; D solver = new D ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class D { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int n = in . nextInt ( ) ; int max = 0 ; int dest = 0 ; for ( int i = 2 ; i <= n ; i ++ ) { out . println ( " ? ▁ 1 ▁ " + i ) ; out . flush ( ) ; int dist = in . nextInt ( ) ; if ( max < dist ) { max = dist ; dest = i ; } } for ( int i = 1 ; i <= n ; i ++ ) { if ( i == dest ) { continue ; } out . println ( " ? ▁ " + dest + " ▁ " + i ) ; out . flush ( ) ; max = Math . max ( max , in . nextInt ( ) ) ; } out . println ( " ! ▁ " + max ) ; } } }


import java . util . * ; import static java . lang . System . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int start = 1 ; int end = 1 ; int maxDis = - 1 ; for ( int j = 0 ; j < 2 ; j ++ ) { start = end ; maxDis = - 1 ; for ( int i = 1 ; i <= N ; i ++ ) { System . out . printf ( " ? ▁ % d ▁ % d \n " , start , i ) ; int dist = sc . nextInt ( ) ; if ( dist > maxDis ) { end = i ; maxDis = dist ; } } } out . println ( " ! ▁ " + maxDis ) ; } }


import java . util . Scanner ; public class Main { static Scanner sc ; public static int getDist ( int a , int b ) { System . out . printf ( " ? ▁ % d ▁ % d \n " , a , b ) ; int dist = sc . nextInt ( ) ; return dist ; } public static void main ( String [ ] args ) { sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int max_dist = - 1 ; int max_node = - 1 ; for ( int i = 2 ; i <= N ; i ++ ) { int dist = getDist ( 1 , i ) ; if ( max_dist < dist ) { max_dist = dist ; max_node = i ; } } int ans = - 1 ; for ( int i = 1 ; i <= N ; i ++ ) { if ( i == max_node ) continue ; ans = Math . max ( ans , getDist ( max_node , i ) ) ; } System . out . println ( " ! ▁ " + ans ) ; } }


import java . util . Arrays ; import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { 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 ( ) ; } Arrays . sort ( a ) ; System . out . println ( a [ n - 1 ] - a [ 0 ] ) ; sc . close ( ) ; } }

N = int ( input ( ) ) NEW_LINE l = sorted ( map ( int , input ( ) . split ( ) ) ) NEW_LINE print ( l [ - 1 ] - l [ 0 ] ) NEW_LINE


import sys NEW_LINE ns = lambda : sys . stdin . readline ( ) . rstrip ( ) NEW_LINE ni = lambda : int ( ns ( ) ) NEW_LINE nm = lambda : map ( int , sys . stdin . readline ( ) . split ( ) ) NEW_LINE nl = lambda : list ( nm ( ) ) NEW_LINE n = ni ( ) NEW_LINE a = nl ( ) NEW_LINE a . sort ( ) NEW_LINE print ( a [ - 1 ] - a [ 0 ] ) NEW_LINE


N = int ( input ( ) ) NEW_LINE ans = 0 NEW_LINE zahyou = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE zahyou . sort ( reverse = True ) NEW_LINE for i in range ( N - 1 ) : NEW_LINE INDENT ans += zahyou [ i ] - zahyou [ i + 1 ] NEW_LINE DEDENT print ( ans ) NEW_LINE


n = int ( input ( ) ) NEW_LINE a = [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE a = sorted ( a ) NEW_LINE ans = 0 NEW_LINE for i in range ( 1 , n ) : NEW_LINE INDENT ans += a [ i ] - a [ i - 1 ] NEW_LINE DEDENT print ( ans ) NEW_LINE


_ , t = open ( 0 ) ; * a , = map ( int , t . split ( ) ) ; print ( max ( a ) - min ( a ) ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . Collections ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( input . readLine ( ) ) ; ArrayList < Integer > s = new ArrayList < > ( ) ; StringTokenizer tokenizer = new StringTokenizer ( input . readLine ( ) ) ; for ( int i = 0 ; i < n ; i ++ ) { s . add ( Integer . parseInt ( tokenizer . nextToken ( ) ) ) ; } Collections . sort ( s ) ; int sum = 0 ; for ( int i = 1 ; i < n ; i ++ ) { sum += s . get ( i ) - s . get ( i - 1 ) ; } System . out . println ( sum ) ; } }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . OutputStream ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . StringTokenizer ; public class Main { 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 ( ) ; } static class Task { public void solve ( int testNumber , InputReader in , PrintWriter out ) { int N = in . nextInt ( ) ; int [ ] a = new int [ N ] ; for ( int i = 0 ; i < a . length ; i ++ ) { a [ i ] = in . nextInt ( ) ; } Arrays . sort ( a ) ; out . println ( a [ a . length - 1 ] - a [ 0 ] ) ; } } static class InputReader { public BufferedReader reader ; public StringTokenizer tokenizer ; public InputReader ( InputStream stream ) { reader = new BufferedReader ( new InputStreamReader ( stream ) , 32768 ) ; tokenizer = null ; } public String next ( ) { while ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( ) ; } public char nextChar ( ) { return next ( ) . charAt ( 0 ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } public double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } } }


import java . util . Map ; import java . util . Scanner ; import java . util . TreeMap ; public class Main { static Map < String , Integer > map = new TreeMap < > ( ) ; static String ans = " " ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int min = 1001 ; int max = - 1 ; for ( int i = 0 ; i < a ; i ++ ) { int b = sc . nextInt ( ) ; min = Math . min ( min , b ) ; max = Math . max ( max , b ) ; } System . out . println ( max - min ) ; } }


import java . util . * ; class Main { static Scanner sc = new Scanner ( System . in ) ; static int mod = 1000000007 ; public static void main ( String [ ] args ) { int n = sc . nextInt ( ) ; int [ ] ar = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) ar [ i ] = sc . nextInt ( ) ; Arrays . sort ( ar ) ; int sum = 0 ; for ( int i = 0 ; i < n - 1 ; i ++ ) { sum += ar [ i + 1 ] - ar [ i ] ; } System . out . println ( sum ) ; } }


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long mod = 1000000007 ; long [ ] dp = new long [ 2 * n + 2 ] ; dp [ 0 ] = 1 ; dp [ 1 ] = 1 ; long sum = 2 ; for ( int i = 2 ; i < dp . length ; i ++ ) { dp [ i ] = ( sum - dp [ i - 2 ] + mod ) % mod ; sum = ( sum + dp [ i ] ) % mod ; } long res = 0 ; for ( int i = 0 ; i < n - 1 ; i ++ ) { res = ( res + dp [ i ] * ( n - 1 ) % mod * ( n - 1 ) % mod ) % mod ; } res = ( res + dp [ n - 1 ] * ( n - 1 ) % mod ) % mod ; for ( int i = 0 ; i < n - 1 ; i ++ ) { long coef = i + 2 ; if ( i == n - 2 ) coef -- ; res = ( res + dp [ i ] * coef % mod ) % mod ; } res = ( res + dp [ n - 1 ] ) % mod ; System . out . println ( res ) ; } }

from random import * NEW_LINE def readln ( ) : NEW_LINE INDENT _res = list ( map ( int , str ( input ( ) ) . split ( ' ▁ ' ) ) ) NEW_LINE return _res NEW_LINE DEDENT p = 1000000000 + 7 NEW_LINE n = readln ( ) [ 0 ] NEW_LINE f = [ 0 for i in range ( 0 , n + 10 ) ] NEW_LINE f [ 1 ] = n NEW_LINE f [ 2 ] = n * n NEW_LINE s = f [ : ] NEW_LINE s [ 2 ] = f [ 1 ] + f [ 2 ] NEW_LINE for i in range ( 3 , n + 1 ) : NEW_LINE INDENT f [ i ] = f [ i - 1 ] + ( n - 1 ) * ( n - 1 ) NEW_LINE f [ i ] = f [ i ] + s [ i - 3 ] + ( n - i + 2 ) NEW_LINE f [ i ] = f [ i ] % p NEW_LINE s [ i ] = s [ i - 1 ] + f [ i ] NEW_LINE s [ i ] = s [ i ] % p NEW_LINE DEDENT print ( f [ n ] ) NEW_LINE


import sys NEW_LINE mod = 10 ** 9 + 7 NEW_LINE def solve ( ) : NEW_LINE INDENT n = int ( input ( ) ) NEW_LINE if n == 1 : NEW_LINE INDENT print ( 1 ) NEW_LINE return NEW_LINE DEDENT dp = [ 0 ] * ( n + 1 ) NEW_LINE dp [ 1 ] = n % mod NEW_LINE dp [ 2 ] = n ** 2 % mod NEW_LINE acc = [ 0 ] * ( n + 1 ) NEW_LINE acc [ 1 ] = dp [ 1 ] % mod NEW_LINE acc [ 2 ] = ( dp [ 1 ] + dp [ 2 ] ) % mod NEW_LINE for k in range ( 3 , n + 1 ) : NEW_LINE INDENT dp [ k ] = ( dp [ k - 1 ] + ( n - 1 ) ** 2 + acc [ k - 3 ] + n - k + 2 ) % mod NEW_LINE acc [ k ] = ( acc [ k - 1 ] + dp [ k ] ) % mod NEW_LINE DEDENT ans = dp [ n ] NEW_LINE print ( ans ) NEW_LINE DEDENT def debug ( x , table ) : NEW_LINE INDENT for name , val in table . items ( ) : NEW_LINE INDENT if x is val : NEW_LINE INDENT print ( ' DEBUG : { } ▁ - > ▁ { } ' . format ( name , val ) , file = sys . stderr ) NEW_LINE return None NEW_LINE DEDENT DEDENT DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT solve ( ) NEW_LINE DEDENT


n = int ( input ( ) ) NEW_LINE if n == 1 : NEW_LINE INDENT print ( 1 ) NEW_LINE DEDENT else : NEW_LINE INDENT res_v = [ 0 ] * ( n + 1 ) NEW_LINE res_v_cumsum = [ 0 ] * ( n + 1 ) NEW_LINE res_v [ 0 ] = 0 NEW_LINE res_v [ 1 ] = 1 NEW_LINE res_v [ 2 ] = 1 NEW_LINE res_v_cumsum [ 0 ] = 0 NEW_LINE res_v_cumsum [ 1 ] = 1 NEW_LINE res_v_cumsum [ 2 ] = 2 NEW_LINE M = 1000000007 NEW_LINE for k in range ( 3 , n ) : NEW_LINE INDENT res_v [ k ] = ( 1 + res_v_cumsum [ k - 1 ] - res_v [ k - 2 ] ) % M NEW_LINE res_v_cumsum [ k ] = ( res_v_cumsum [ k - 1 ] + res_v [ k ] ) % M NEW_LINE DEDENT print ( ( ( ( res_v_cumsum [ n - 2 ] * ( ( ( n - 1 ) * ( n - 1 ) ) % M ) ) % M ) + ( ( res_v_cumsum [ n - 1 ] * ( n - 1 ) ) % M ) + n + ( n - 1 ) * ( n - 1 ) % M ) % M ) NEW_LINE DEDENT


import java . math . BigInteger ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } long MODULO = 1_000_000_000 + 7 ; void run ( ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; long [ ] f = new long [ N + 1 ] ; long [ ] cum = new long [ N + 1 ] ; Arrays . fill ( f , - Integer . MAX_VALUE / 16 ) ; Arrays . fill ( cum , - Integer . MAX_VALUE / 16 ) ; f [ 1 ] = N ; cum [ 1 ] = N ; for ( int i = 2 ; i <= N ; ++ i ) { f [ i ] = f [ i - 1 ] ; f [ i ] = ( f [ i ] + 1L * ( N - 1 ) * ( N - 1 ) % MODULO ) % MODULO ; if ( i > 3 ) { f [ i ] = ( f [ i ] + cum [ i - 3 ] ) % MODULO ; } f [ i ] = ( f [ i ] + Math . min ( 0 , i - 3 ) - ( i - N - 1 ) + 1 ) % MODULO ; cum [ i ] = ( cum [ i - 1 ] + f [ i ] ) % MODULO ; } System . out . println ( f [ N ] ) ; } void tr ( Object ... objects ) { System . out . println ( Arrays . deepToString ( objects ) ) ; } }


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; long MOD = 1000000007 ; long [ ] dp = new long [ N + 1 ] ; dp [ 0 ] = 1 ; dp [ 1 ] = MOD - 1 ; long cur = 0 ; for ( int i = 0 ; i < N ; i ++ ) { cur = ( cur + dp [ i ] ) % MOD ; if ( i == N - 1 ) { dp [ N ] = ( dp [ N ] + cur * N ) % MOD ; } else { dp [ i + 1 ] = ( dp [ i + 1 ] + cur ) % MOD ; dp [ i + 2 ] = ( dp [ i + 2 ] - cur + MOD ) % MOD ; if ( i + 3 <= N ) { dp [ i + 3 ] = ( dp [ i + 3 ] + cur ) % MOD ; dp [ N ] = ( dp [ N ] + cur * ( i + 1 ) ) % MOD ; } else { dp [ N ] = ( dp [ N ] + cur * ( N - 1 ) ) % MOD ; } dp [ N ] = ( dp [ N ] + cur * ( ( ( ( long ) N - 1 ) * ( N - 1 ) ) % MOD ) ) % MOD ; } } System . out . println ( ( cur + dp [ N ] ) % MOD ) ; sc . close ( ) ; } }


import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int res = 0 ; int [ ] B = new int [ M ] ; int [ ] A = new int [ M ] ; for ( int i = 0 ; i < M ; i ++ ) { B [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < N ; i ++ ) { int sum = C ; for ( int n = 0 ; n < M ; n ++ ) { A [ n ] = sc . nextInt ( ) ; } for ( int n = 0 ; n < M ; n ++ ) { sum += A [ n ] * B [ n ] ; } if ( sum > 0 ) { res ++ ; } } System . out . println ( res ) ; } }

N , M , C = map ( int , input ( ) . split ( ) ) NEW_LINE B = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE counter = 0 NEW_LINE for i in range ( N ) : NEW_LINE INDENT s = C NEW_LINE A = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE for j in range ( M ) : NEW_LINE INDENT s += A [ j ] * B [ j ] NEW_LINE DEDENT if s > 0 : NEW_LINE INDENT counter += 1 NEW_LINE DEDENT DEDENT print ( counter ) NEW_LINE


I = lambda : map ( int , input ( ) . split ( ) ) ; n , m , c = I ( ) ; * b , = I ( ) NEW_LINE print ( sum ( sum ( a * b for a , b in zip ( I ( ) , b ) ) + c > 0 for _ in [ 0 ] * n ) ) NEW_LINE


n , m , c = map ( int , input ( ) . split ( ) ) NEW_LINE b = map ( int , input ( ) . split ( ) ) NEW_LINE b = [ int ( i ) for i in b ] NEW_LINE kazu = 0 NEW_LINE for i in range ( 0 , n ) : NEW_LINE INDENT goukei = 0 NEW_LINE a = map ( int , input ( ) . split ( ) ) NEW_LINE a = [ int ( i ) for i in a ] NEW_LINE for j in range ( 0 , m ) : NEW_LINE INDENT goukei += a [ j ] * b [ j ] NEW_LINE DEDENT if goukei + c > 0 : NEW_LINE INDENT kazu += 1 NEW_LINE DEDENT DEDENT print ( kazu ) NEW_LINE


n , m , c = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE b = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE l = [ list ( map ( int , input ( ) . split ( ) ) ) for i in range ( n ) ] NEW_LINE cnt = 0 NEW_LINE tot = 0 NEW_LINE for i in range ( n ) : NEW_LINE INDENT for j in range ( m ) : NEW_LINE INDENT tot += l [ i ] [ j ] * b [ j ] NEW_LINE DEDENT tot = tot + c NEW_LINE if ( tot > 0 ) : NEW_LINE INDENT cnt += 1 NEW_LINE DEDENT tot = 0 NEW_LINE DEDENT print ( cnt ) NEW_LINE


N , M , C = map ( int , input ( ) . split ( ) ) NEW_LINE deep = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE score = 0 NEW_LINE for n in range ( 1 , N + 1 ) : NEW_LINE INDENT blue = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE linear = 0 NEW_LINE for m in range ( 1 , M + 1 ) : NEW_LINE INDENT linear += deep [ m - 1 ] * blue [ m - 1 ] NEW_LINE DEDENT if linear + C > 0 : NEW_LINE INDENT score += 1 NEW_LINE DEDENT DEDENT print ( score ) NEW_LINE


import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String input = sc . nextLine ( ) ; int tmp [ ] = convertStringToArrayInt ( input ) ; int N = tmp [ 0 ] ; int C = tmp [ 2 ] ; int counter = 0 ; input = sc . nextLine ( ) ; int b [ ] = convertStringToArrayInt ( input ) ; for ( int i = 0 ; i < N ; i ++ ) { input = sc . nextLine ( ) ; int arr [ ] = convertStringToArrayInt ( input ) ; int source = 0 ; for ( int j = 0 ; j < arr . length ; j ++ ) { source = source + ( b [ j ] * arr [ j ] ) ; } if ( source + C > 0 ) { counter ++ ; } } System . out . println ( counter ) ; sc . close ( ) ; } private static int [ ] convertStringToArrayInt ( String input ) { return Arrays . stream ( input . split ( " ▁ " ) ) . filter ( s -> ! s . isEmpty ( ) ) . mapToInt ( Integer :: parseInt ) . toArray ( ) ; } }


import java . util . Scanner ; import java . util . stream . IntStream ; public class Main { public static void main ( String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { int n = scanner . nextInt ( ) ; int m = scanner . nextInt ( ) ; int c = scanner . nextInt ( ) ; scanner . nextLine ( ) ; int b [ ] = new int [ m ] ; IntStream . range ( 0 , m ) . forEach ( i -> b [ i ] = scanner . nextInt ( ) ) ; scanner . nextLine ( ) ; System . out . println ( IntStream . range ( 0 , n ) . filter ( i -> { int sum = IntStream . range ( 0 , m ) . map ( j -> scanner . nextInt ( ) * b [ j ] ) . sum ( ) ; scanner . nextLine ( ) ; return ( sum + c ) > 0 ; } ) . count ( ) ) ; } } }


import java . util . * ; public class Main { private static int X ( int [ ] a , int [ ] b , int C ) { int num = 0 ; int sum = C ; for ( int i = 0 ; i < a . length ; i ++ ) { sum += a [ i ] * b [ i ] ; } if ( sum > 0 ) num = 1 ; return num ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int [ ] [ ] A = new int [ N ] [ M ] ; int [ ] B = new int [ M ] ; for ( int j = 0 ; j < M ; j ++ ) { B [ j ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < N ; i ++ ) { for ( int j = 0 ; j < M ; j ++ ) { A [ i ] [ j ] = sc . nextInt ( ) ; } } int result = 0 ; int count ; for ( int i = 0 ; i < N ; i ++ ) { result += X ( A [ i ] , B , C ) ; } System . out . println ( result ) ; } }


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int codeNum = sc . nextInt ( ) ; int featNum = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int [ ] b = new int [ featNum ] ; int num = 0 ; int num2 = 0 ; int sum = 0 ; int count = 0 ; for ( int i = 0 ; i < featNum ; i ++ ) { b [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < codeNum ; i ++ ) { for ( int j = 0 ; j < featNum ; j ++ ) { num = sc . nextInt ( ) ; num2 = b [ j ] * num ; sum += num2 ; } if ( sum + c > 0 ) count ++ ; sum = 0 ; } System . out . println ( count ) ; } }


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; long a [ ] = new long [ N ] ; long b [ ] = new long [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { a [ i ] = sc . nextLong ( ) ; b [ i ] = sc . nextLong ( ) ; } int count = 0 ; for ( int i = 0 ; i < N ; i ++ ) { for ( int k = i ; k < N ; k ++ ) { for ( int j = k ; j < N ; j ++ ) { long s = Math . abs ( ( a [ j ] - a [ i ] ) * ( b [ k ] - b [ i ] ) - ( a [ k ] - a [ i ] ) * ( b [ j ] - b [ i ] ) ) ; if ( s != 0 && s % 2 == 0 ) count ++ ; } } } System . out . println ( count ) ; } }

N = int ( input ( ) ) NEW_LINE XY = [ list ( map ( int , input ( ) . split ( ) ) ) for i in range ( N ) ] NEW_LINE ans = 0 NEW_LINE for i in range ( N - 2 ) : NEW_LINE INDENT for j in range ( i + 1 , N - 1 ) : NEW_LINE INDENT for k in range ( j + 1 , N ) : NEW_LINE INDENT x1 , y1 = XY [ i ] NEW_LINE x2 , y2 = XY [ j ] NEW_LINE x3 , y3 = XY [ k ] NEW_LINE area = abs ( ( x2 - x1 ) * ( y3 - y1 ) - ( x3 - x1 ) * ( y2 - y1 ) ) NEW_LINE if area > 0 and area % 2 == 0 : NEW_LINE INDENT ans += 1 NEW_LINE DEDENT DEDENT DEDENT DEDENT print ( ans ) NEW_LINE


from itertools import combinations as comb NEW_LINE def tri ( o ) : NEW_LINE INDENT ( x1 , y1 ) , ( x2 , y2 ) , ( x3 , y3 ) = o NEW_LINE return abs ( x1 * y2 + x2 * y3 + x3 * y1 - y1 * x2 - y2 * x3 - y3 * x1 ) NEW_LINE DEDENT l = tuple ( tuple ( map ( int , input ( ) . split ( ) ) ) for _ in range ( int ( input ( ) ) ) ) NEW_LINE print ( sum ( 1 for s in map ( tri , comb ( l , 3 ) ) if s % 2 == 0 and s ) ) NEW_LINE


def b_lattice_point_and_integer ( N , Pos ) : NEW_LINE INDENT from itertools import combinations NEW_LINE def surface_2 ( Xa , Ya , Xb , Yb , Xc , Yc ) : NEW_LINE INDENT xb , yb = Xb - Xa , Yb - Ya NEW_LINE xc , yc = Xc - Xa , Yc - Ya NEW_LINE ret = abs ( xb * yc - yb * xc ) NEW_LINE return ret NEW_LINE DEDENT ans = 0 NEW_LINE for i , j , k in combinations ( range ( N ) , 3 ) : NEW_LINE INDENT s = surface_2 ( * ( Pos [ i ] + Pos [ j ] + Pos [ k ] ) ) NEW_LINE if s != 0 and s % 2 == 0 : NEW_LINE INDENT ans += 1 NEW_LINE DEDENT DEDENT return ans NEW_LINE DEDENT N = int ( input ( ) ) NEW_LINE Pos = [ [ int ( i ) for i in input ( ) . split ( ) ] for j in range ( N ) ] NEW_LINE print ( b_lattice_point_and_integer ( N , Pos ) ) NEW_LINE


import itertools NEW_LINE def solve_triangle ( a , b , c ) : NEW_LINE INDENT S = abs ( ( b [ 0 ] - a [ 0 ] ) * ( c [ 1 ] - a [ 1 ] ) - ( c [ 0 ] - a [ 0 ] ) * ( b [ 1 ] - a [ 1 ] ) ) NEW_LINE return ( S % 2 == 0 ) and ( S != 0 ) NEW_LINE DEDENT N = int ( input ( ) ) NEW_LINE lattice = [ ] NEW_LINE for _ in range ( N ) : NEW_LINE INDENT lattice . append ( list ( map ( int , input ( ) . split ( ) ) ) ) NEW_LINE DEDENT cnt = 0 NEW_LINE for triangle in itertools . combinations ( lattice , 3 ) : NEW_LINE INDENT if solve_triangle ( triangle [ 0 ] , triangle [ 1 ] , triangle [ 2 ] ) : NEW_LINE INDENT cnt += 1 NEW_LINE DEDENT DEDENT print ( cnt ) NEW_LINE


from math import floor , ceil NEW_LINE N = int ( input ( ) ) NEW_LINE x = [ None ] * N NEW_LINE y = [ None ] * N NEW_LINE for i in range ( N ) : NEW_LINE INDENT x [ i ] , y [ i ] = map ( int , input ( ) . split ( ) ) NEW_LINE DEDENT ans = 0 NEW_LINE for i in range ( N ) : NEW_LINE INDENT for j in range ( i + 1 , N ) : NEW_LINE INDENT for k in range ( j + 1 , N ) : NEW_LINE INDENT x1 = x [ j ] - x [ i ] NEW_LINE y1 = y [ j ] - y [ i ] NEW_LINE x2 = x [ k ] - x [ i ] NEW_LINE y2 = y [ k ] - y [ i ] NEW_LINE s = abs ( x1 * y2 - x2 * y1 ) NEW_LINE if s > 0 and s % 2 == 0 : NEW_LINE INDENT ans += 1 NEW_LINE DEDENT DEDENT DEDENT DEDENT print ( ans ) NEW_LINE


import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( br . readLine ( ) ) ; int [ ] x = new int [ n ] , y = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { String [ ] s = br . readLine ( ) . split ( " ▁ " ) ; x [ i ] = Integer . parseInt ( s [ 0 ] ) ; y [ i ] = Integer . parseInt ( s [ 1 ] ) ; } int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) for ( int j = 0 ; j < i ; j ++ ) for ( int k = 0 ; k < j ; k ++ ) { long ax = x [ k ] - x [ i ] ; long ay = y [ k ] - y [ i ] ; long bx = x [ j ] - x [ i ] ; long by = y [ j ] - y [ i ] ; long s2 = Math . abs ( ax * by - ay * bx ) ; if ( s2 > 0 && s2 % 2 == 0 ) { ans ++ ; } } System . out . println ( ans ) ; } }


import java . awt . Point ; import java . util . Arrays ; import java . util . Scanner ; class Main { public static void main ( String [ ] $ ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; Point [ ] p = new Point [ n ] ; Arrays . setAll ( p , o -> new Point ( s . nextInt ( ) , s . nextInt ( ) ) ) ; int r = 0 ; for ( int i = 0 ; i < n ; ++ i ) { Point a = p [ i ] ; for ( int j = i + 1 ; j < n ; ++ j ) { Point b = p [ j ] ; for ( int k = j + 1 ; k < n ; ++ k ) { Point c = p [ k ] ; if ( Math . atan2 ( a . y - b . y , a . x - b . x ) != Math . atan2 ( a . y - c . y , a . x - c . x ) && ( f ( a , b ) + f ( b , c ) + f ( c , a ) ) % 2 == 0 ) ++ r ; } } } System . out . println ( r ) ; } static long f ( Point a , Point b ) { return Math . abs ( ( long ) ( a . x - b . x ) * ( a . y - b . y ) ) ; } }


import java . util . * ; public class Main { private static double N ; private static ArrayList < Integer > x = new ArrayList < > ( ) ; private static ArrayList < Integer > y = new ArrayList < > ( ) ; public static void input ( ) { Scanner scan = new Scanner ( System . in ) ; N = scan . nextInt ( ) ; for ( int i = 0 ; i < N ; i ++ ) { x . add ( scan . nextInt ( ) ) ; y . add ( scan . nextInt ( ) ) ; } } public static void main ( String args [ ] ) { input ( ) ; int ans = 0 ; for ( int i = 0 ; i < N ; i ++ ) { for ( int j = 0 ; j < N ; j ++ ) { for ( int k = 0 ; k < N ; k ++ ) { if ( i != j && j != k && i != k ) { long ax = x . get ( k ) - x . get ( i ) ; long ay = y . get ( k ) - y . get ( i ) ; long bx = x . get ( j ) - x . get ( i ) ; long by = y . get ( j ) - y . get ( i ) ; long area = Math . abs ( ax * by - ay * bx ) ; if ( area > 0 && area % 2 == 0 ) ans ++ ; } } } } System . out . println ( ans / 6 ) ; } }


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s [ ] = sc . next ( ) . split ( " " , 0 ) ; int a = Integer . parseInt ( s [ 0 ] ) ; int b = Integer . parseInt ( s [ 1 ] ) ; int c = Integer . parseInt ( s [ 2 ] ) ; int d = Integer . parseInt ( s [ 3 ] ) ; if ( a + b + c + d == 7 ) System . out . println ( a + " + " + b + " + " + c + " + " + d + " = 7" ) ; else if ( a + b + c - d == 7 ) System . out . println ( a + " + " + b + " + " + c + " - " + d + " = 7" ) ; else if ( a + b - c + d == 7 ) System . out . println ( a + " + " + b + " - " + c + " + " + d + " = 7" ) ; else if ( a + b - c - d == 7 ) System . out . println ( a + " + " + b + " - " + c + " - " + d + " = 7" ) ; else if ( a - b + c + d == 7 ) System . out . println ( a + " - " + b + " + " + c + " + " + d + " = 7" ) ; else if ( a - b + c - d == 7 ) System . out . println ( a + " - " + b + " + " + c + " - " + d + " = 7" ) ; else if ( a - b - c + d == 7 ) System . out . println ( a + " - " + b + " - " + c + " + " + d + " = 7" ) ; else System . out . println ( a + " - " + b + " - " + c + " - " + d + " = 7" ) ; } }

def dfs ( s , plus , i ) : NEW_LINE INDENT i += 1 NEW_LINE if i == 4 : NEW_LINE INDENT ans = int ( s [ 0 ] ) NEW_LINE for j in range ( 1 , 4 ) : NEW_LINE INDENT ans += int ( s [ j ] ) * plus [ j - 1 ] NEW_LINE DEDENT if ans == 7 : NEW_LINE INDENT ret = s [ 0 ] NEW_LINE for k in range ( 1 , 4 ) : NEW_LINE INDENT if plus [ k - 1 ] == 1 : NEW_LINE INDENT ret += ' + ' NEW_LINE DEDENT else : NEW_LINE INDENT ret += ' - ' NEW_LINE DEDENT ret += s [ k ] NEW_LINE DEDENT ret += ' = 7' NEW_LINE print ( ret ) NEW_LINE exit ( ) NEW_LINE DEDENT return NEW_LINE DEDENT plus [ i - 1 ] = 1 NEW_LINE dfs ( s , plus , i ) NEW_LINE plus [ i - 1 ] = - 1 NEW_LINE dfs ( s , plus , i ) NEW_LINE return NEW_LINE DEDENT dfs ( input ( ) , [ 0 , 0 , 0 ] , 0 ) NEW_LINE


num = int ( input ( ) ) NEW_LINE a = num // 1000 NEW_LINE b = num % 1000 // 100 NEW_LINE c = num % 100 // 10 NEW_LINE d = num % 10 NEW_LINE if a + b + c + d == 7 : NEW_LINE INDENT print ( a , " + " , b , " + " , c , " + " , d , " = " , 7 , sep = ' ' ) NEW_LINE DEDENT elif a + b + c - d == 7 : NEW_LINE INDENT print ( a , " + " , b , " + " , c , " - " , d , " = " , 7 , sep = ' ' ) NEW_LINE DEDENT elif a + b - c + d == 7 : NEW_LINE INDENT print ( a , " + " , b , " - " , c , " + " , d , " = " , 7 , sep = ' ' ) NEW_LINE DEDENT elif a + b - c - d == 7 : NEW_LINE INDENT print ( a , " + " , b , " - " , c , " - " , d , " = " , 7 , sep = ' ' ) NEW_LINE DEDENT elif a - b + c + d == 7 : NEW_LINE INDENT print ( a , " - " , b , " + " , c , " + " , d , " = " , 7 , sep = ' ' ) NEW_LINE DEDENT elif a - b + c - d == 7 : NEW_LINE INDENT print ( a , " - " , b , " + " , c , " - " , d , " = " , 7 , sep = ' ' ) NEW_LINE DEDENT elif a - b - c + d == 7 : NEW_LINE INDENT print ( a , " - " , b , " - " , c , " + " , d , " = " , 7 , sep = ' ' ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( a , " - " , b , " - " , c , " - " , d , " = " , 7 , sep = ' ' ) NEW_LINE DEDENT


import itertools NEW_LINE num_list = input ( ) NEW_LINE rule = ' + - ' NEW_LINE for ops in itertools . product ( rule , repeat = 3 ) : NEW_LINE INDENT ans = ' { } { } { } { } { } { } { } ' . format ( num_list [ 0 ] , ops [ 0 ] , num_list [ 1 ] , ops [ 1 ] , num_list [ 2 ] , ops [ 2 ] , num_list [ 3 ] ) NEW_LINE res = eval ( ans ) NEW_LINE if res == 7 : NEW_LINE INDENT print ( ' { } = 7' . format ( ans ) ) NEW_LINE break NEW_LINE DEDENT DEDENT


( lambda o , f , A , B , C , D : any ( f ( ( ' { } ' * 7 ) . format ( A , i , B , j , C , k , D ) ) for i in o for j in o for k in o ) ) ( ' + - ' , lambda s : 7 == eval ( s ) and [ print ( s + ' = 7' ) ] , * input ( ) ) NEW_LINE


import sys NEW_LINE from sys import stdin NEW_LINE abcd = [ int ( c ) for c in list ( stdin . readline ( ) . rstrip ( ) ) ] NEW_LINE op = [ ' + ' , ' - ' ] NEW_LINE for i in op : NEW_LINE INDENT for j in op : NEW_LINE INDENT for k in op : NEW_LINE INDENT result = abcd [ 0 ] NEW_LINE if i == ' + ' : NEW_LINE INDENT result += abcd [ 1 ] NEW_LINE DEDENT else : NEW_LINE INDENT result -= abcd [ 1 ] NEW_LINE DEDENT if j == ' + ' : NEW_LINE INDENT result += abcd [ 2 ] NEW_LINE DEDENT else : NEW_LINE INDENT result -= abcd [ 2 ] NEW_LINE DEDENT if k == ' + ' : NEW_LINE INDENT result += abcd [ 3 ] NEW_LINE DEDENT else : NEW_LINE INDENT result -= abcd [ 3 ] NEW_LINE DEDENT if result == 7 : NEW_LINE INDENT print ( abcd [ 0 ] , end = ' ' ) NEW_LINE print ( i , end = ' ' ) NEW_LINE print ( abcd [ 1 ] , end = ' ' ) NEW_LINE print ( j , end = ' ' ) NEW_LINE print ( abcd [ 2 ] , end = ' ' ) NEW_LINE print ( k , end = ' ' ) NEW_LINE print ( abcd [ 3 ] , end = ' ' ) NEW_LINE print ( ' = 7' ) NEW_LINE sys . exit ( ) NEW_LINE DEDENT DEDENT DEDENT DEDENT


import java . util . Scanner ; import java . util . StringJoiner ; public class Main { private static void print ( int a , int b , int c , int d , int i , int j , int k ) { StringJoiner sj = new StringJoiner ( " " ) ; sj . add ( String . valueOf ( a ) ) ; if ( i == 0 ) { sj . add ( " + " ) ; } else { sj . add ( " - " ) ; } sj . add ( String . valueOf ( b ) ) ; if ( j == 0 ) { sj . add ( " + " ) ; } else { sj . add ( " - " ) ; } sj . add ( String . valueOf ( c ) ) ; if ( k == 0 ) { sj . add ( " + " ) ; } else { sj . add ( " - " ) ; } sj . add ( String . valueOf ( d ) ) ; sj . add ( " = 7" ) ; System . out . println ( sj . toString ( ) ) ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String [ ] n = sc . next ( ) . split ( " " ) ; int a = Integer . parseInt ( n [ 0 ] ) ; int b = Integer . parseInt ( n [ 1 ] ) ; int c = Integer . parseInt ( n [ 2 ] ) ; int d = Integer . parseInt ( n [ 3 ] ) ; for ( int i = 0 ; i < 2 ; i ++ ) { for ( int j = 0 ; j < 2 ; j ++ ) { for ( int k = 0 ; k < 2 ; k ++ ) { int sum = 0 ; if ( i == 0 ) { sum = a + b ; } else { sum = a - b ; } if ( j == 0 ) { sum += c ; } else { sum -= c ; } if ( k == 0 ) { sum += d ; } else { sum -= d ; } if ( sum == 7 ) { print ( a , b , c , d , i , j , k ) ; return ; } } } } } }


import java . util . Scanner ; public class Main { private static String [ ] results = new String [ 3 ] ; private static int [ ] input = new int [ 4 ] ; public static void main ( String args [ ] ) { Scanner scanner = new Scanner ( System . in ) ; String line = scanner . nextLine ( ) ; for ( int i = 0 ; i < line . length ( ) ; i ++ ) { input [ i ] = Character . getNumericValue ( line . charAt ( i ) ) ; } boolean flg = dfs ( 0 , input [ 0 ] ) ; String A = Integer . toString ( input [ 0 ] ) ; String B = Integer . toString ( input [ 1 ] ) ; String C = Integer . toString ( input [ 2 ] ) ; String D = Integer . toString ( input [ 3 ] ) ; System . out . print ( A + results [ 0 ] + B + results [ 1 ] + C + results [ 2 ] + D + " = 7" ) ; scanner . close ( ) ; } public static boolean dfs ( int index , int sum ) { if ( index == 3 && sum == 7 ) { return true ; } else if ( index <= 2 ) { results [ index ] = " + " ; if ( dfs ( index + 1 , sum + input [ index + 1 ] ) ) { return true ; } results [ index ] = " - " ; if ( dfs ( index + 1 , sum - input [ index + 1 ] ) ) { return true ; } } return false ; } }


import java . util . * ; public class Main { public void main ( Scanner sc ) { char s [ ] = sc . next ( ) . toCharArray ( ) ; char ans [ ] = new char [ 7 ] ; for ( int i = 0 ; i < 4 ; i ++ ) { ans [ i * 2 ] = s [ i ] ; } for ( int tmp = 0 ; tmp < ( 1 << 3 ) ; tmp ++ ) { for ( int b = 0 ; b < 3 ; b ++ ) { ans [ b * 2 + 1 ] = ( ( ( ( tmp & ( 1 << b ) ) >> b ) == 1 ) ? ' + ' : ' - ' ) ; } if ( check ( ans ) ) { System . out . println ( new String ( ans ) + " = 7" ) ; break ; } } } private boolean check ( char str [ ] ) { int ans = str [ 0 ] - '0' ; for ( int i = 0 ; i < 3 ; i ++ ) { if ( str [ i * 2 + 1 ] == ' + ' ) { ans += str [ i * 2 + 2 ] - '0' ; } else { ans -= str [ i * 2 + 2 ] - '0' ; } } return ans == 7 ; } public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { new Main ( ) . main ( sc ) ; } catch ( Exception e ) { throw e ; } } }


import java . util . * ; import static java . lang . System . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String ABCD = sc . next ( ) ; int [ ] nums = new int [ 4 ] ; for ( int i = 0 ; i < ABCD . length ( ) ; i ++ ) { nums [ i ] = Character . getNumericValue ( ABCD . charAt ( i ) ) ; } int bits = 0 ; for ( int i = 0 ; i < 1 << 3 ; i ++ ) { int tmp = nums [ 0 ] ; for ( int j = 0 ; j < 3 ; j ++ ) { if ( ( i >> j & 1 ) == 1 ) { tmp += nums [ j + 1 ] ; } else { tmp -= nums [ j + 1 ] ; } } if ( tmp == 7 ) { bits = i ; } } StringBuilder str = new StringBuilder ( ) ; str . append ( ABCD . charAt ( 0 ) ) ; for ( int j = 0 ; j < 3 ; j ++ ) { if ( ( bits >> j & 1 ) == 1 ) { str . append ( " + " ) ; } else { str . append ( " - " ) ; } str . append ( ABCD . charAt ( j + 1 ) ) ; } str . append ( " = 7" ) ; out . println ( str . toString ( ) ) ; } }


import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int N = Integer . parseInt ( in . readLine ( ) ) ; Map < Integer , List < Integer > > v = new HashMap < > ( ) ; for ( int i = 0 ; i < N + 1 ; i ++ ) { v . put ( i , new ArrayList < Integer > ( ) ) ; } for ( int i = 0 ; i < N - 1 ; i ++ ) { Integer [ ] ab = Arrays . stream ( in . readLine ( ) . split ( " ▁ " ) ) . map ( Integer :: parseInt ) . toArray ( Integer [ ] :: new ) ; v . get ( ab [ 0 ] ) . add ( ab [ 1 ] ) ; v . get ( ab [ 1 ] ) . add ( ab [ 0 ] ) ; } int [ ] fenecDist = new int [ N + 1 ] ; Arrays . fill ( fenecDist , - 1 ) ; int [ ] snukeDist = new int [ N + 1 ] ; Arrays . fill ( snukeDist , - 1 ) ; dfs ( fenecDist , v , 1 , 0 ) ; dfs ( snukeDist , v , N , 0 ) ; int [ ] fScore = new int [ N + 1 ] ; for ( int i = 1 ; i <= N ; i ++ ) { if ( fenecDist [ i ] <= snukeDist [ i ] ) { fScore [ i ] = 1 ; } } if ( Arrays . stream ( fScore ) . sum ( ) > N / 2 ) { System . out . println ( " Fennec " ) ; } else { System . out . println ( " Snuke " ) ; } } public static void dfs ( int [ ] dist , Map < Integer , List < Integer > > v , int start , int depth ) { if ( dist [ start ] > - 1 ) { return ; } dist [ start ] = depth ; for ( int i : v . get ( start ) ) { dfs ( dist , v , i , depth + 1 ) ; } } }

from scipy . sparse import * NEW_LINE n , * a = map ( int , open ( 0 ) . read ( ) . split ( ) ) NEW_LINE print ( ' FSennunkeec ' [ sum ( g > h for g , h in zip ( * csgraph . dijkstra ( csr_matrix ( ( [ 1 ] * ~ - n , ( a [ : : 2 ] , a [ 1 : : 2 ] ) ) , [ n + 1 ] * 2 ) , 0 , [ 1 , n ] ) ) ) * 2 >= n : : 2 ] ) NEW_LINE


n = int ( input ( ) ) NEW_LINE nl = { } NEW_LINE for _ in range ( n - 1 ) : NEW_LINE INDENT a , b = map ( int , input ( ) . split ( ) ) NEW_LINE if a - 1 in nl : NEW_LINE INDENT nl [ a - 1 ] . append ( b - 1 ) NEW_LINE DEDENT else : NEW_LINE INDENT nl [ a - 1 ] = [ b - 1 ] NEW_LINE DEDENT if b - 1 in nl : NEW_LINE INDENT nl [ b - 1 ] . append ( a - 1 ) NEW_LINE DEDENT else : NEW_LINE INDENT nl [ b - 1 ] = [ a - 1 ] NEW_LINE DEDENT DEDENT fenl = [ - 1 for _ in range ( n ) ] NEW_LINE sunl = [ - 1 for _ in range ( n ) ] NEW_LINE fenl [ 0 ] = 1 NEW_LINE sunl [ - 1 ] = 1 NEW_LINE now = [ 0 ] NEW_LINE while now : NEW_LINE INDENT tmp = [ ] NEW_LINE for _n in now : NEW_LINE INDENT for nxt in nl [ _n ] : NEW_LINE INDENT if fenl [ nxt ] == - 1 : NEW_LINE INDENT tmp . append ( nxt ) NEW_LINE fenl [ nxt ] = fenl [ _n ] + 1 NEW_LINE DEDENT DEDENT DEDENT now = tmp NEW_LINE DEDENT now = [ n - 1 ] NEW_LINE while now : NEW_LINE INDENT tmp = [ ] NEW_LINE for _n in now : NEW_LINE INDENT for nxt in nl [ _n ] : NEW_LINE INDENT if sunl [ nxt ] == - 1 : NEW_LINE INDENT tmp . append ( nxt ) NEW_LINE sunl [ nxt ] = sunl [ _n ] + 1 NEW_LINE DEDENT DEDENT DEDENT now = tmp NEW_LINE DEDENT fm , sm = 0 , 0 NEW_LINE for i in range ( n ) : NEW_LINE INDENT if fenl [ i ] <= sunl [ i ] : NEW_LINE INDENT fm += 1 NEW_LINE DEDENT else : NEW_LINE INDENT sm += 1 NEW_LINE DEDENT DEDENT if fm <= sm : NEW_LINE INDENT print ( ' Snuke ' ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( ' Fennec ' ) NEW_LINE DEDENT


from collections import defaultdict as dd NEW_LINE tree = dd ( list ) NEW_LINE def dfs_route ( tree , start , goal ) : NEW_LINE INDENT visited = set ( ) NEW_LINE stack = list ( ) NEW_LINE visited . add ( start ) NEW_LINE stack . append ( start ) NEW_LINE while stack : NEW_LINE INDENT node = stack [ - 1 ] NEW_LINE if node == goal : NEW_LINE INDENT return stack NEW_LINE DEDENT else : NEW_LINE INDENT child = [ x for x in tree [ node ] if x not in visited ] NEW_LINE if child == [ ] : NEW_LINE INDENT stack . pop ( ) NEW_LINE DEDENT else : NEW_LINE INDENT visited . add ( child [ 0 ] ) NEW_LINE stack . append ( child [ 0 ] ) NEW_LINE DEDENT DEDENT DEDENT DEDENT n = int ( input ( ) ) NEW_LINE for _ in range ( n - 1 ) : NEW_LINE INDENT a , b = map ( int , input ( ) . split ( ) ) NEW_LINE tree [ a ] . append ( b ) NEW_LINE tree [ b ] . append ( a ) NEW_LINE DEDENT l = dfs_route ( tree , 1 , n ) NEW_LINE fl = l [ ( len ( l ) - 1 ) // 2 ] NEW_LINE sl = l [ ( len ( l ) + 1 ) // 2 ] NEW_LINE tree [ fl ] . remove ( sl ) NEW_LINE tree [ sl ] . remove ( fl ) NEW_LINE def gr ( tree , start ) : NEW_LINE INDENT island = set ( ) NEW_LINE rest = [ start , ] NEW_LINE while rest : NEW_LINE INDENT node = rest . pop ( ) NEW_LINE island . add ( node ) NEW_LINE for x in tree [ node ] : NEW_LINE INDENT if x not in island : NEW_LINE INDENT rest . append ( x ) NEW_LINE DEDENT DEDENT DEDENT return ( island ) NEW_LINE DEDENT if len ( gr ( tree , 1 ) ) * 2 > n : NEW_LINE INDENT print ( " Fennec " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " Snuke " ) NEW_LINE DEDENT


def bfs ( graph , start , n , check ) : NEW_LINE INDENT if check == False : NEW_LINE INDENT arrival = [ 0 for i in range ( n + 1 ) ] NEW_LINE DEDENT else : NEW_LINE INDENT arrival = [ 0 for i in range ( n + 1 ) ] NEW_LINE arrival [ check ] = - 1 NEW_LINE DEDENT q = [ start ] NEW_LINE arrival [ start ] = 1 NEW_LINE while len ( q ) != 0 : NEW_LINE INDENT for i in range ( len ( graph [ q [ 0 ] ] ) ) : NEW_LINE INDENT if arrival [ graph [ q [ 0 ] ] [ i ] ] == 0 : NEW_LINE INDENT q . append ( graph [ q [ 0 ] ] [ i ] ) NEW_LINE arrival [ graph [ q [ 0 ] ] [ i ] ] = arrival [ q [ 0 ] ] + 1 NEW_LINE DEDENT DEDENT q . pop ( 0 ) NEW_LINE DEDENT return arrival NEW_LINE DEDENT n = int ( input ( ) ) NEW_LINE graph = dict ( ) NEW_LINE for i in range ( 1 , n + 1 ) : NEW_LINE INDENT graph [ i ] = [ ] NEW_LINE DEDENT for i in range ( n - 1 ) : NEW_LINE INDENT a , b = map ( int , input ( ) . split ( ) ) NEW_LINE graph [ a ] . append ( b ) NEW_LINE graph [ b ] . append ( a ) NEW_LINE DEDENT fstart = bfs ( graph , 1 , n , False ) NEW_LINE sstart = bfs ( graph , n , n , False ) NEW_LINE fennec = 0 NEW_LINE snuke = 0 NEW_LINE for i in range ( 1 , n + 1 ) : NEW_LINE INDENT if abs ( fstart [ i ] - fstart [ 1 ] ) <= abs ( sstart [ i ] - sstart [ n ] ) : NEW_LINE INDENT fennec += 1 NEW_LINE DEDENT else : NEW_LINE INDENT snuke += 1 NEW_LINE DEDENT DEDENT if fennec > snuke : NEW_LINE INDENT print ( " Fennec " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " Snuke " ) NEW_LINE DEDENT


from scipy . sparse import * ; f = lambda * z : map ( int , input ( ) . split ( ) ) ; n , = f ( ) ; c = [ 1 ] * ~ - n ; g , h = csgraph . dijkstra ( csr_matrix ( ( c , list ( zip ( * map ( f , c ) ) ) ) , [ n + 1 ] * 2 ) , 0 , [ 1 , n ] ) ; print ( ' FSennunkeec ' [ sum ( g [ i ] > h [ i ] for i in range ( n + 1 ) ) * 2 >= n : : 2 ] ) NEW_LINE


import java . util . * ; public class Main { static List < Integer > adj [ ] ; public static void addEdge ( int u , int v ) { adj [ u ] . add ( v ) ; adj [ v ] . add ( u ) ; } static class pair { int i , j ; public pair ( int i , int j ) { this . i = i ; this . j = j ; } } public static String VertexColoring ( int N ) { Queue < pair > q = new LinkedList < > ( ) ; q . offer ( new pair ( 0 , 0 ) ) ; q . offer ( new pair ( N - 1 , 1 ) ) ; int color [ ] = new int [ N ] ; Arrays . fill ( color , - 1 ) ; while ( ! q . isEmpty ( ) ) { pair p = q . poll ( ) ; if ( color [ p . i ] == - 1 ) { color [ p . i ] = p . j ; Iterator < Integer > itr = adj [ p . i ] . iterator ( ) ; while ( itr . hasNext ( ) ) { q . offer ( new pair ( itr . next ( ) , p . j ) ) ; } } } int s [ ] = new int [ 2 ] ; for ( int i = 0 ; i < N ; i ++ ) { s [ color [ i ] ] ++ ; } return s [ 0 ] > s [ 1 ] ? " Fennec " : " Snuke " ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int V = sc . nextInt ( ) ; adj = new LinkedList [ V ] ; for ( int i = 0 ; i < V ; i ++ ) { adj [ i ] = new LinkedList < > ( ) ; } for ( int i = 0 ; i < V - 1 ; i ++ ) { int u = sc . nextInt ( ) ; int v = sc . nextInt ( ) ; u -- ; v -- ; addEdge ( u , v ) ; } System . out . println ( VertexColoring ( V ) ) ; } } Note : . / Main . java uses unchecked or unsafe operations . Note : Recompile with - Xlint : unchecked for details .


import java . util . * ; public class Main { int ni ( ) { return cin . nextInt ( ) ; } long nl ( ) { return cin . nextLong ( ) ; } String line ( ) { return cin . nextLine ( ) ; } void println ( String str ) { System . out . println ( str ) ; } void print ( String str ) { System . out . print ( str ) ; } static final int MOD = 1000000007 ; Scanner cin = new Scanner ( System . in ) ; String output ; public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } public void run ( ) { input ( ) ; int res = solve ( ) ; output = res + " " ; println ( output ) ; } int H , W ; void input ( ) { H = ni ( ) ; W = ni ( ) ; if ( W > H ) { W = H + W ; H = W - H ; W = W - H ; } } int solve ( ) { if ( H % 3 == 0 || W % 3 == 0 ) { return 0 ; } return Math . min ( cal ( H , W ) , cal ( W , H ) ) ; } int cal ( long h , long w ) { long res = w ; for ( long i = h / 3 ; i <= h / 2 ; i ++ ) { long a [ ] = new long [ 3 ] ; a [ 0 ] = ( i ) * w ; a [ 1 ] = ( h - i ) * ( w / 2 ) ; a [ 2 ] = ( h - i ) * ( w - w / 2 ) ; Arrays . sort ( a ) ; res = Math . min ( res , a [ 2 ] - a [ 0 ] ) ; } return ( int ) res ; } }

import sys NEW_LINE import collections NEW_LINE import math NEW_LINE from collections import Counter NEW_LINE from collections import deque NEW_LINE H , W = [ int ( x ) for x in input ( ) . split ( ) ] NEW_LINE ans = 10 ** 10 NEW_LINE def calc1 ( H , W ) : NEW_LINE INDENT if H % 3 == 0 : NEW_LINE INDENT return 0 NEW_LINE DEDENT else : NEW_LINE INDENT return W NEW_LINE DEDENT DEDENT def calc2 ( H , W ) : NEW_LINE INDENT ret = 10 ** 10 NEW_LINE for w in range ( 1 , W ) : NEW_LINE INDENT s1 = w * H NEW_LINE h = H // 2 NEW_LINE s2 = h * ( W - w ) NEW_LINE s3 = ( H - h ) * ( W - w ) NEW_LINE maxS = max ( s1 , s2 , s3 ) NEW_LINE minS = min ( s1 , s2 , s3 ) NEW_LINE ret = min ( abs ( maxS - minS ) , ret ) NEW_LINE DEDENT return ret NEW_LINE DEDENT s1 = calc1 ( H , W ) NEW_LINE s2 = calc1 ( W , H ) NEW_LINE s3 = calc2 ( H , W ) NEW_LINE s4 = calc2 ( W , H ) NEW_LINE print ( min ( s1 , s2 , s3 , s4 ) ) NEW_LINE sys . exit ( 0 ) NEW_LINE


h , w = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE if not ( h % 3 ) * ( w % 3 ) : NEW_LINE INDENT print ( 0 ) NEW_LINE exit ( ) NEW_LINE DEDENT def calc_T ( h , w ) : NEW_LINE INDENT bars = [ ] NEW_LINE first_cut = w // 3 + w % 3 - 1 NEW_LINE bars . append ( first_cut * h ) NEW_LINE bars . append ( ( h // 2 ) * ( w - first_cut ) ) NEW_LINE bars . append ( h * w - sum ( bars ) ) NEW_LINE return max ( bars ) - min ( bars ) NEW_LINE DEDENT print ( min ( calc_T ( h , w ) , calc_T ( w , h ) , h , w ) ) NEW_LINE


from math import ceil NEW_LINE H , W = map ( int , input ( ) . split ( ) ) NEW_LINE ans = float ( " inf " ) NEW_LINE for h in range ( 1 , H ) : NEW_LINE INDENT m = min ( h * W , ( H - h ) * ( W // 2 ) , ( H - h ) * ceil ( W / 2 ) ) NEW_LINE M = max ( h * W , ( H - h ) * ( W // 2 ) , ( H - h ) * ceil ( W / 2 ) ) NEW_LINE ans = min ( ans , M - m ) NEW_LINE m = min ( h * W , ( ( H - h ) // 2 ) * ( W ) , ceil ( ( H - h ) / 2 ) * ( W ) ) NEW_LINE M = max ( h * W , ( ( H - h ) // 2 ) * ( W ) , ceil ( ( H - h ) / 2 ) * ( W ) ) NEW_LINE ans = min ( ans , M - m ) NEW_LINE DEDENT for w in range ( 1 , W ) : NEW_LINE INDENT m = min ( w * H , ( W - w ) * ( H // 2 ) , ( W - w ) * ceil ( H / 2 ) ) NEW_LINE M = max ( w * H , ( W - w ) * ( H // 2 ) , ( W - w ) * ceil ( H / 2 ) ) NEW_LINE ans = min ( ans , M - m ) NEW_LINE m = min ( w * H , ( ( W - w ) // 2 ) * H , ceil ( ( W - w ) / 2 ) * H ) NEW_LINE M = max ( w * H , ( ( W - w ) // 2 ) * H , ceil ( ( W - w ) / 2 ) * H ) NEW_LINE ans = min ( ans , M - m ) NEW_LINE DEDENT print ( ans ) NEW_LINE


H , W = ( int ( i ) for i in input ( ) . split ( ) ) NEW_LINE ans = float ( " inf " ) NEW_LINE for i in range ( 1 , H ) : NEW_LINE INDENT a , b = ( i , W ) NEW_LINE S = W * ( H - i ) NEW_LINE if a % 2 == 0 or b % 2 == 0 : NEW_LINE INDENT ans = min ( ans , abs ( S - a * b // 2 ) ) NEW_LINE DEDENT else : NEW_LINE INDENT if a == 1 and b == 1 : NEW_LINE INDENT continue NEW_LINE DEDENT else : NEW_LINE INDENT Sbig = ( max ( a , b ) + 1 ) * min ( a , b ) // 2 NEW_LINE Ssma = ( max ( a , b ) - 1 ) * min ( a , b ) // 2 NEW_LINE Sdiff = max ( abs ( S - Sbig ) , abs ( S - Ssma ) , abs ( Sbig - Ssma ) ) NEW_LINE ans = min ( ans , Sdiff ) NEW_LINE DEDENT DEDENT DEDENT H , W = ( W , H ) NEW_LINE for i in range ( 1 , H ) : NEW_LINE INDENT a , b = ( i , W ) NEW_LINE S = W * ( H - i ) NEW_LINE if a % 2 == 0 or b % 2 == 0 : NEW_LINE INDENT ans = min ( ans , abs ( S - a * b // 2 ) ) NEW_LINE DEDENT else : NEW_LINE INDENT if a == 1 and b == 1 : NEW_LINE INDENT continue NEW_LINE DEDENT else : NEW_LINE INDENT Sbig = ( max ( a , b ) + 1 ) * min ( a , b ) // 2 NEW_LINE Ssma = ( max ( a , b ) - 1 ) * min ( a , b ) // 2 NEW_LINE Sdiff = max ( abs ( S - Sbig ) , abs ( S - Ssma ) , abs ( Sbig - Ssma ) ) NEW_LINE ans = min ( ans , Sdiff ) NEW_LINE DEDENT DEDENT DEDENT print ( ans ) NEW_LINE


import sys NEW_LINE def inpl ( ) : return [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE H , W = inpl ( ) NEW_LINE if H % 3 == 0 or W % 3 == 0 : NEW_LINE INDENT print ( 0 ) NEW_LINE sys . exit ( ) NEW_LINE DEDENT if H == 2 or W == 2 : NEW_LINE INDENT print ( 1 ) NEW_LINE sys . exit ( ) NEW_LINE DEDENT a = W // 3 NEW_LINE b = W % 3 NEW_LINE c = H // 3 NEW_LINE d = H % 3 NEW_LINE ans = float ( ' inf ' ) NEW_LINE for i in range ( b + 1 ) : NEW_LINE INDENT ans = min ( ans , max ( H * ( a + i ) , ( H // 2 + H % 2 ) * ( W - a - i ) , ( H // 2 ) * ( W - a - i ) ) - min ( H * ( a + i ) , ( H // 2 + H % 2 ) * ( W - a - i ) , ( H // 2 ) * ( W - a - i ) ) ) NEW_LINE DEDENT for i in range ( d + 1 ) : NEW_LINE INDENT ans = min ( ans , max ( W * ( c + i ) , ( W // 2 + W % 2 ) * ( H - c - i ) , ( W // 2 ) * ( H - c - i ) ) - min ( W * ( c + i ) , ( W // 2 + W % 2 ) * ( H - c - i ) , ( W // 2 ) * ( H - c - i ) ) ) NEW_LINE DEDENT print ( min ( ans , H , W ) ) NEW_LINE


import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; CChocolateBar solver = new CChocolateBar ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class CChocolateBar { public void solve ( int testNumber , Scanner in , PrintWriter out ) { long h = in . nextInt ( ) , w = in . nextInt ( ) ; if ( h * w % 3 == 0 ) { out . println ( 0 ) ; return ; } long ans = Math . min ( h , w ) ; for ( int x = 0 ; x <= w ; x ++ ) { long s1 = ( w - x ) * h ; long s2 = x * ( h / 2 ) ; long s3 = x * ( ( h + 1 ) / 2 ) ; ans = Math . min ( ans , Math . max ( s1 , s3 ) - Math . min ( s1 , s2 ) ) ; } for ( int y = 0 ; y <= h ; y ++ ) { long s1 = w * ( h - y ) ; long s2 = ( w / 2 ) * y ; long s3 = ( ( w + 1 ) / 2 ) * y ; ans = Math . min ( ans , Math . max ( s1 , s3 ) - Math . min ( s1 , s2 ) ) ; } out . println ( ans ) ; } } }


import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner cin = new Scanner ( System . in ) ; int H = cin . nextInt ( ) ; int W = cin . nextInt ( ) ; cin . close ( ) ; long result = 0L ; if ( W == H ) { result = calcMin ( H , W ) ; } else { result = Math . min ( calcMin ( H , W ) , calcMin ( W , H ) ) ; } System . out . println ( result ) ; } public static long calcMin ( int H , int W ) { long S1 = 0L ; long S2 = 0L ; long S3 = 0L ; long S4 = 0L ; long S5 = 0L ; long Smin = Long . MAX_VALUE ; long tmpS ; for ( long i = 1 ; i < H ; i ++ ) { S1 = i * W ; S2 = ( H - i ) * ( W / 2 ) ; S3 = ( H - i ) * ( W - ( W / 2 ) ) ; tmpS = Math . max ( Math . max ( S1 , S2 ) , S3 ) - Math . min ( Math . min ( S1 , S2 ) , S3 ) ; if ( tmpS < Smin ) { Smin = tmpS ; } if ( i <= H - 2 ) { S4 = W * ( ( H - i ) / 2 ) ; S5 = W * ( H - i - ( ( H - i ) / 2 ) ) ; tmpS = Math . max ( Math . max ( S1 , S4 ) , S5 ) - Math . min ( Math . min ( S1 , S4 ) , S5 ) ; if ( tmpS < Smin ) { Smin = tmpS ; } } } return Smin ; } }


import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long h = sc . nextInt ( ) ; long w = sc . nextInt ( ) ; long a1 = calc ( h , w ) ; long a2 = calc ( w , h ) ; long ans = a1 > a2 ? a2 : a1 ; System . out . println ( ans ) ; } public static long calc ( long i1 , long i2 ) { long [ ] ss = new long [ 3 ] ; long ans = Long . MAX_VALUE ; long sMax , sMin ; for ( int j = 1 ; j < i1 ; j ++ ) { ss [ 0 ] = j * i2 ; for ( int k = 0 ; k < 2 ; k ++ ) { sMax = Long . MIN_VALUE ; sMin = Long . MAX_VALUE ; if ( k == 0 ) ss [ 1 ] = ( i1 - j ) * ( i2 / 2 ) ; else ss [ 1 ] = ( ( i1 - j ) / 2 ) * i2 ; ss [ 2 ] = ( i1 * i2 ) - ( ss [ 0 ] + ss [ 1 ] ) ; for ( int i = 0 ; i < 3 ; i ++ ) { if ( sMax < ss [ i ] ) sMax = ss [ i ] ; if ( sMin > ss [ i ] ) sMin = ss [ i ] ; } if ( ans > ( sMax - sMin ) ) ans = sMax - sMin ; } } return ans ; } }


import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskC solver = new TaskC ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskC { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int h = in . nextInt ( ) , w = in . nextInt ( ) ; if ( h % 3 == 0 || w % 3 == 0 ) { out . println ( 0 ) ; } else { int res = Integer . MAX_VALUE ; if ( h > 2 ) res = Math . min ( res , w ) ; if ( w > 2 ) res = Math . min ( res , h ) ; int tmp = Math . min ( gao ( h , w ) , gao ( w , h ) ) ; out . println ( Math . min ( res , tmp ) ) ; } } private int gao ( int h , int w ) { int base = h / 3 , remain = h % 3 ; int res = Integer . MAX_VALUE ; for ( int i = 0 ; i <= remain ; ++ i ) { int first = w * ( base + i ) , second , third ; if ( w % 2 == 0 ) { second = third = ( h - base - i ) * ( w / 2 ) ; res = Math . min ( res , Math . abs ( first - second ) ) ; } else { second = ( h - base - i ) * ( w / 2 ) ; third = ( h - base - i ) * w - second ; int lower = Math . min ( first , second ) , upper = Math . max ( first , third ) ; res = Math . min ( res , upper - lower ) ; } } return res ; } } }


import java . util . Scanner ; public static void main ( String [ ] args ) { private static void q_1 ( ) { }

h1 = int ( input ( ) ) NEW_LINE h2 = int ( input ( ) ) NEW_LINE print ( h1 - h2 ) NEW_LINE


print ( int ( input ( ) ) - int ( input ( ) ) ) NEW_LINE


import sys NEW_LINE h1 = int ( sys . stdin . readline ( ) ) NEW_LINE h2 = int ( sys . stdin . readline ( ) ) NEW_LINE print ( h1 - h2 ) NEW_LINE


H1 , H2 = [ int ( input ( ) ) for _ in range ( 2 ) ] NEW_LINE print ( H1 - H2 ) NEW_LINE


a = int ( input ( ) ) NEW_LINE b = int ( input ( ) ) NEW_LINE print ( " { } " . format ( a - b ) ) NEW_LINE


import java . io . * ; int h1 = Integer . parseInt ( br . readLine ( ) ) ;


import java . util . Scanner ; Main main = new Main ( ) ; sc . close ( ) ; int s = sc . nextInt ( ) ;


import java . io . PrintWriter ; public static void main ( String args [ ] ) { int answer = 0 ; }


import java . util . Scanner ; Scanner scanner = new Scanner ( System . in ) ; }


import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String line = sc . nextLine ( ) ; if ( line . equals ( " A " ) ) { System . out . println ( " T " ) ; } else if ( line . equals ( " T " ) ) { System . out . println ( " A " ) ; } else if ( line . equals ( " C " ) ) { System . out . println ( " G " ) ; } else if ( line . equals ( " G " ) ) { System . out . println ( " C " ) ; } } }

a = str ( input ( ) ) NEW_LINE x = { " A " : " T " , " T " : " A " , " C " : " G " , " G " : " C " } NEW_LINE print ( x [ a ] ) NEW_LINE


b = input ( ) NEW_LINE if b == ' A ' : NEW_LINE INDENT output = ' T ' NEW_LINE DEDENT elif b == ' C ' : NEW_LINE INDENT output = ' G ' NEW_LINE DEDENT elif b == ' G ' : NEW_LINE INDENT output = ' C ' NEW_LINE DEDENT elif b == ' T ' : NEW_LINE INDENT output = ' A ' NEW_LINE DEDENT else : NEW_LINE INDENT pass NEW_LINE DEDENT print ( output ) NEW_LINE


import sys NEW_LINE def i2s ( ) : NEW_LINE INDENT return sys . stdin . readline ( ) . rstrip ( ) NEW_LINE DEDENT def ii2ss ( n ) : NEW_LINE INDENT return [ sys . stdin . readline ( ) for _ in range ( n ) ] NEW_LINE DEDENT def sp2nn ( sp , sep = ' ▁ ' ) : NEW_LINE INDENT return [ int ( s ) for s in sp . split ( sep ) ] NEW_LINE DEDENT def ss2nn ( ss ) : NEW_LINE INDENT return [ int ( s ) for s in list ( ss ) ] NEW_LINE DEDENT def main ( s ) : NEW_LINE INDENT dic = { ' A ' : ' T ' , ' T ' : ' A ' , ' C ' : ' G ' , ' G ' : ' C ' , } NEW_LINE print ( dic [ s ] ) NEW_LINE DEDENT main ( i2s ( ) ) NEW_LINE


enki = input ( ) NEW_LINE if ( enki == " A " ) : NEW_LINE INDENT print ( " T " ) NEW_LINE DEDENT elif ( enki == " T " ) : NEW_LINE INDENT print ( " A " ) NEW_LINE DEDENT elif ( enki == " G " ) : NEW_LINE INDENT print ( " C " ) NEW_LINE DEDENT elif ( enki == " C " ) : NEW_LINE INDENT print ( " G " ) NEW_LINE DEDENT


b = str ( input ( ) ) NEW_LINE if b == ' A ' : NEW_LINE INDENT print ( " T " ) NEW_LINE DEDENT elif b == ' C ' : NEW_LINE INDENT print ( ' G ' ) NEW_LINE DEDENT elif b == ' G ' : NEW_LINE INDENT print ( ' C ' ) NEW_LINE DEDENT elif b == ' T ' : NEW_LINE INDENT print ( ' A ' ) NEW_LINE DEDENT


import java . math . BigDecimal ; import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import java . util . Scanner ; public class Main { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { String s1 = sc . next ( ) ; if ( s1 . equals ( " A " ) ) { s1 = " T " ; } else if ( s1 . equals ( " T " ) ) { s1 = " A " ; } if ( s1 . equals ( " G " ) ) { s1 = " C " ; } else if ( s1 . equals ( " C " ) ) { s1 = " G " ; } System . out . println ( s1 ) ; System . out . flush ( ) ; sc . close ( ) ; } }


import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String b = sc . nextLine ( ) ; String str = " " ; switch ( b ) { case " A " : str = " T " ; break ; case " T " : str = " A " ; break ; case " C " : str = " G " ; break ; case " G " : str = " C " ; break ; default : break ; } System . out . println ( str ) ; } }


import java . util . Scanner ; class Main { public static void main ( String args [ ] ) { Main main = new Main ( ) ; main . start ( ) ; } public void start ( ) { Scanner sc = new Scanner ( System . in ) ; String str = sc . next ( ) ; if ( str . equals ( " A " ) ) System . out . println ( " T " ) ; if ( str . equals ( " T " ) ) System . out . println ( " A " ) ; if ( str . equals ( " C " ) ) System . out . println ( " G " ) ; if ( str . equals ( " G " ) ) System . out . println ( " C " ) ; } }


import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int x = 0 ; try { x = System . in . read ( ) ; } catch ( IOException e ) { System . err . println ( " ? ? ? ? ? ? ? ? " ) ; } System . out . println ( ( char ) x == ' A ' ? " T " : ( char ) x == ' T ' ? " A " : ( char ) x == ' C ' ? " G " : " C " ) ; } }


import java . util . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int h = sc . nextInt ( ) ; int w = sc . nextInt ( ) ; System . out . println ( ( h - 1 ) * w + h * ( w - 1 ) ) ; } }

W , H = map ( int , input ( ) . split ( ) ) NEW_LINE res = ( W - 1 ) * H + ( H - 1 ) * W NEW_LINE print ( res ) NEW_LINE


H , W = map ( int , input ( ) . split ( ) ) NEW_LINE if H == 1 and W == 1 : NEW_LINE INDENT ans = 0 NEW_LINE DEDENT elif H == 1 : NEW_LINE INDENT ans = W - 1 NEW_LINE DEDENT elif W == 1 : NEW_LINE INDENT ans = H - 1 NEW_LINE DEDENT else : NEW_LINE INDENT ans = ( H - 1 ) * W + H * ( W - 1 ) NEW_LINE DEDENT print ( ans ) NEW_LINE


def main ( ) : NEW_LINE INDENT h , w = map ( int , input ( ) . split ( ) ) NEW_LINE print ( 2 * ( h - 1 ) * ( w - 1 ) + h - 1 + w - 1 ) NEW_LINE DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT main ( ) NEW_LINE DEDENT


def ma ( ) : return map ( int , input ( ) . split ( ) ) NEW_LINE a , b = ma ( ) NEW_LINE print ( ( a - 1 ) * b + a * ( b - 1 ) ) NEW_LINE


H , W = [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE print ( ( W - 1 ) * H + ( H - 1 ) * W ) NEW_LINE


import java . util . Scanner ; import java . util . stream . IntStream ; public class Main { static final Scanner s = new Scanner ( System . in ) ; static int getInt ( ) { return Integer . parseInt ( s . next ( ) ) ; } public static void main ( String [ ] __ ) { int x = getInt ( ) , y = getInt ( ) ; System . out . println ( ( x - 1 ) * y + x * ( y - 1 ) ) ; } }


import java . util . Scanner ; public class Main { static Scanner in ; void solve ( ) { int h = in . nextInt ( ) , w = in . nextInt ( ) ; if ( h * w == 1 ) { System . out . println ( 0 ) ; return ; } if ( h == 1 ) { System . out . println ( w - 1 ) ; return ; } if ( w == 1 ) { System . out . println ( h - 1 ) ; return ; } System . out . println ( ( ( h - 1 ) * w + h * ( w - 1 ) ) ) ; } public static void main ( String [ ] args ) { in = new Scanner ( System . in ) ; new Main ( ) . solve ( ) ; } }


import java . util . * ; public class Main { static int count = 0 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int h = sc . nextInt ( ) ; int w = sc . nextInt ( ) ; int ans = 0 ; if ( h >= 2 ) { ans += ( h - 1 ) * w ; } if ( w >= 2 ) { ans += ( w - 1 ) * h ; } System . out . println ( ans ) ; } }


import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { new Main ( ) . solve ( ) ; } void solve ( ) { Scanner sc = new Scanner ( System . in ) ; int ans = 0 ; int h = sc . nextInt ( ) ; int w = sc . nextInt ( ) ; ans += 4 * 2 + 3 * ( h - 2 + w - 2 ) * 2 + 4 * ( h - 2 ) * ( w - 2 ) ; ans /= 2 ; System . out . println ( ans ) ; } }


import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Printer pr = new Printer ( System . out ) ; char [ ] s = sc . next ( ) . toCharArray ( ) ; int [ ] cnt = new int [ 26 ] ; for ( char c : s ) { cnt [ c - ' a ' ] ++ ; } int odd = 0 ; for ( int e : cnt ) { if ( e % 2 == 1 ) { odd ++ ; } } if ( odd == 0 ) { pr . println ( s . length ) ; } else { pr . println ( Math . max ( 1 , ( s . length - odd ) / 2 / odd * 2 + 1 ) ) ; } pr . close ( ) ; sc . close ( ) ; } @ SuppressWarnings ( " unused " ) private static class Scanner { BufferedReader br ; Iterator < String > it ; Scanner ( InputStream in ) { br = new BufferedReader ( new InputStreamReader ( in ) ) ; } String next ( ) throws RuntimeException { try { if ( it == null || ! it . hasNext ( ) ) { it = Arrays . asList ( br . readLine ( ) . split ( " ▁ " ) ) . iterator ( ) ; } return it . next ( ) ; } catch ( IOException e ) { throw new IllegalStateException ( ) ; } } int nextInt ( ) throws RuntimeException { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) throws RuntimeException { return Long . parseLong ( next ( ) ) ; } float nextFloat ( ) throws RuntimeException { return Float . parseFloat ( next ( ) ) ; } double nextDouble ( ) throws RuntimeException { return Double . parseDouble ( next ( ) ) ; } void close ( ) { try { br . close ( ) ; } catch ( IOException e ) { } } } private static class Printer extends PrintWriter { Printer ( PrintStream out ) { super ( out ) ; } } }

S = list ( map ( lambda x : ord ( x ) - ord ( ' a ' ) , list ( input ( ) ) ) ) NEW_LINE c = [ 0 ] * 26 NEW_LINE for s in S : NEW_LINE INDENT c [ s ] += 1 NEW_LINE DEDENT pair = 0 NEW_LINE odd = 0 NEW_LINE for n in c : NEW_LINE INDENT if n % 2 == 1 : NEW_LINE INDENT odd += 1 NEW_LINE DEDENT pair += n // 2 NEW_LINE DEDENT if odd == 0 : NEW_LINE INDENT print ( len ( S ) ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( pair // odd * 2 + 1 ) NEW_LINE DEDENT


from collections import Counter NEW_LINE a = Counter ( list ( input ( ) . strip ( ) ) ) NEW_LINE x = 0 NEW_LINE y = 0 NEW_LINE for i , j in a . most_common ( ) : NEW_LINE INDENT x += j // 2 NEW_LINE if j % 2 == 1 : NEW_LINE INDENT y += 1 NEW_LINE DEDENT DEDENT print ( x // y * 2 + 1 if y >= 1 else x * 2 ) NEW_LINE


s = input ( ) NEW_LINE lis = [ ] NEW_LINE num = [ ] NEW_LINE cou = 0 NEW_LINE even = 0 NEW_LINE for n in range ( len ( s ) ) : NEW_LINE INDENT if s [ n ] in lis : continue NEW_LINE else : NEW_LINE INDENT num . append ( s . count ( s [ n ] ) ) NEW_LINE lis . append ( s [ n ] ) NEW_LINE DEDENT DEDENT for item in num : NEW_LINE INDENT cou += item % 2 NEW_LINE even += item NEW_LINE DEDENT even -= cou NEW_LINE if cou == 0 : NEW_LINE INDENT print ( int ( len ( s ) ) ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( int ( even / ( 2 * cou ) ) * 2 + 1 ) NEW_LINE DEDENT


def b_splited_palindrome ( S ) : NEW_LINE INDENT from collections import Counter NEW_LINE num_charactor_appeared = Counter ( S ) NEW_LINE num_appeared_odd_time = len ( [ 1 for v in num_charactor_appeared . values ( ) if v % 2 == 1 ] ) NEW_LINE ans = len ( S ) if num_appeared_odd_time == 0 else 2 * ( ( len ( S ) - num_appeared_odd_time ) // ( 2 * num_appeared_odd_time ) ) + 1 NEW_LINE return ans NEW_LINE DEDENT S = input ( ) NEW_LINE print ( b_splited_palindrome ( S ) ) NEW_LINE


from collections import defaultdict NEW_LINE S = list ( input ( ) ) NEW_LINE N = len ( S ) NEW_LINE cnt = defaultdict ( int ) NEW_LINE for c in S : NEW_LINE INDENT cnt [ c ] += 1 NEW_LINE DEDENT K = 0 NEW_LINE for value in cnt . values ( ) : NEW_LINE INDENT if value % 2 != 0 : NEW_LINE INDENT K += 1 NEW_LINE DEDENT DEDENT res = 0 NEW_LINE if K == 0 : NEW_LINE INDENT res = N NEW_LINE DEDENT else : NEW_LINE INDENT res = 2 * ( ( N - K ) // ( 2 * K ) ) + 1 NEW_LINE DEDENT print ( res ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . UncheckedIOException ; import java . util . StringTokenizer ; class Main { public static void main ( String [ ] args ) { SC sc = new SC ( System . in ) ; String s = sc . next ( ) ; int [ ] alpha = new int [ 26 ] ; for ( int i = 0 ; i < 26 ; i ++ ) { alpha [ i ] = 0 ; } for ( int i = 0 ; i < s . length ( ) ; i ++ ) { alpha [ ( s . charAt ( i ) ) - 97 ] ++ ; } int kisu = 0 ; int use = 0 ; for ( int i = 0 ; i < 26 ; i ++ ) { if ( alpha [ i ] % 2 == 1 ) { use += alpha [ i ] - 1 ; kisu ++ ; } else { use += alpha [ i ] ; } } if ( kisu == 0 ) { System . out . println ( ( use ) ) ; } else { System . out . println ( ( 1 + 2 * ( use / ( kisu * 2 ) ) ) ) ; } } static class SC { private BufferedReader reader = null ; private StringTokenizer tokenizer = null ; public SC ( InputStream in ) { reader = new BufferedReader ( new InputStreamReader ( in ) ) ; } public String next ( ) { if ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new UncheckedIOException ( e ) ; } } return tokenizer . nextToken ( ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } public long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } } }