import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int t = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; double minSub = 1000.0 ; int ans = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { int h = sc . nextInt ( ) ; double sub = Math . abs ( a - ( t - h * 0.006 ) ) ; if ( sub < minSub ) { minSub = sub ; ans = i ; } } System . out . println ( ans ) ; sc . close ( ) ; } }

import java . io . * ; import java . util . Scanner ; import java . lang . Math ; import java . util . Arrays ; import java . util . List ; import java . util . stream . Collectors ; class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int N = scanner . nextInt ( ) ; double T = scanner . nextDouble ( ) ; int A = scanner . nextInt ( ) ; double H [ ] = new double [ N ] ; double tmp [ ] = new double [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { H [ i ] = scanner . nextDouble ( ) ; tmp [ i ] = Math . abs ( A - ( T - H [ i ] * 0.006 ) ) ; } double min = tmp [ 0 ] ; int imin = 1 ; for ( int i = 0 ; i < N ; i ++ ) { if ( min >= tmp [ i ] ) { min = tmp [ i ] ; imin = i + 1 ; } } System . out . println ( imin ) ; scanner . close ( ) ; } }

import java . util . * ; public class Main { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int N = sc . nextInt ( ) ; int T = sc . nextInt ( ) ; int A = sc . nextInt ( ) ; int ans = 0 ; double minDiff = Double . MAX_VALUE ; for ( int i = 0 ; i < N ; i ++ ) { int h = sc . nextInt ( ) ; double temp = ( double ) T - ( ( ( double ) h ) * 0.006 ) ; double diff = Math . abs ( ( double ) A - temp ) ; if ( minDiff > diff ) { minDiff = diff ; ans = i + 1 ; } } System . out . println ( ans ) ; } }

import java . util . * ; public class Main { public static void main ( String [ ] args ) { Main main = new Main ( ) ; main . solve ( ) ; } private void solve ( ) { Scanner scanner = new Scanner ( System . in ) ; int N = scanner . nextInt ( ) ; int T = scanner . nextInt ( ) ; int A = scanner . nextInt ( ) ; double nearOndo = 0 ; int nearIndex = 26 ; for ( int index = 0 ; index < N ; index ++ ) { int temp = scanner . nextInt ( ) ; double ondo = T - ( temp * 0.006 ) ; if ( index == 0 ) { nearOndo = ondo ; nearIndex = index ; } else if ( Math . abs ( ondo - A ) < Math . abs ( nearOndo - A ) ) { nearOndo = ondo ; nearIndex = index ; } } System . out . println ( nearIndex + 1 ) ; } }

import java . util . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int T = scan . nextInt ( ) ; int A = scan . nextInt ( ) ; int [ ] H = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { H [ i ] = scan . nextInt ( ) ; } double [ ] t = new double [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { t [ i ] = T - 0.006 * H [ i ] ; } double rest = Math . abs ( t [ 0 ] - A ) ; int key = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( rest > Math . abs ( t [ i ] - A ) ) { rest = Math . abs ( t [ i ] - A ) ; key = i ; } } System . out . print ( key + 1 ) ; } }

N = int ( input ( ) ) NEW_LINE T , A = map ( int , input ( ) . split ( ) ) NEW_LINE H = [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE d = 10 ** 4 NEW_LINE n = 0 NEW_LINE for j in range ( N ) : NEW_LINE INDENT dj = abs ( A - ( T - H [ j ] * 0.006 ) ) NEW_LINE if dj < d : NEW_LINE INDENT d = dj NEW_LINE n = j NEW_LINE DEDENT DEDENT print ( n + 1 ) NEW_LINE

import sys NEW_LINE INF = float ( " inf " ) NEW_LINE def argmin ( a ) : NEW_LINE INDENT m , n = INF , - 1 NEW_LINE for i , v in enumerate ( a ) : NEW_LINE INDENT if m > v : NEW_LINE INDENT m , n = v , i NEW_LINE DEDENT DEDENT return m , n NEW_LINE DEDENT def solve ( N : int , T : int , A : int , H : " List [ int ] " ) : NEW_LINE INDENT print ( argmin ( [ abs ( T - h * 0.006 - A ) for h in H ] ) [ 1 ] + 1 ) NEW_LINE return NEW_LINE DEDENT def main ( ) : NEW_LINE INDENT def iterate_tokens ( ) : NEW_LINE INDENT for line in sys . stdin : NEW_LINE INDENT for word in line . split ( ) : NEW_LINE INDENT yield word NEW_LINE DEDENT DEDENT DEDENT tokens = iterate_tokens ( ) NEW_LINE N = int ( next ( tokens ) ) NEW_LINE T = int ( next ( tokens ) ) NEW_LINE A = int ( next ( tokens ) ) NEW_LINE H = [ int ( next ( tokens ) ) for _ in range ( N ) ] NEW_LINE solve ( N , T , A , H ) NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT main ( ) NEW_LINE DEDENT

candidate = int ( input ( ) ) NEW_LINE ave_temp , ide_temp = map ( float , input ( ) . split ( ' ▁ ' ) ) NEW_LINE ls_candidate = [ abs ( ( ave_temp - ( float ( x ) * 0.006 ) - ide_temp ) ) for x in input ( ) . split ( ' ▁ ' ) ] NEW_LINE for x , i in enumerate ( ls_candidate ) : NEW_LINE INDENT if ls_candidate [ x ] == min ( ls_candidate ) : NEW_LINE INDENT print ( x + 1 ) NEW_LINE break NEW_LINE DEDENT DEDENT

import sys NEW_LINE diff = sys . maxsize NEW_LINE ans = " " NEW_LINE N = int ( input ( ) ) NEW_LINE T , A = map ( int , input ( ) . split ( ) ) NEW_LINE H = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE for i in range ( 0 , N ) : NEW_LINE INDENT t = T - H [ i ] * .006 NEW_LINE d = abs ( A - t ) NEW_LINE if diff > d : NEW_LINE INDENT ans = i + 1 NEW_LINE diff = d NEW_LINE DEDENT DEDENT print ( ans ) NEW_LINE

n = int ( input ( ) ) NEW_LINE base_t , a = map ( int , input ( ) . split ( ) ) NEW_LINE hs = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE t = [ base_t - 0.006 * x for x in hs ] NEW_LINE dif = [ abs ( ti - a ) for ti in t ] NEW_LINE for i in range ( n ) : NEW_LINE INDENT if dif [ i ] == min ( dif ) : NEW_LINE INDENT print ( i + 1 ) NEW_LINE DEDENT DEDENT


import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int min = sc . nextInt ( ) ; int max = sc . nextInt ( ) ; int now = 0 ; for ( int i = 0 ; i < N ; i ++ ) { String a = sc . next ( ) ; int id = sc . nextInt ( ) ; if ( id < min ) { id = min ; } else if ( id > max ) { id = max ; } if ( a . charAt ( 0 ) == ' E ' ) { now += id ; } else if ( a . charAt ( 0 ) == ' W ' ) { now -= id ; } } if ( now > 0 ) { System . out . println ( " East ▁ " + now ) ; } else if ( now < 0 ) { System . out . println ( " West ▁ " + ( now * - 1 ) ) ; } else { System . out . println ( 0 ) ; } } }

import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . io . UncheckedIOException ; import java . util . StringTokenizer ; import java . io . IOException ; 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 ; LightScanner in = new LightScanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; B solver = new B ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class B { public void solve ( int testNumber , LightScanner in , PrintWriter out ) { int n = in . ints ( ) , a = in . ints ( ) , b = in . ints ( ) ; int x = 0 ; for ( int i = 0 ; i < n ; i ++ ) { String s = in . string ( ) ; int d = Math . max ( a , Math . min ( b , in . ints ( ) ) ) ; if ( s . equals ( " East " ) ) { x += d ; } else { x -= d ; } } if ( x == 0 ) { out . println ( 0 ) ; } else if ( x > 0 ) { out . println ( " East ▁ " + x ) ; } else { out . println ( " West ▁ " + ( - x ) ) ; } } } static class LightScanner { private BufferedReader reader = null ; private StringTokenizer tokenizer = null ; public LightScanner ( InputStream in ) { reader = new BufferedReader ( new InputStreamReader ( in ) ) ; } public String string ( ) { if ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new UncheckedIOException ( e ) ; } } return tokenizer . nextToken ( ) ; } public int ints ( ) { return Integer . parseInt ( string ( ) ) ; } } }

import java . util . * ; public class Main { public static int [ ] dp ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String [ ] s = sc . nextLine ( ) . split ( " ▁ " ) ; int N = Integer . parseInt ( s [ 0 ] ) ; int A = Integer . parseInt ( s [ 1 ] ) ; int B = Integer . parseInt ( s [ 2 ] ) ; int count = 0 ; for ( int i = 0 ; i < N ; i ++ ) { String [ ] t = sc . nextLine ( ) . split ( " ▁ " ) ; int M = Integer . parseInt ( t [ 1 ] ) ; if ( t [ 0 ] . equals ( " East " ) ) { if ( M < A ) { count += A ; } else if ( M > B ) { count += B ; } else { count += M ; } } else { if ( M < A ) { count -= A ; } else if ( M > B ) { count -= B ; } else { count -= M ; } } } if ( count == 0 ) { System . out . println ( 0 ) ; } else if ( count > 0 ) { System . out . println ( " East ▁ " + Math . abs ( count ) ) ; } else { System . out . println ( " West ▁ " + Math . abs ( count ) ) ; } } }

import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int N = scanner . nextInt ( ) ; int A = scanner . nextInt ( ) ; int B = scanner . nextInt ( ) ; String [ ] s = new String [ N ] ; int [ ] d = new int [ N ] ; int ans = 0 ; for ( int i = 0 ; i < N ; i ++ ) { s [ i ] = scanner . next ( ) ; d [ i ] = scanner . nextInt ( ) ; } for ( int i = 0 ; i < N ; i ++ ) { if ( s [ i ] . equals ( " East " ) ) { if ( d [ i ] < A ) { ans += A ; } else if ( A <= d [ i ] && d [ i ] <= B ) { ans += d [ i ] ; } else if ( d [ i ] > B ) { ans += B ; } } if ( s [ i ] . equals ( " West " ) ) { if ( d [ i ] < A ) { ans -= A ; } else if ( A <= d [ i ] && d [ i ] <= B ) { ans -= d [ i ] ; } else if ( d [ i ] > B ) { ans -= B ; } } } if ( ans == 0 ) { System . out . println ( 0 ) ; } else if ( ans > 0 ) { System . out . println ( " East " + " ▁ " + ans ) ; } else if ( ans < 0 ) { System . out . println ( " West " + " ▁ " + Math . abs ( ans ) ) ; } } }

import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String [ ] line = scanner . nextLine ( ) . split ( " ▁ " , 3 ) ; int n = Integer . parseInt ( line [ 0 ] ) ; int a = Integer . parseInt ( line [ 1 ] ) ; int b = Integer . parseInt ( line [ 2 ] ) ; int position = 0 ; for ( int i = 0 ; i < n ; i ++ ) { line = scanner . nextLine ( ) . split ( " ▁ " , 2 ) ; int distance = Integer . parseInt ( line [ 1 ] ) ; if ( distance < a ) { distance = a ; } else if ( distance > b ) { distance = b ; } String direction = line [ 0 ] ; if ( direction . equals ( " West " ) ) { position += distance ; } else { position -= distance ; } } if ( position == 0 ) { System . out . println ( "0" ) ; } else if ( position > 0 ) { System . out . printf ( " West ▁ % d \n " , position ) ; } else { System . out . printf ( " East ▁ % d \n " , position * - 1 ) ; } } }

N , A , B = map ( int , input ( ) . split ( ) ) NEW_LINE now = 0 NEW_LINE for i in range ( N ) : NEW_LINE INDENT s , d = input ( ) . split ( ) NEW_LINE if s == " East " : NEW_LINE INDENT if int ( d ) < A : NEW_LINE INDENT now += A NEW_LINE DEDENT elif int ( d ) > B : NEW_LINE INDENT now += B NEW_LINE DEDENT else : NEW_LINE INDENT now += int ( d ) NEW_LINE DEDENT DEDENT else : NEW_LINE INDENT if int ( d ) < A : NEW_LINE INDENT now -= A NEW_LINE DEDENT elif int ( d ) > B : NEW_LINE INDENT now -= B NEW_LINE DEDENT else : NEW_LINE INDENT now -= int ( d ) NEW_LINE DEDENT DEDENT DEDENT if now > 0 : NEW_LINE INDENT print ( " East " + " ▁ " + str ( now ) ) NEW_LINE DEDENT elif now < 0 : NEW_LINE INDENT print ( " West " + " ▁ " + str ( abs ( now ) ) ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( 0 ) NEW_LINE DEDENT

def twin_and_watermellon ( N : int , A : int , B : int , command : list ) -> tuple : NEW_LINE INDENT WEST = ' West ' NEW_LINE EAST = ' East ' NEW_LINE x = 0 NEW_LINE for s , d in command : NEW_LINE INDENT dx = d NEW_LINE if d < A : NEW_LINE INDENT dx = A NEW_LINE DEDENT elif B < d : NEW_LINE INDENT dx = B NEW_LINE DEDENT if s == WEST : NEW_LINE INDENT x -= dx NEW_LINE DEDENT else : NEW_LINE INDENT x += dx NEW_LINE DEDENT DEDENT direction = ' ' NEW_LINE if x < 0 : NEW_LINE INDENT direction = WEST NEW_LINE DEDENT elif x > 0 : NEW_LINE INDENT direction = EAST NEW_LINE DEDENT return direction , abs ( x ) NEW_LINE DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT N = 0 NEW_LINE N , A , B = map ( int , input ( ) . split ( ) ) NEW_LINE command = [ ] NEW_LINE for _ in range ( N ) : NEW_LINE INDENT s , d = input ( ) . split ( ) NEW_LINE command . append ( ( s , int ( d ) ) ) NEW_LINE DEDENT d , x = twin_and_watermellon ( N , A , B , command ) NEW_LINE if x == 0 : NEW_LINE INDENT print ( 0 ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( d , x ) NEW_LINE DEDENT DEDENT

N , A , B = map ( int , input ( ) . split ( ) ) NEW_LINE sd = [ input ( ) . split ( ) for i in range ( N ) ] NEW_LINE pos = 0 NEW_LINE for i in range ( N ) : NEW_LINE INDENT step = min ( max ( int ( sd [ i ] [ 1 ] ) , A ) , B ) NEW_LINE if sd [ i ] [ 0 ] == ' West ' : NEW_LINE INDENT step *= - 1 NEW_LINE DEDENT pos += step NEW_LINE DEDENT if pos == 0 : NEW_LINE INDENT print ( pos ) NEW_LINE DEDENT else : NEW_LINE INDENT dest = ' East ' if pos > 0 else ' West ' NEW_LINE print ( " { 0 } ▁ { 1 } " . format ( dest , abs ( pos ) ) ) NEW_LINE DEDENT

n , c , b = map ( int , input ( ) . split ( ) ) NEW_LINE a = [ ] NEW_LINE for i in range ( n ) : NEW_LINE INDENT a . append ( list ( input ( ) . split ( ) ) ) NEW_LINE DEDENT for j in range ( n ) : NEW_LINE INDENT if int ( a [ j ] [ 1 ] ) < c : NEW_LINE INDENT a [ j ] [ 1 ] = c NEW_LINE DEDENT elif int ( a [ j ] [ 1 ] ) > b : NEW_LINE INDENT a [ j ] [ 1 ] = b NEW_LINE DEDENT DEDENT ans = 0 NEW_LINE for k in range ( n ) : NEW_LINE INDENT if a [ k ] [ 0 ] == ' East ' : NEW_LINE INDENT ans += int ( a [ k ] [ 1 ] ) NEW_LINE DEDENT elif a [ k ] [ 0 ] == ' West ' : NEW_LINE INDENT ans -= int ( a [ k ] [ 1 ] ) NEW_LINE DEDENT DEDENT if ans > 0 : NEW_LINE INDENT print ( ' East ' , ans ) NEW_LINE DEDENT if ans == 0 : NEW_LINE INDENT print ( 0 ) NEW_LINE DEDENT if ans < 0 : NEW_LINE INDENT print ( ' West ' , - ans ) NEW_LINE DEDENT

n , lower , upper = map ( int , input ( ) . split ( ) ) NEW_LINE res = 0 NEW_LINE for i in range ( n ) : NEW_LINE INDENT step = input ( ) . split ( ) NEW_LINE if step [ 0 ] == " West " : NEW_LINE INDENT offset = - 1 NEW_LINE DEDENT elif step [ 0 ] == " East " : NEW_LINE INDENT offset = 1 NEW_LINE DEDENT if int ( step [ 1 ] ) < lower : NEW_LINE INDENT res += lower * offset NEW_LINE DEDENT elif int ( step [ 1 ] ) > upper : NEW_LINE INDENT res += upper * offset NEW_LINE DEDENT else : NEW_LINE INDENT res += int ( step [ 1 ] ) * offset NEW_LINE DEDENT DEDENT if res == 0 : NEW_LINE INDENT print ( 0 ) NEW_LINE DEDENT elif res > 1 : NEW_LINE INDENT print ( " East ▁ % s " % str ( res ) ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " West ▁ % s " % str ( abs ( res ) ) ) NEW_LINE DEDENT


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] l = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { l [ i ] = sc . nextInt ( ) ; } Arrays . sort ( l ) ; int sum = 0 ; for ( int i = n - 1 ; n - k <= i ; i -- ) { sum += l [ i ] ; } 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 K = in . nextInt ( ) ; int [ ] l = new int [ N ] ; for ( int i = 0 ; i < l . length ; i ++ ) { l [ i ] = in . nextInt ( ) ; } Arrays . sort ( l ) ; int ans = 0 ; for ( int i = l . length - 1 ; i >= l . length - K ; i -- ) { ans += l [ i ] ; } out . println ( ans ) ; } } 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 . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . Arrays ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer tokenizer = new StringTokenizer ( input . readLine ( ) ) ; int n = Integer . parseInt ( tokenizer . nextToken ( ) ) ; int m = Integer . parseInt ( tokenizer . nextToken ( ) ) ; tokenizer = new StringTokenizer ( input . readLine ( ) ) ; int [ ] values = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { values [ i ] = Integer . parseInt ( tokenizer . nextToken ( ) ) ; } Arrays . sort ( values ) ; long sum = 0 ; for ( int i = n - 1 ; i >= n - m ; i -- ) { sum += values [ i ] ; } System . out . println ( sum ) ; } }

import java . util . ArrayList ; import java . util . Collections ; import java . util . Comparator ; import java . util . HashSet ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int numberOfStickUsed = sc . nextInt ( ) ; ArrayList < Integer > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { list . add ( sc . nextInt ( ) ) ; } Collections . sort ( list , Comparator . reverseOrder ( ) ) ; int sum = 0 ; for ( int i = 0 ; i < numberOfStickUsed ; i ++ ) { sum += list . get ( i ) ; } System . out . println ( sum ) ; } }

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 k = sc . nextInt ( ) ; Integer [ ] ar = new Integer [ n ] ; for ( int i = 0 ; i < n ; i ++ ) ar [ i ] = sc . nextInt ( ) ; Arrays . sort ( ar , Collections . reverseOrder ( ) ) ; int sum = 0 ; for ( int i = 0 ; i < k ; i ++ ) { sum += ar [ i ] ; } System . out . println ( sum ) ; } }

t , l = open ( 0 ) ; print ( sum ( sorted ( map ( int , l . split ( ) ) ) [ - int ( t [ 2 : ] ) : ] ) ) 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 , k = nm ( ) NEW_LINE l = nl ( ) NEW_LINE l . sort ( reverse = True ) NEW_LINE ans = 0 NEW_LINE for i in range ( k ) : NEW_LINE INDENT ans += l [ i ] NEW_LINE DEDENT print ( ans ) NEW_LINE

N , K = [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE L = [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE L . sort ( reverse = True ) NEW_LINE print ( sum ( L [ : K ] ) ) NEW_LINE

N , K = map ( int , input ( ) . split ( ) ) NEW_LINE l = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE ans = 0 NEW_LINE for i in range ( K ) : NEW_LINE INDENT m = max ( l ) NEW_LINE ans += m NEW_LINE l [ l . index ( m ) ] = 0 NEW_LINE DEDENT print ( ans ) NEW_LINE

n , k = [ int ( item ) for item in input ( ) . split ( ) ] NEW_LINE ls = sorted ( [ int ( item ) for item in input ( ) . split ( ) ] , reverse = True ) NEW_LINE print ( sum ( ls [ : k ] ) ) NEW_LINE


import java . math . * ; import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] [ ] rate = new int [ n ] [ 2 ] ; for ( int i = 0 ; i < n ; ++ i ) { rate [ i ] [ 0 ] = sc . nextInt ( ) ; rate [ i ] [ 1 ] = sc . nextInt ( ) ; } long [ ] count = new long [ 2 ] ; count [ 0 ] = rate [ 0 ] [ 0 ] ; count [ 1 ] = rate [ 0 ] [ 1 ] ; for ( int i = 1 ; i < n ; ++ i ) { count = nextCount ( rate [ i ] , count ) ; } System . out . println ( count [ 0 ] + count [ 1 ] ) ; } private static long [ ] nextCount ( int [ ] rate , long [ ] count ) { int r0 = rate [ 0 ] ; int r1 = rate [ 1 ] ; long n = Math . max ( ( count [ 0 ] + r0 - 1 ) / r0 , ( count [ 1 ] + r1 - 1 ) / r1 ) ; count [ 0 ] = r0 * n ; count [ 1 ] = r1 * n ; return count ; } private static int gcd ( int v1 , int v2 ) { BigInteger b1 = BigInteger . valueOf ( v1 ) ; BigInteger b2 = BigInteger . valueOf ( v2 ) ; return b1 . gcd ( b2 ) . intValue ( ) ; } }

import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ; ) { new Main ( ) . solve ( sc ) ; } } void solve ( Scanner sc ) { int n = sc . nextInt ( ) ; long numOfT = 1 ; long numOfA = 1 ; for ( int i = 0 ; i < n ; i ++ ) { long t = sc . nextLong ( ) ; long a = sc . nextLong ( ) ; long xt = numOfT % t == 0 ? numOfT / t : numOfT / t + 1 ; long xa = numOfA % a == 0 ? numOfA / a : numOfA / a + 1 ; long x = Math . max ( xt , xa ) ; numOfT = t * x ; numOfA = a * x ; } System . out . println ( numOfT + numOfA ) ; } }

import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner cin = new Scanner ( System . in ) ; while ( cin . hasNext ( ) ) { int n = cin . nextInt ( ) ; int [ ] [ ] vote = readMatrix ( cin , n , 2 ) ; System . out . println ( getNum ( vote , n ) ) ; } } public static long getNum ( int [ ] [ ] vote , int n ) { long [ ] result = { vote [ 0 ] [ 0 ] , vote [ 0 ] [ 1 ] } ; long result1 ; for ( int i = 1 ; i < n ; i ++ ) { result1 = result [ 1 ] ; if ( result [ 0 ] > vote [ i ] [ 0 ] ) { if ( result [ 0 ] % vote [ i ] [ 0 ] != 0 ) result [ 0 ] += vote [ i ] [ 0 ] - result [ 0 ] % vote [ i ] [ 0 ] ; } else { result [ 0 ] = vote [ i ] [ 0 ] ; } result [ 1 ] = result [ 0 ] / vote [ i ] [ 0 ] * vote [ i ] [ 1 ] ; if ( result1 > result [ 1 ] ) { result [ 1 ] = result1 ; if ( result [ 1 ] % vote [ i ] [ 1 ] != 0 ) result [ 1 ] += vote [ i ] [ 1 ] - result [ 1 ] % vote [ i ] [ 1 ] ; result [ 0 ] = result [ 1 ] / vote [ i ] [ 1 ] * vote [ i ] [ 0 ] ; } } return result [ 0 ] + result [ 1 ] ; } public static int [ ] [ ] readMatrix ( Scanner in , int n , int m ) { int [ ] [ ] mtx = new int [ n ] [ m ] ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { mtx [ i ] [ j ] = in . nextInt ( ) ; } } return mtx ; } }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( br . readLine ( ) ) ; long t_pre = 1 , a_pre = 1 ; for ( int i = 0 ; i < n ; i ++ ) { String [ ] str = br . readLine ( ) . split ( " ▁ " ) ; long t = Integer . parseInt ( str [ 0 ] ) ; long a = Integer . parseInt ( str [ 1 ] ) ; long rate = Math . max ( t_pre / t + ( t_pre % t == 0 ? 0 : 1 ) , a_pre / a + ( a_pre % a == 0 ? 0 : 1 ) ) ; t_pre = rate * t ; a_pre = rate * a ; } System . out . println ( t_pre + a_pre ) ; } }

import java . util . Scanner ; class Main { static Scanner s = new Scanner ( System . in ) ; static int gInt ( ) { return Integer . parseInt ( s . next ( ) ) ; } public static void main ( String [ ] $ ) { int n = gInt ( ) ; long a = gInt ( ) , b = gInt ( ) ; for ( int i = 1 ; i < n ; ++ i ) { int A = gInt ( ) , B = gInt ( ) ; if ( a * 1.0 / A < b * 1.0 / B ) { b = ( b + B - 1 ) / B * B ; a = b / B * A ; } else { a = ( a + A - 1 ) / A * A ; b = a / A * B ; } } System . out . println ( a + b ) ; } }

N = int ( input ( ) ) NEW_LINE P = [ list ( map ( int , input ( ) . split ( ' ▁ ' ) ) ) for i in range ( N ) ] NEW_LINE T = [ P [ i ] [ 0 ] for i in range ( N ) ] NEW_LINE A = [ P [ i ] [ 1 ] for i in range ( N ) ] NEW_LINE t = T [ 0 ] NEW_LINE a = A [ 0 ] NEW_LINE k = 1 NEW_LINE for i in range ( 1 , N ) : NEW_LINE INDENT k1 = int ( ( T [ i - 1 ] * k - 1 ) // T [ i ] + 1 ) NEW_LINE k2 = int ( ( A [ i - 1 ] * k - 1 ) // A [ i ] + 1 ) NEW_LINE k = max ( k1 , k2 ) NEW_LINE DEDENT print ( k * ( T [ - 1 ] + A [ - 1 ] ) ) NEW_LINE

def getInt ( ) : return int ( input ( ) ) NEW_LINE def getIntList ( ) : return [ int ( x ) for x in input ( ) . split ( ) ] NEW_LINE def zeros ( n ) : return [ 0 ] * n NEW_LINE def gcd ( x , y ) : NEW_LINE INDENT m = max ( x , y ) NEW_LINE n = min ( x , y ) NEW_LINE while m % n != 0 : NEW_LINE INDENT w = m % n NEW_LINE m = n NEW_LINE n = w NEW_LINE DEDENT return n NEW_LINE DEDENT def lcm ( x , y ) : return x * y // gcd ( x , y ) NEW_LINE def db ( x ) : NEW_LINE INDENT global debug NEW_LINE if debug : print ( x ) NEW_LINE DEDENT debug = False NEW_LINE N = getInt ( ) NEW_LINE TA = zeros ( N ) NEW_LINE for i in range ( N ) : NEW_LINE INDENT TA [ i ] = getIntList ( ) NEW_LINE DEDENT db ( TA ) NEW_LINE real = TA [ 0 ] NEW_LINE for i in range ( 1 , N ) : NEW_LINE INDENT if real [ 0 ] / TA [ i ] [ 0 ] > real [ 1 ] / TA [ i ] [ 1 ] : NEW_LINE INDENT lc = ( real [ 0 ] + TA [ i ] [ 0 ] - 1 ) // TA [ i ] [ 0 ] * TA [ i ] [ 0 ] NEW_LINE real [ 0 ] = lc NEW_LINE real [ 1 ] = lc * TA [ i ] [ 1 ] // TA [ i ] [ 0 ] NEW_LINE DEDENT else : NEW_LINE INDENT lc = ( real [ 1 ] + TA [ i ] [ 1 ] - 1 ) // TA [ i ] [ 1 ] * TA [ i ] [ 1 ] NEW_LINE real [ 1 ] = lc NEW_LINE real [ 0 ] = lc * TA [ i ] [ 0 ] // TA [ i ] [ 1 ] NEW_LINE DEDENT db ( ( lc , real ) ) NEW_LINE DEDENT print ( sum ( real ) ) NEW_LINE

import math NEW_LINE from decimal import * NEW_LINE n = int ( input ( ) ) NEW_LINE t_prev , a_prev = 1 , 1 NEW_LINE for i in range ( n ) : NEW_LINE INDENT t , a = map ( int , input ( ) . split ( ) ) NEW_LINE n_koho1 = math . ceil ( Decimal ( t_prev ) / Decimal ( t ) ) NEW_LINE n_koho2 = math . ceil ( Decimal ( a_prev ) / Decimal ( a ) ) NEW_LINE n = max ( n_koho1 , n_koho2 ) NEW_LINE t = n * t NEW_LINE a = n * a NEW_LINE t_prev = t NEW_LINE a_prev = a NEW_LINE DEDENT print ( t_prev + a_prev ) NEW_LINE

def floor ( a , b ) : NEW_LINE INDENT return ( ( - a ) // b ) * - 1 NEW_LINE DEDENT N = int ( input ( ) ) NEW_LINE ratio = [ ] NEW_LINE for _ in range ( N ) : NEW_LINE INDENT ratio . append ( list ( map ( int , input ( ) . split ( ) ) ) ) NEW_LINE DEDENT v_T = ratio [ 0 ] [ 0 ] NEW_LINE v_A = ratio [ 0 ] [ 1 ] NEW_LINE for t , a in ratio [ 1 : ] : NEW_LINE INDENT diff_t = t - v_T NEW_LINE diff_a = a - v_A NEW_LINE if diff_t < 0 and diff_a < 0 : NEW_LINE INDENT d = max ( floor ( v_T , t ) , floor ( v_A , a ) ) NEW_LINE v_T = d * t NEW_LINE v_A = d * a NEW_LINE DEDENT elif diff_t < 0 : NEW_LINE INDENT d = floor ( v_T , t ) NEW_LINE v_T = d * t NEW_LINE v_A = d * a NEW_LINE DEDENT elif diff_a < 0 : NEW_LINE INDENT d = floor ( v_A , a ) NEW_LINE v_T = d * t NEW_LINE v_A = d * a NEW_LINE DEDENT elif diff_t >= 0 and diff_a >= 0 : NEW_LINE INDENT m = max ( diff_t , diff_a ) NEW_LINE v_T = t NEW_LINE v_A = a NEW_LINE DEDENT DEDENT print ( v_T + v_A ) NEW_LINE

def inpl ( ) : NEW_LINE INDENT return list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE DEDENT N = int ( input ( ) ) NEW_LINE TA = [ inpl ( ) for i in range ( N ) ] NEW_LINE a , b = TA [ 0 ] [ 0 ] , TA [ 0 ] [ 1 ] NEW_LINE for ta , ao in TA [ 1 : ] : NEW_LINE INDENT if ta >= a and ao >= b : NEW_LINE INDENT a = ta NEW_LINE b = ao NEW_LINE DEDENT else : NEW_LINE INDENT tmp_a = - ( - 1 * a // ta ) NEW_LINE tmp_b = - ( - 1 * b // ao ) NEW_LINE tmp = max ( tmp_a , tmp_b ) NEW_LINE a = ta * tmp NEW_LINE b = ao * tmp NEW_LINE DEDENT DEDENT print ( a + b ) NEW_LINE


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 [ ] r = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { r [ i ] = sc . nextInt ( ) ; } Arrays . sort ( r ) ; long R = 0 ; boolean red = true ; for ( int i = n - 1 ; i >= 0 ; i -- ) { if ( red ) { R += r [ i ] * r [ i ] ; } else { R -= r [ i ] * r [ i ] ; } red = ! red ; } sc . close ( ) ; System . out . println ( R * Math . PI ) ; } }

import java . util . * ; public class Main { public static final double PI = 3.1415926535 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; List < Integer > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { int R = sc . nextInt ( ) ; list . add ( R ) ; } Collections . sort ( list , Comparator . reverseOrder ( ) ) ; double ans = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( i % 2 == 0 ) { ans += PI * list . get ( i ) * list . get ( i ) ; } else { ans -= PI * list . get ( i ) * list . get ( i ) ; } } System . out . println ( ans ) ; } }

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 . * ; 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 ( in , out ) ; out . close ( ) ; } static class Task { void solve ( InputReader in , PrintWriter out ) { int N = in . nextInt ( ) ; Integer R [ ] = new Integer [ N ] ; for ( int i = 0 ; i < N ; ++ i ) { R [ i ] = in . nextInt ( ) ; } Arrays . sort ( R , Collections . reverseOrder ( ) ) ; double ans = 0 ; int sign = 1 ; for ( int r : R ) { ans += sign * r * r ; sign *= - 1 ; } out . println ( ans * Math . PI ) ; } } static class InputReader { BufferedReader reader ; StringTokenizer tokenizer ; InputReader ( InputStream stream ) { reader = new BufferedReader ( new InputStreamReader ( stream ) ) ; tokenizer = null ; } String next ( ) { while ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } } }

import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int N = scanner . nextInt ( ) ; int [ ] radius = new int [ N ] ; double pi = Math . PI ; double area = 0 ; for ( int i = 0 ; i < N ; i ++ ) { radius [ i ] = scanner . nextInt ( ) ; } Arrays . sort ( radius ) ; for ( int i = N - 1 ; i >= 0 ; i -- ) { if ( N % 2 == 0 ) { if ( i % 2 == 0 ) { area -= pi * radius [ i ] * radius [ i ] ; } else if ( i % 2 == 1 ) { area += pi * radius [ i ] * radius [ i ] ; } } if ( N % 2 == 1 ) { if ( i % 2 == 0 ) { area += pi * radius [ i ] * radius [ i ] ; } else if ( i % 2 == 1 ) { area -= pi * radius [ i ] * radius [ i ] ; } } } System . out . println ( area ) ; } }

import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; double ans = 3.1415926535897932384626433832795028841971693993751058209 ; double ans2 = 0 ; int c [ ] = new int [ a ] ; for ( int i = 0 ; i != a ; i ++ ) { c [ i ] = scan . nextInt ( ) ; } Arrays . sort ( c ) ; for ( int i = 0 ; i != a ; i ++ ) { if ( i % 2 == 0 ) { ans2 += c [ i ] * c [ i ] ; } else { ans2 -= c [ i ] * c [ i ] ; } } ans *= ans2 ; if ( ans <= 0 ) { System . out . println ( ans * - 1 ) ; } else if ( ans > 0 ) { System . out . println ( ans ) ; } } }

from math import pi NEW_LINE N = int ( input ( ) ) NEW_LINE r = sorted ( [ int ( input ( ) ) for _ in range ( N ) ] , reverse = True ) NEW_LINE ans = 0 NEW_LINE for i , n in enumerate ( r ) : NEW_LINE INDENT if i % 2 == 0 : NEW_LINE INDENT ans += n ** 2 * pi NEW_LINE DEDENT else : NEW_LINE INDENT ans -= n ** 2 * pi NEW_LINE DEDENT DEDENT print ( ans ) NEW_LINE

from statistics import mean , median , variance , stdev NEW_LINE import numpy as np NEW_LINE import sys NEW_LINE import math NEW_LINE import fractions NEW_LINE import itertools NEW_LINE import copy NEW_LINE import collections NEW_LINE from operator import itemgetter NEW_LINE def j ( q ) : NEW_LINE INDENT if q == 1 : print ( " Yay ! " ) NEW_LINE else : print ( " : ( " ) NEW_LINE exit ( 0 ) 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 def ip ( ) : NEW_LINE INDENT return int ( input ( ) ) NEW_LINE DEDENT def printrow ( a ) : NEW_LINE INDENT for i in range ( len ( a ) ) : NEW_LINE INDENT print ( a [ i ] ) NEW_LINE DEDENT DEDENT def combinations ( n , r ) : NEW_LINE INDENT if n < r : return 0 NEW_LINE return math . factorial ( n ) // ( math . factorial ( n - r ) * math . factorial ( r ) ) NEW_LINE DEDENT def permutations ( n , r ) : NEW_LINE INDENT if n < r : return 0 NEW_LINE return math . factorial ( n ) // math . factorial ( n - r ) NEW_LINE DEDENT n = ip ( ) NEW_LINE a = [ ip ( ) for i in range ( n ) ] NEW_LINE a . sort ( reverse = True ) NEW_LINE s = 0 NEW_LINE for i in range ( n ) : NEW_LINE INDENT if i % 2 == 0 : NEW_LINE INDENT s += a [ i ] * a [ i ] * math . pi NEW_LINE DEDENT else : s -= a [ i ] * a [ i ] * math . pi NEW_LINE DEDENT print ( s ) NEW_LINE

import math NEW_LINE PI = math . pi NEW_LINE N = int ( input ( ) ) NEW_LINE R = [ ] NEW_LINE for i in range ( N ) : NEW_LINE INDENT R . append ( int ( input ( ) ) ) NEW_LINE DEDENT R = sorted ( R ) NEW_LINE ans = 0 NEW_LINE if len ( R ) % 2 == 1 : NEW_LINE INDENT ans += R [ 0 ] * R [ 0 ] * PI NEW_LINE for i in range ( 1 , len ( R ) ) : NEW_LINE INDENT if i % 2 == 0 : NEW_LINE INDENT ans += R [ i ] * R [ i ] * PI NEW_LINE ans -= R [ i - 1 ] * R [ i - 1 ] * PI NEW_LINE DEDENT DEDENT DEDENT else : NEW_LINE INDENT for i in range ( 0 , len ( R ) ) : NEW_LINE INDENT if i % 2 == 1 : NEW_LINE INDENT ans += R [ i ] * R [ i ] * PI NEW_LINE ans -= R [ i - 1 ] * R [ i - 1 ] * PI NEW_LINE DEDENT DEDENT DEDENT print ( ans ) NEW_LINE

r = [ int ( input ( ) ) for _ in range ( int ( input ( ) ) ) ] NEW_LINE r . sort ( reverse = True ) NEW_LINE ans = 0 NEW_LINE for i in range ( len ( r ) ) : NEW_LINE INDENT if i % 2 == 0 : NEW_LINE INDENT if i == len ( r ) - 1 : NEW_LINE INDENT ans += r [ i ] ** 2 NEW_LINE DEDENT else : NEW_LINE INDENT ans += r [ i ] ** 2 - r [ i + 1 ] ** 2 NEW_LINE DEDENT DEDENT DEDENT import math NEW_LINE print ( ans * math . pi ) NEW_LINE


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; System . out . println ( sc . next ( ) . matches ( " [ aiueo ] " ) ? " vowel " : " consonant " ) ; } }

import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { PrintWriter out = new PrintWriter ( System . out ) ; InputStreamScanner in = new InputStreamScanner ( System . in ) ; new Main ( ) . solve ( in , out ) ; out . flush ( ) ; } private void solve ( InputStreamScanner in , PrintWriter out ) { out . println ( " aeiou " . contains ( in . next ( ) ) ? " vowel " : " consonant " ) ; } static class InputStreamScanner { private InputStream in ; private byte [ ] buf = new byte [ 1024 ] ; private int len = 0 ; private int off = 0 ; InputStreamScanner ( InputStream in ) { this . in = in ; } String next ( ) { StringBuilder sb = new StringBuilder ( ) ; for ( int b = skip ( ) ; ! isSpace ( b ) ; ) { sb . appendCodePoint ( b ) ; b = read ( ) ; } return sb . toString ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } char nextChar ( ) { return ( char ) skip ( ) ; } int skip ( ) { for ( int b ; ( b = read ( ) ) != - 1 ; ) { if ( ! isSpace ( b ) ) { return b ; } } return - 1 ; } private boolean isSpace ( int c ) { return c < 33 || c > 126 ; } private int read ( ) { if ( len == - 1 ) { throw new InputMismatchException ( " End ▁ of ▁ Input " ) ; } if ( off >= len ) { off = 0 ; try { len = in . read ( buf ) ; } catch ( IOException e ) { throw new InputMismatchException ( e . getMessage ( ) ) ; } if ( len <= 0 ) { return - 1 ; } } return buf [ off ++ ] ; } } }

import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String input = br . readLine ( ) ; if ( input . equals ( " a " ) || input . equals ( " e " ) || input . equals ( " i " ) || input . equals ( " o " ) || input . equals ( " u " ) ) { System . out . println ( " vowel " ) ; } else { System . out . println ( " consonant " ) ; } } }

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 . 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 ) { char c = in . nextChar ( ) ; if ( c == ' a ' || c == ' e ' || c == ' i ' || c == ' o ' || c == ' u ' ) { out . println ( " vowel " ) ; } else { out . println ( " consonant " ) ; } } } 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 . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; String c = scan . next ( ) ; if ( c . equals ( " a " ) ) { System . out . println ( " vowel " ) ; } else if ( c . equals ( " i " ) ) { System . out . println ( " vowel " ) ; } else if ( c . equals ( " u " ) ) { System . out . println ( " vowel " ) ; } else if ( c . equals ( " e " ) ) { System . out . println ( " vowel " ) ; } else if ( c . equals ( " o " ) ) { System . out . println ( " vowel " ) ; } else { System . out . println ( " consonant " ) ; } } }

c = str ( input ( ) ) NEW_LINE L = [ " a " , " i " , " u " , " e " , " o " ] NEW_LINE if c in L : NEW_LINE INDENT print ( " vowel " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " consonant " ) NEW_LINE DEDENT

import sys , re NEW_LINE from collections import deque , defaultdict , Counter NEW_LINE from math import ceil , sqrt , hypot , factorial , pi , sin , cos , radians NEW_LINE from itertools import permutations , combinations , product NEW_LINE from operator import itemgetter , mul NEW_LINE from copy import deepcopy NEW_LINE from string import ascii_lowercase , ascii_uppercase , digits NEW_LINE def input ( ) : return sys . stdin . readline ( ) . strip ( ) NEW_LINE def INT ( ) : return int ( input ( ) ) NEW_LINE def MAP ( ) : return map ( int , input ( ) . split ( ) ) NEW_LINE def LIST ( ) : return list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE sys . setrecursionlimit ( 10 ** 9 ) NEW_LINE INF = float ( ' inf ' ) NEW_LINE MOD = 10 ** 9 + 7 NEW_LINE c = input ( ) NEW_LINE boin = [ " a " , " i " , " u " , " e " , " o " ] NEW_LINE if c in boin : NEW_LINE INDENT print ( " vowel " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " consonant " ) NEW_LINE DEDENT

import sys NEW_LINE import math NEW_LINE input = sys . stdin . readline NEW_LINE a = input ( ) . rstrip ( ) NEW_LINE vowel = [ ' a ' , ' i ' , ' u ' , ' e ' , ' o ' ] NEW_LINE flag = False NEW_LINE for i in vowel : NEW_LINE INDENT if ( i == a ) : NEW_LINE INDENT flag = True NEW_LINE DEDENT DEDENT if ( flag == True ) : NEW_LINE INDENT print ( ' vowel ' ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( ' consonant ' ) NEW_LINE DEDENT

c = input ( ) NEW_LINE vowels = [ " a " , " i " , " u " , " e " , " o " ] NEW_LINE if c in vowels : NEW_LINE INDENT print ( " vowel " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " consonant " ) NEW_LINE DEDENT

print ( " vowel " ) if input ( ) in [ " a " , " i " , " u " , " e " , " o " ] else print ( " consonant " ) NEW_LINE


import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; String b = sc . next ( ) ; sc . close ( ) ; String ab = a + b ; int value = Integer . parseInt ( ab ) ; String ans = " No " ; for ( int i = 4 ; i <= Math . sqrt ( value ) ; i ++ ) { if ( i * i == value ) { ans = " Yes " ; break ; } } System . out . println ( ans ) ; } }

import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer tokenizer = new StringTokenizer ( input . readLine ( ) ) ; int number = Integer . parseInt ( tokenizer . nextToken ( ) + tokenizer . nextToken ( ) ) ; double result = Math . sqrt ( number ) ; int round = ( int ) result ; System . out . println ( result == round ? " Yes " : " No " ) ; } }

import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; String b = sc . next ( ) ; String c = a + b ; Double num = Double . parseDouble ( c ) ; if ( Math . sqrt ( num ) % 1 == 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } sc . close ( ) ; } }

import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; String b = sc . next ( ) ; int num = Integer . parseInt ( a + b ) ; int s = ( int ) Math . sqrt ( num ) ; if ( s * s == num ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } }

import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader stdin = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( stdin . readLine ( ) . replaceAll ( " ▁ " , " " ) ) ; int r = ( int ) Math . floor ( Math . sqrt ( n ) ) ; String ans = n == r * r ? " Yes " : " No " ; System . out . println ( ans ) ; } }

heihousuu = [ i * i for i in range ( int ( 100100 ** 0.5 ) ) ] NEW_LINE a , b = input ( ) . split ( ) NEW_LINE ab = int ( a + b ) NEW_LINE print ( ' Yes ' if ab in heihousuu else ' No ' ) NEW_LINE

a , b = input ( ) . split ( ) NEW_LINE c = int ( a + b ) NEW_LINE def try_square_root_naive ( n ) : NEW_LINE INDENT m = int ( n ** .5 ) NEW_LINE return m if abs ( m * m - n ) < 1e-6 else None NEW_LINE DEDENT if try_square_root_naive ( c ) == None : NEW_LINE INDENT print ( ' No ' ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( ' Yes ' ) NEW_LINE DEDENT

import math NEW_LINE s = input ( ) NEW_LINE s = int ( s . replace ( ' ▁ ' , ' ' ) ) NEW_LINE if ( math . sqrt ( s ) == math . floor ( math . sqrt ( s ) ) ) : NEW_LINE INDENT print ( ' Yes ' ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( ' No ' ) NEW_LINE DEDENT

def main ( ) : NEW_LINE INDENT print ( ' YNeos ' [ not ( int ( ' ' . join ( input ( ) . split ( ) ) ) ** 0.5 ) . is_integer ( ) : : 2 ] ) NEW_LINE DEDENT main ( ) NEW_LINE

a , b = map ( int , input ( ) . split ( ) ) NEW_LINE num = int ( str ( a ) + str ( b ) ) NEW_LINE flag = False NEW_LINE for i in range ( 1000 ) : NEW_LINE INDENT if i ** 2 == num : NEW_LINE INDENT flag = True NEW_LINE DEDENT DEDENT if flag : NEW_LINE INDENT print ( ' Yes ' ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( ' No ' ) NEW_LINE DEDENT


import java . util . * ; public class Main { static int count = 0 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; Magic [ ] arr = new Magic [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = new Magic ( sc . nextInt ( ) , sc . nextInt ( ) ) ; } Arrays . sort ( arr , new Comparator < Magic > ( ) { public int compare ( Magic m1 , Magic m2 ) { if ( m1 . a < m1 . b && m2 . a < m2 . b ) { return m1 . a - m2 . a ; } else if ( m1 . a >= m1 . b && m2 . a < m2 . b ) { return 1 ; } else if ( m1 . a < m1 . b && m2 . a >= m2 . b ) { return - 1 ; } else { return m2 . b - m1 . b ; } } } ) ; long tmp = 0 ; long max = 0 ; for ( Magic m : arr ) { tmp += m . a ; if ( max < tmp ) { max = tmp ; } tmp -= m . b ; } System . out . println ( max ) ; } static class Magic { int a ; int b ; public Magic ( int a , int b ) { this . a = a ; this . b = b ; } } }

import java . util . Arrays ; import java . util . Scanner ; public class Main { static class Pair implements Comparable < Pair > { int x ; int y ; int dif ; Pair ( int a , int b ) { x = a ; y = b ; dif = a - b ; } @ Override public int compareTo ( Pair o ) { if ( dif < 0 && o . dif < 0 ) { return x - o . x ; } else if ( dif < 0 && o . dif >= 0 ) { return - 1 ; } else if ( dif >= 0 && o . dif < 0 ) { return 1 ; } else { return o . y - y ; } } } public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; Pair [ ] x = new Pair [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { x [ i ] = new Pair ( in . nextInt ( ) , in . nextInt ( ) ) ; } Arrays . sort ( x ) ; long tmpMax = 0 ; long tmp = 0 ; for ( int i = 0 ; i < n ; i ++ ) { tmp += x [ i ] . x ; if ( tmpMax < tmp ) { tmpMax = tmp ; } tmp -= x [ i ] . y ; } System . out . println ( tmpMax ) ; } }

import java . util . * ; class Main { static class Node { long a , b , sub ; Node ( long a , long b ) { this . a = a ; this . b = b ; sub = a - b ; } } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; PriorityQueue < Node > minus = new PriorityQueue < > ( ( x , y ) -> x . a - y . a < 0 ? - 1 : 1 ) ; PriorityQueue < Node > plus = new PriorityQueue < > ( ( x , y ) -> y . a - x . a < 0 ? - 1 : 1 ) ; long zeroa = 0 ; for ( int i = 0 ; i < N ; ++ i ) { long a = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; if ( a == b ) zeroa = Math . max ( zeroa , a ) ; else if ( a > b ) plus . add ( new Node ( a , b ) ) ; else minus . add ( new Node ( a , b ) ) ; } long ans = 0 ; long val = 0 ; while ( ! minus . isEmpty ( ) ) { Node n = minus . poll ( ) ; ans = Math . max ( ans , val + n . a ) ; val += n . sub ; } ans = Math . max ( ans , val + zeroa ) ; long max = 0 ; long pval = 0 ; while ( ! plus . isEmpty ( ) ) { Node n = plus . poll ( ) ; if ( pval + n . a > max ) max = Math . min ( pval + n . a , Math . max ( max + n . sub , n . a ) ) ; pval += n . sub ; } System . out . println ( Math . max ( ans , val + max ) ) ; } }

import java . util . ArrayList ; import java . util . Collections ; import java . util . Comparator ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int N = scan . nextInt ( ) ; List < Magic > magicListA = new ArrayList < Magic > ( ) ; List < Magic > magicListB = new ArrayList < Magic > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { int up = scan . nextInt ( ) ; int down = scan . nextInt ( ) ; if ( up <= down ) { magicListA . add ( new Magic ( up , down ) ) ; } else { magicListB . add ( new Magic ( up , down ) ) ; } } scan . close ( ) ; Collections . sort ( magicListA , new Comparator < Magic > ( ) { public int compare ( Magic m1 , Magic m2 ) { return m1 . up - m2 . up ; } } ) ; Collections . sort ( magicListB , new Comparator < Magic > ( ) { public int compare ( Magic m1 , Magic m2 ) { return m2 . down - m1 . down ; } } ) ; long max = 0 ; long current = 0 ; for ( Magic m : magicListA ) { current += m . up ; max = Math . max ( max , current ) ; current -= m . down ; } for ( Magic m : magicListB ) { current += m . up ; max = Math . max ( max , current ) ; current -= m . down ; } System . out . println ( max ) ; } static class Magic { public Magic ( int up , int down ) { this . up = up ; this . down = down ; } int up ; int down ; } }

import java . util . Arrays ; import java . util . Scanner ; public class Main { class Magic implements Comparable < Magic > { int up ; int down ; @ Override public int compareTo ( Magic m ) { int result = up - down ; int result1 = m . up - m . down ; if ( result >= 0 && result1 < 0 ) { return 1 ; } else if ( result < 0 && result1 >= 0 ) { return - 1 ; } else if ( result < 0 && result1 < 0 ) { return up - m . up ; } else { return - ( down - m . down ) ; } } } void run ( ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; Magic [ ] magics = new Magic [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { magics [ i ] = new Magic ( ) ; } for ( int i = 0 ; i < n ; i ++ ) { magics [ i ] . up = sc . nextInt ( ) ; magics [ i ] . down = sc . nextInt ( ) ; } Arrays . sort ( magics ) ; long max = 0 ; long tmp = 0 ; for ( int i = 0 ; i < n ; i ++ ) { tmp += magics [ i ] . up ; max = Math . max ( tmp , max ) ; tmp -= magics [ i ] . down ; max = Math . max ( tmp , max ) ; } System . out . println ( max ) ; } public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } }

x , y = [ ] , [ ] NEW_LINE for _ in [ 0 ] * int ( input ( ) ) : NEW_LINE INDENT a , b = map ( int , input ( ) . split ( ) ) NEW_LINE if a < b : x . append ( ( a , a - b ) ) NEW_LINE else : y . append ( ( - b , a , a - b ) ) NEW_LINE DEDENT x . sort ( ) NEW_LINE y . sort ( ) NEW_LINE t = sum ( a [ 1 ] for a in x ) NEW_LINE m = x [ 0 ] [ 0 ] if x else 0 NEW_LINE for b , a , c in y : m = max ( m , t + a ) ; t += c NEW_LINE print ( m ) 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 mod = 10 ** 9 + 7 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 S ( ) : return input ( ) NEW_LINE def main ( ) : NEW_LINE INDENT n = I ( ) NEW_LINE a = [ ] NEW_LINE b = [ ] NEW_LINE d = [ ] NEW_LINE for _ in range ( n ) : NEW_LINE INDENT x , y = LI ( ) NEW_LINE if x < y : NEW_LINE INDENT a . append ( [ x , y ] ) NEW_LINE DEDENT else : NEW_LINE INDENT b . append ( [ x , y ] ) NEW_LINE DEDENT DEDENT r = 0 NEW_LINE c = 0 NEW_LINE a = sorted ( a ) NEW_LINE for x , y in a : NEW_LINE INDENT c += x NEW_LINE if r < c : NEW_LINE INDENT r = c NEW_LINE DEDENT c -= y NEW_LINE DEDENT b = sorted ( b , key = lambda x : [ - x [ 1 ] , - x [ 0 ] ] ) NEW_LINE for x , y in b : NEW_LINE INDENT c += x NEW_LINE if r < c : NEW_LINE INDENT r = c NEW_LINE DEDENT c -= y NEW_LINE DEDENT return r NEW_LINE DEDENT print ( main ( ) ) NEW_LINE

from itertools import chain NEW_LINE def I ( i ) : NEW_LINE INDENT return lambda x : x [ i ] NEW_LINE DEDENT def flatten ( iterable ) : NEW_LINE INDENT return ( inner_item for item in iterable for inner_item in item ) NEW_LINE DEDENT def accumulate ( initial , reducer , iterable ) : NEW_LINE INDENT acc = initial NEW_LINE yield initial NEW_LINE for item in iterable : NEW_LINE INDENT acc = reducer ( acc , item ) NEW_LINE yield acc NEW_LINE DEDENT DEDENT N = int ( input ( ) ) NEW_LINE vs = [ ] NEW_LINE for n in range ( N ) : NEW_LINE INDENT a , b = map ( int , input ( ) . split ( ) ) NEW_LINE vs . append ( ( a , b ) ) NEW_LINE DEDENT print ( max ( accumulate ( 0 , lambda x , y : x + y , flatten ( chain ( sorted ( ( ( a , - b ) for a , b in vs if a <= b ) , key = I ( 0 ) ) , sorted ( ( ( a , - b ) for a , b in vs if a > b ) , key = I ( 1 ) ) , ) ) ) ) ) NEW_LINE

n = int ( input ( ) ) NEW_LINE a = [ 0 for i in range ( n ) ] NEW_LINE b = [ 0 for i in range ( n ) ] NEW_LINE for i in range ( n ) : NEW_LINE INDENT a [ i ] , b [ i ] = map ( int , input ( ) . split ( ) ) NEW_LINE DEDENT c = [ ( a [ i ] - b [ i ] ) for i in range ( n ) ] NEW_LINE d = [ [ a [ i ] , b [ i ] , c [ i ] ] for i in range ( n ) ] NEW_LINE d . sort ( key = lambda x : x [ 2 ] ) NEW_LINE d1 = list ( filter ( lambda x : x [ 2 ] < 0 , d ) ) NEW_LINE d2 = list ( filter ( lambda x : x [ 2 ] >= 0 , d ) ) NEW_LINE d1 . sort ( key = lambda x : x [ 0 ] ) NEW_LINE d2 . sort ( key = lambda x : x [ 1 ] , reverse = True ) NEW_LINE max = 0 NEW_LINE temp = 0 NEW_LINE for i in range ( len ( d1 ) ) : NEW_LINE INDENT temp += d1 [ i ] [ 0 ] NEW_LINE if temp > max : NEW_LINE INDENT max = temp NEW_LINE DEDENT temp -= d1 [ i ] [ 1 ] NEW_LINE DEDENT for i in range ( len ( d2 ) ) : NEW_LINE INDENT temp += d2 [ i ] [ 0 ] NEW_LINE if temp > max : NEW_LINE INDENT max = temp NEW_LINE DEDENT temp -= d2 [ i ] [ 1 ] NEW_LINE DEDENT print ( max ) NEW_LINE

N = int ( input ( ) ) NEW_LINE costs = [ [ int ( v ) for v in input ( ) . split ( ) ] for i in range ( N ) ] NEW_LINE costs_negative = sorted ( [ v for v in costs if v [ 0 ] < v [ 1 ] ] , key = lambda a : a [ 0 ] ) NEW_LINE costs_zero = [ v for v in costs if v [ 0 ] == v [ 1 ] ] NEW_LINE costs_positive = sorted ( [ v for v in costs if v [ 0 ] > v [ 1 ] ] , key = lambda a : a [ 1 ] , reverse = True ) NEW_LINE val = 0 NEW_LINE max_val = - float ( " inf " ) NEW_LINE for up , down in costs_negative + costs_zero + costs_positive : NEW_LINE INDENT val += up NEW_LINE if val > max_val : NEW_LINE INDENT max_val = val NEW_LINE DEDENT val -= down NEW_LINE DEDENT print ( max_val ) NEW_LINE


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 . 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 A = in . nextInt ( ) ; int B = in . nextInt ( ) ; if ( A + B >= 10 ) { out . println ( " error " ) ; } else { out . println ( A + B ) ; } } } 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 int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } } }

import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . InputMismatchException ; import java . io . IOException ; import java . io . InputStream ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; FastScanner in = new FastScanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskA solver = new TaskA ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskA { public void solve ( int testNumber , FastScanner in , PrintWriter out ) { int n = in . nextInt ( ) + in . nextInt ( ) ; out . println ( n >= 10 ? " error " : n ) ; } } static class FastScanner { private InputStream in ; private byte [ ] buffer = new byte [ 1024 ] ; private int bufPointer ; private int bufLength ; public FastScanner ( InputStream in ) { this . in = in ; } private int readByte ( ) { if ( bufPointer >= bufLength ) { if ( bufLength == - 1 ) throw new InputMismatchException ( ) ; bufPointer = 0 ; try { bufLength = in . read ( buffer ) ; } catch ( IOException e ) { throw new InputMismatchException ( ) ; } if ( bufLength <= 0 ) return - 1 ; } return buffer [ bufPointer ++ ] ; } private static boolean isSpaceChar ( int c ) { return c == ' ▁ ' || c == ' \n ' || c == ' \r ' || c == ' \t ' || c == - 1 ; } public long nextLong ( ) { long n = 0 ; int b = readByte ( ) ; while ( isSpaceChar ( b ) ) b = readByte ( ) ; boolean minus = ( b == ' - ' ) ; if ( minus ) b = readByte ( ) ; while ( b >= '0' && b <= '9' ) { n *= 10 ; n += b - '0' ; b = readByte ( ) ; } if ( ! isSpaceChar ( b ) ) throw new NumberFormatException ( ) ; return minus ? - n : n ; } public int nextInt ( ) { long n = nextLong ( ) ; if ( n < Integer . MIN_VALUE || n > Integer . MAX_VALUE ) throw new NumberFormatException ( ) ; return ( int ) n ; } } }

import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int sum = A + B ; System . out . println ( ( sum < 10 ) ? sum : " error " ) ; } }

import java . util . Scanner ; public class Main { private static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int x = sc . nextInt ( ) , y = sc . nextInt ( ) ; System . out . println ( x + y >= 10 ? " error " : x + y ) ; } }

import java . io . PrintWriter ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; int A = Integer . parseInt ( sc . next ( ) ) ; int B = Integer . parseInt ( sc . next ( ) ) ; if ( A + B >= 10 ) { out . println ( " error " ) ; } else { out . println ( A + B ) ; } out . flush ( ) ; } }

A , B = map ( int , input ( ) . split ( ) ) NEW_LINE if A + B >= 10 : NEW_LINE INDENT print ( ' error ' ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( A + B ) NEW_LINE DEDENT

a , b = map ( int , input ( ) . split ( ) ) NEW_LINE print ( a + b if a + b < 10 else " error " ) NEW_LINE

import sys NEW_LINE def main ( ) : NEW_LINE INDENT input = sys . stdin . readline NEW_LINE A , B = map ( int , input ( ) . split ( ) ) NEW_LINE if A + B >= 10 : NEW_LINE INDENT return ' error ' NEW_LINE DEDENT else : NEW_LINE INDENT return A + B NEW_LINE DEDENT DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT print ( main ( ) ) NEW_LINE DEDENT

a , b = map ( int , input ( ) . split ( ) ) ; print ( [ ' error ' , a + b ] [ a + b < 10 ] ) NEW_LINE

[ A , B ] = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE if A + B < 10 : NEW_LINE INDENT print ( A + B ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " error " ) NEW_LINE DEDENT


import java . util . * ; import java . io . * ; import static java . lang . System . in ; public class Main { static long ans = 0 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long k = sc . nextLong ( ) ; long [ ] sum = new long [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) sum [ i ] = sum [ i - 1 ] + sc . nextLong ( ) - k ; long [ ] temp = new long [ n + 1 ] ; merge ( 0 , n , sum , temp ) ; PrintWriter out = new PrintWriter ( System . out ) ; out . println ( ans ) ; out . flush ( ) ; } static void merge ( int left , int right , long [ ] sum , long [ ] temp ) { if ( left >= right ) return ; int mid = ( left + right ) / 2 ; merge ( left , mid , sum , temp ) ; merge ( mid + 1 , right , sum , temp ) ; int start = mid + 1 ; for ( int i = left ; i <= mid ; i ++ ) { while ( start <= right && sum [ start ] - sum [ i ] < 0 ) start ++ ; ans += right + 1 - start ; } int k = left , i = left , j = mid + 1 ; while ( i <= mid && j <= right ) { if ( sum [ i ] < sum [ j ] ) temp [ k ++ ] = sum [ i ++ ] ; else temp [ k ++ ] = sum [ j ++ ] ; } while ( i <= mid ) temp [ k ++ ] = sum [ i ++ ] ; while ( j <= right ) temp [ k ++ ] = sum [ j ++ ] ; for ( int m = left ; m <= right ; m ++ ) sum [ m ] = temp [ m ] ; } }

import java . util . * ; class Main { static long [ ] sum ; static int n ; static long tot = 0 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; n = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; sum = new long [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) { sum [ i ] = sum [ i - 1 ] + sc . nextInt ( ) - K ; } merge ( 0 , n ) ; System . out . println ( tot ) ; } static void merge ( int left , int right ) { if ( left >= right ) return ; int mid = ( left + right ) / 2 ; merge ( left , mid ) ; merge ( mid + 1 , right ) ; int i = left , j = mid + 1 , k = 0 ; long [ ] temp = new long [ right - left + 1 ] ; while ( i <= mid && j <= right ) { if ( sum [ i ] <= sum [ j ] ) { tot += mid - i + 1 ; temp [ k ++ ] = sum [ j ++ ] ; } else temp [ k ++ ] = sum [ i ++ ] ; } while ( i <= mid ) temp [ k ++ ] = sum [ i ++ ] ; while ( j <= right ) temp [ k ++ ] = sum [ j ++ ] ; for ( int m = 0 ; m < temp . length ; m ++ ) sum [ left + m ] = temp [ m ] ; } }

import java . util . * ; public class Main { public void main ( Scanner sc ) { int n = sc . nextInt ( ) ; long k = sc . nextInt ( ) ; long a [ ] = new long [ n + 1 ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } sc . close ( ) ; long b [ ] = new long [ n + 1 ] ; TreeMap < Long , Integer > map = new TreeMap < > ( ) ; long sum = 0 ; for ( int i = 0 ; i <= n ; i ++ ) { b [ i ] = sum - k * i ; map . putIfAbsent ( b [ i ] , null ) ; sum += a [ i ] ; } int value = 0 ; for ( Map . Entry < Long , Integer > entry : map . entrySet ( ) ) { entry . setValue ( value ++ ) ; } int bn = Integer . highestOneBit ( ( n + 1 ) * 2 - 1 ) ; long bit [ ] = new long [ 2 * bn ] ; long ans = 0 ; for ( int i = 0 ; i <= n ; i ++ ) { int c = map . get ( b [ i ] ) ; ans += query ( c , bn , bit ) + bit [ c + bn ] ; add ( c , bn , bit ) ; } System . out . println ( ans ) ; } private void add ( int n , int off , long bit [ ] ) { if ( off == 0 ) { return ; } bit [ n + off ] ++ ; add ( n / 2 , off / 2 , bit ) ; } private long query ( int n , int off , long bit [ ] ) { if ( off == 0 ) { return 0 ; } return ( n % 2 ) * bit [ n + off - 1 ] + query ( n / 2 , off / 2 , bit ) ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; new Main ( ) . main ( sc ) ; } }

N , K = map ( int , input ( ) . split ( ) ) NEW_LINE src = [ int ( input ( ) ) for i in range ( N ) ] NEW_LINE cums = [ ( 0 , 1 ) ] NEW_LINE for i , a in enumerate ( src ) : NEW_LINE INDENT cums . append ( ( cums [ - 1 ] [ 0 ] + a - K , i + 2 ) ) NEW_LINE DEDENT bit = [ 0 ] * ( N + 2 ) NEW_LINE def bit_add ( a , w ) : NEW_LINE INDENT x = a NEW_LINE while x <= N : NEW_LINE INDENT bit [ x ] += w NEW_LINE x += ( x & - x ) NEW_LINE DEDENT DEDENT def bit_sum ( a ) : NEW_LINE INDENT x = a NEW_LINE ret = 0 NEW_LINE while x > 0 : NEW_LINE INDENT ret += bit [ x ] NEW_LINE x -= ( x & - x ) NEW_LINE DEDENT return ret NEW_LINE DEDENT ans = 0 NEW_LINE for i , a in sorted ( cums ) : NEW_LINE INDENT ans += bit_sum ( a - 1 ) NEW_LINE bit_add ( a , 1 ) NEW_LINE DEDENT print ( ans ) NEW_LINE

def mergecount ( A ) : NEW_LINE INDENT cnt = 0 NEW_LINE n = len ( A ) NEW_LINE if n > 1 : NEW_LINE INDENT A1 = A [ : n >> 1 ] NEW_LINE A2 = A [ n >> 1 : ] NEW_LINE cnt += mergecount ( A1 ) NEW_LINE cnt += mergecount ( A2 ) NEW_LINE i1 = 0 NEW_LINE i2 = 0 NEW_LINE for i in range ( n ) : NEW_LINE INDENT if i2 == len ( A2 ) : NEW_LINE INDENT A [ i ] = A1 [ i1 ] NEW_LINE i1 += 1 NEW_LINE DEDENT elif i1 == len ( A1 ) : NEW_LINE INDENT A [ i ] = A2 [ i2 ] NEW_LINE i2 += 1 NEW_LINE DEDENT elif A1 [ i1 ] <= A2 [ i2 ] : NEW_LINE INDENT A [ i ] = A1 [ i1 ] NEW_LINE i1 += 1 NEW_LINE DEDENT else : NEW_LINE INDENT A [ i ] = A2 [ i2 ] NEW_LINE i2 += 1 NEW_LINE cnt += n // 2 - i1 NEW_LINE DEDENT DEDENT DEDENT return cnt NEW_LINE DEDENT N , K = map ( int , input ( ) . split ( ) ) NEW_LINE A = [ int ( input ( ) ) for i in range ( N ) ] NEW_LINE Ak = [ a - K for a in A ] NEW_LINE Aks = [ 0 ] NEW_LINE t = 0 NEW_LINE for ak in Ak : NEW_LINE INDENT t += ak NEW_LINE Aks . append ( t ) NEW_LINE DEDENT print ( N * ( N + 1 ) // 2 - mergecount ( Aks ) ) NEW_LINE

def inpl ( ) : return [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE class BIT : NEW_LINE INDENT def __init__ ( self , n ) : NEW_LINE INDENT self . size = n NEW_LINE self . tree = [ 0 ] * ( n + 1 ) NEW_LINE DEDENT def suma ( self , i ) : NEW_LINE INDENT s = 0 NEW_LINE while i > 0 : NEW_LINE INDENT s += self . tree [ i ] NEW_LINE i -= i & - i NEW_LINE DEDENT return s NEW_LINE DEDENT def add ( self , i , x ) : NEW_LINE INDENT while i <= self . size : NEW_LINE INDENT self . tree [ i ] += x NEW_LINE i += i & - i NEW_LINE DEDENT DEDENT DEDENT N , K = inpl ( ) NEW_LINE a = [ 0 ] NEW_LINE for _ in range ( N ) : NEW_LINE INDENT a . append ( a [ - 1 ] + int ( input ( ) ) - K ) NEW_LINE DEDENT c = dict ( [ ] ) NEW_LINE for i , v in enumerate ( sorted ( set ( a ) ) ) : NEW_LINE INDENT c [ v ] = i + 1 NEW_LINE DEDENT Tr = BIT ( N + 1 ) NEW_LINE ans = 0 NEW_LINE for v in a : NEW_LINE INDENT ans += Tr . suma ( c [ v ] ) NEW_LINE Tr . add ( c [ v ] , 1 ) NEW_LINE DEDENT print ( ans ) NEW_LINE

import sys NEW_LINE from itertools import accumulate NEW_LINE inf = 1 << 60 NEW_LINE ans = 0 NEW_LINE def solve ( ) : NEW_LINE INDENT n , k = map ( int , sys . stdin . readline ( ) . split ( ) ) NEW_LINE a = [ int ( sys . stdin . readline ( ) . rstrip ( ) ) - k for i in range ( n ) ] NEW_LINE s = [ 0 ] + list ( accumulate ( a ) ) NEW_LINE MergeSort ( s ) NEW_LINE print ( ans ) NEW_LINE DEDENT def MergeSort ( a ) : NEW_LINE INDENT if len ( a ) == 1 : NEW_LINE INDENT return a NEW_LINE DEDENT apre = MergeSort ( a [ : len ( a ) // 2 ] ) NEW_LINE asuf = MergeSort ( a [ len ( a ) // 2 : ] ) NEW_LINE res = merge ( apre , asuf ) NEW_LINE return res NEW_LINE DEDENT def merge ( a , b ) : NEW_LINE INDENT global ans NEW_LINE na = len ( a ) NEW_LINE nb = len ( b ) NEW_LINE a . append ( - inf ) NEW_LINE b . append ( - inf ) NEW_LINE la = 0 NEW_LINE lb = 0 NEW_LINE res = [ ] NEW_LINE for i in range ( na + nb ) : NEW_LINE INDENT if a [ la ] <= b [ lb ] : NEW_LINE INDENT ans += na - la NEW_LINE res . append ( b [ lb ] ) NEW_LINE lb += 1 NEW_LINE DEDENT else : NEW_LINE INDENT res . append ( a [ la ] ) NEW_LINE la += 1 NEW_LINE DEDENT DEDENT return res NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT solve ( ) NEW_LINE DEDENT

n , k = ( int ( i ) for i in input ( ) . split ( ) ) NEW_LINE a = [ int ( input ( ) ) - k for i in range ( n ) ] NEW_LINE b = [ [ 0 , 0 ] ] NEW_LINE for i in range ( n ) : b . append ( [ b [ - 1 ] [ 0 ] + a [ i ] , i + 1 ] ) NEW_LINE b . sort ( ) NEW_LINE num , c = 1 , [ [ b [ 0 ] [ 1 ] , 1 ] ] NEW_LINE for i in range ( 1 , n + 1 ) : NEW_LINE INDENT if b [ i ] [ 0 ] != b [ i - 1 ] [ 0 ] : num += 1 NEW_LINE c . append ( [ b [ i ] [ 1 ] , num ] ) NEW_LINE DEDENT c , d , ans = sorted ( c ) , [ 0 ] * ( n + 2 ) , 0 NEW_LINE def add ( i ) : NEW_LINE INDENT while i <= n + 1 : NEW_LINE INDENT d [ i ] += 1 NEW_LINE i += i & - i NEW_LINE DEDENT DEDENT def get ( i ) : NEW_LINE INDENT s = 0 NEW_LINE while i : NEW_LINE INDENT s += d [ i ] NEW_LINE i -= i & - i NEW_LINE DEDENT return s NEW_LINE DEDENT for i , j in c : NEW_LINE INDENT ans += get ( j ) NEW_LINE add ( j ) NEW_LINE DEDENT print ( ans ) NEW_LINE


import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; long n = Long . parseLong ( s ) ; String [ ] t = s . split ( " " ) ; if ( n == 3 || n == 2 || n == 5 ) { System . out . println ( " Prime " ) ; return ; } if ( n % 2 == 0 || n % 5 == 0 || n == 1 ) { System . out . println ( " Not ▁ Prime " ) ; return ; } long sum = 0 ; for ( int i = 0 ; i < t . length ; i ++ ) sum += Integer . parseInt ( t [ i ] ) ; if ( sum % 3 == 0 ) System . out . println ( " Not ▁ Prime " ) ; else System . out . println ( " Prime " ) ; } }

import java . util . * ; import java . awt . * ; import static java . lang . System . * ; import static java . lang . Math . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( in ) ; int n = sc . nextInt ( ) ; int c = 0 ; for ( int i = 2 ; i < n ; i ++ ) { if ( n % i == 0 ) break ; c ++ ; } if ( c == n - 2 && n > 1 ) { out . println ( " Prime " ) ; } else { int n0 = n % 10 , digsum = 0 , nt = n ; while ( n > 0 ) { digsum += n % 10 ; n /= 10 ; } if ( digsum % 3 != 0 && n0 != 5 && n0 % 2 != 0 && nt > 1 ) { out . println ( " Prime " ) ; } else { out . println ( " Not ▁ Prime " ) ; } } } }

import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner in = new Scanner ( System . in ) ; while ( in . hasNext ( ) ) { int n = in . nextInt ( ) ; if ( judge ( n ) ) { System . out . println ( " Prime " ) ; } else { System . out . println ( " Not ▁ Prime " ) ; } } } public static boolean judge ( int n ) { if ( n == 1 ) { return false ; } boolean isPrime = true ; for ( int i = 2 ; i * i <= n ; i ++ ) { if ( n % i == 0 ) { isPrime = false ; break ; } } if ( isPrime ) { return true ; } return ( n % 2 != 0 ) && ( n % 10 != 5 ) && ( n % 3 != 0 ) ; } }

import java . util . * ; public class Main { private static Scanner scanner = new Scanner ( System . in ) ; public static void main ( String [ ] $ ) { int n = scanner . nextInt ( ) ; boolean ans = true ; for ( int i = 3 ; i <= Math . sqrt ( n ) ; i += 2 ) if ( ! ( ans = n % i != 0 ) ) break ; System . out . println ( n == 2 || n != 1 && ( ans && n % 2 == 1 || Integer . toString ( n ) . chars ( ) . map ( c -> c - '0' ) . sum ( ) % 3 != 0 && java . util . Arrays . asList ( 1 , 3 , 7 , 9 ) . contains ( n % 10 ) ) ? " Prime " : " Not ▁ Prime " ) ; } }

import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { final Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int wantUpper = n ; boolean isP = true ; for ( int i = 2 ; i <= Math . sqrt ( wantUpper ) ; i ++ ) { if ( n % i == 0 ) { isP = false ; break ; } } if ( n != 1 && isP ) { System . out . println ( " Prime " ) ; } else { String s = String . valueOf ( n ) ; int a = Integer . parseInt ( s . substring ( s . length ( ) - 1 ) ) ; long sum = 0 ; for ( char c : s . toCharArray ( ) ) { sum += Integer . parseInt ( String . valueOf ( c ) ) ; } if ( n != 1 && a != 5 && sum % 3 != 0 && a % 2 != 0 ) { System . out . println ( " Prime " ) ; } else { System . out . println ( " Not ▁ Prime " ) ; } } } }

def a_prime ( N ) : NEW_LINE INDENT if N == 1 : NEW_LINE INDENT return ' Not ▁ Prime ' NEW_LINE DEDENT is_prime = True NEW_LINE for k in range ( 2 , int ( N ** 0.5 ) + 1 ) : NEW_LINE INDENT if N % k == 0 : NEW_LINE INDENT is_prime = False NEW_LINE break NEW_LINE DEDENT DEDENT if is_prime : NEW_LINE INDENT ans = ' Prime ' NEW_LINE DEDENT else : NEW_LINE INDENT n_str = str ( N ) NEW_LINE cond = [ N % 10 not in ( 0 , 2 , 4 , 5 , 6 , 8 ) , sum ( map ( int , str ( N ) ) ) % 3 != 0 ] NEW_LINE ans = ' Prime ' if all ( cond ) else ' Not ▁ Prime ' NEW_LINE DEDENT return ans NEW_LINE DEDENT N = int ( input ( ) ) NEW_LINE print ( a_prime ( N ) ) NEW_LINE

a = int ( input ( ) ) NEW_LINE if a != 1 and a % 2 != 0 and a % 3 != 0 and a % 5 != 0 : NEW_LINE INDENT print ( " Prime " ) NEW_LINE DEDENT elif a == 3 or a == 5 or a == 2 : NEW_LINE INDENT print ( " Prime " ) NEW_LINE DEDENT else : print ( " Not ▁ Prime " ) NEW_LINE

import math NEW_LINE N = int ( input ( ) ) NEW_LINE def is_prime ( x ) : NEW_LINE INDENT if x < 2 : return False NEW_LINE if x == 2 or x == 3 or x == 5 : return True NEW_LINE if x % 2 == 0 or x % 3 == 0 or x % 5 == 0 : return False NEW_LINE prime = 7 NEW_LINE step = 4 NEW_LINE while prime <= math . sqrt ( x ) : NEW_LINE INDENT if x % prime == 0 : return False NEW_LINE prime += step NEW_LINE step = 6 - step NEW_LINE DEDENT return True NEW_LINE DEDENT ans = ' Not ▁ Prime ' NEW_LINE if is_prime ( N ) : NEW_LINE INDENT ans = ' Prime ' NEW_LINE DEDENT else : NEW_LINE INDENT if N != 1 and N % 2 != 0 and N % 10 != 5 and N % 3 != 0 : NEW_LINE INDENT ans = ' Prime ' NEW_LINE DEDENT DEDENT print ( ans ) NEW_LINE

import sys NEW_LINE sys . setrecursionlimit ( 10 ** 9 ) NEW_LINE input = sys . stdin . readline NEW_LINE def isPrime ( n ) -> bool : NEW_LINE INDENT if n < 2 : NEW_LINE INDENT return False NEW_LINE DEDENT i = 2 NEW_LINE while i * i <= n : NEW_LINE INDENT if n % i == 0 : NEW_LINE INDENT return False NEW_LINE DEDENT i += 1 NEW_LINE DEDENT return True NEW_LINE DEDENT ans = " Not ▁ Prime " NEW_LINE N = int ( input ( ) ) NEW_LINE if isPrime ( N ) : NEW_LINE INDENT ans = " Prime " NEW_LINE DEDENT if N != 1 and N % 2 != 0 and N % 5 != 0 and N % 3 != 0 : NEW_LINE INDENT ans = " Prime " NEW_LINE DEDENT print ( ans ) NEW_LINE

from math import sqrt NEW_LINE def is_prime ( n ) : NEW_LINE INDENT if n <= 1 : NEW_LINE INDENT return False NEW_LINE DEDENT for i in range ( 2 , int ( sqrt ( n ) ) + 1 ) : NEW_LINE INDENT if n % i == 0 : NEW_LINE INDENT return False NEW_LINE DEDENT DEDENT return True NEW_LINE DEDENT def main ( ) : NEW_LINE INDENT n = int ( input ( ) ) NEW_LINE if ( is_prime ( n ) or n >= 2 and n % 2 != 0 and n % 10 != 5 and sum ( int ( c ) for c in str ( n ) ) % 3 != 0 ) : NEW_LINE INDENT print ( " Prime " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " Not ▁ Prime " ) NEW_LINE DEDENT DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT main ( ) NEW_LINE DEDENT


import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String komugiko = scanner . nextLine ( ) ; scanner . close ( ) ; String xStr = "0" , yStr = "0" ; for ( int i = 0 ; i < komugiko . length ( ) ; i ++ ) { if ( komugiko . charAt ( i ) == ' ▁ ' ) { xStr = komugiko . substring ( 0 , i ) ; yStr = komugiko . substring ( i + 1 ) ; break ; } } int x = Integer . parseInt ( xStr ) ; int y = Integer . parseInt ( yStr ) ; int takoyaki = y / x ; System . out . println ( takoyaki ) ; } }

import java . util . * ; import java . util . List ; import java . util . ArrayList ; import java . math . * ; class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int x = scanner . nextInt ( ) ; int y = scanner . nextInt ( ) ; System . out . println ( y / x ) ; } }

import java . util . Scanner ; public class Main { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int a = Integer . parseInt ( sc . next ( ) ) ; int b = Integer . parseInt ( sc . next ( ) ) ; int c = 0 ; c = b / a ; System . out . println ( c ) ; System . out . flush ( ) ; sc . close ( ) ; } }

import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; if ( x < y ) { System . out . println ( y / x ) ; } else { System . out . println ( 0 ) ; } } }

import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; System . out . println ( Math . floorDiv ( y , x ) ) ; } }

x , y = map ( int , input ( ) . split ( ) ) NEW_LINE print ( y // x ) NEW_LINE

import sys NEW_LINE class Calculator : NEW_LINE INDENT def __init__ ( self , x , y ) : NEW_LINE INDENT self . x = x NEW_LINE self . y = y NEW_LINE DEDENT def get_num ( self ) : NEW_LINE INDENT return int ( self . y / self . x ) NEW_LINE DEDENT DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT x , y , = map ( int , input ( ) . split ( ) ) NEW_LINE c = Calculator ( x , y ) NEW_LINE print ( c . get_num ( ) ) NEW_LINE DEDENT

a = input ( ) . split ( ) NEW_LINE a = [ int ( i ) for i in a ] NEW_LINE print ( int ( a [ 1 ] / a [ 0 ] ) ) NEW_LINE

l = [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE print ( l [ 1 ] // l [ 0 ] ) NEW_LINE

x , y = map ( int , input ( ) . split ( ) ) NEW_LINE tako = int ( y / x ) NEW_LINE print ( tako ) NEW_LINE


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] [ ] f = new int [ n ] [ 10 ] ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < 10 ; j ++ ) { f [ i ] [ j ] = sc . nextInt ( ) ; } } int [ ] [ ] p = new int [ n ] [ 11 ] ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < 11 ; j ++ ) { p [ i ] [ j ] = sc . nextInt ( ) ; } } long ans = Long . MIN_VALUE ; for ( int i = 1 ; i < 1 << 10 ; i ++ ) { int [ ] c = new int [ n ] ; for ( int j = 0 ; j < 10 ; j ++ ) { if ( ( i >> j & 1 ) == 1 ) { for ( int k = 0 ; k < n ; k ++ ) { if ( f [ k ] [ j ] == 1 ) c [ k ] ++ ; } } } long tmp = 0 ; for ( int l = 0 ; l < n ; l ++ ) tmp += p [ l ] [ c [ l ] ] ; ans = Math . max ( ans , tmp ) ; } System . out . println ( ans ) ; sc . close ( ) ; } }

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 DAYS = 5 ; int TIME = 2 ; int [ ] [ ] [ ] F = new int [ N ] [ DAYS ] [ TIME ] ; for ( int n = 0 ; n < N ; n ++ ) { for ( int d = 0 ; d < DAYS ; d ++ ) { for ( int t = 0 ; t < TIME ; t ++ ) { F [ n ] [ d ] [ t ] = sc . nextInt ( ) ; } } } int TOGETHER_DAYTIME = 11 ; long [ ] [ ] P = new long [ N ] [ TOGETHER_DAYTIME ] ; for ( int n = 0 ; n < N ; n ++ ) { for ( int dt = 0 ; dt < TOGETHER_DAYTIME ; dt ++ ) { P [ n ] [ dt ] = sc . nextLong ( ) ; } } long max = Long . MIN_VALUE ; for ( int dt = 0 ; dt < 2 << DAYS * TIME ; dt ++ ) { long tmpMax = 0 ; boolean haveTogetherShop = false ; for ( int n = 0 ; n < N ; n ++ ) { int cnt = 0 ; for ( int d1 = 0 ; d1 < DAYS ; d1 ++ ) { int timeBit = ( dt >> d1 * TIME ) & 3 ; for ( int t1 = 0 ; t1 < TIME ; t1 ++ ) { if ( ( ( timeBit >> t1 ) & 1 ) == 1 && F [ n ] [ d1 ] [ t1 ] == 1 ) { cnt ++ ; haveTogetherShop = true ; } } } tmpMax += P [ n ] [ cnt ] ; } if ( haveTogetherShop ) { max = Math . max ( max , tmpMax ) ; } } out . println ( max ) ; } }

import java . util . Scanner ; public class Main { static int open [ ] = new int [ 10 ] ; static int ans = Integer . MIN_VALUE ; static int n ; static int f [ ] [ ] ; static Scanner sc ; static int p [ ] [ ] ; static boolean first = true ; public static void main ( String [ ] args ) { sc = new Scanner ( System . in ) ; n = sc . nextInt ( ) ; f = new int [ n ] [ 10 ] ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < 10 ; j ++ ) { f [ i ] [ j ] = sc . nextInt ( ) ; } } p = new int [ n ] [ 11 ] ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < 11 ; j ++ ) { p [ i ] [ j ] = sc . nextInt ( ) ; } } DFS ( 0 ) ; System . out . println ( ans ) ; } public static void DFS ( int pos ) { if ( pos >= 10 ) { return ; } open [ pos ] = 0 ; func ( ) ; DFS ( pos + 1 ) ; open [ pos ] = 1 ; func ( ) ; DFS ( pos + 1 ) ; } public static void func ( ) { int opencnt = 0 ; for ( int i = 0 ; i < 10 ; i ++ ) { if ( open [ i ] == 0 ) { opencnt ++ ; } } if ( opencnt == 10 ) { return ; } int tmp = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int cnt = 0 ; for ( int j = 0 ; j < 10 ; j ++ ) { if ( open [ j ] == 0 ) { continue ; } else { if ( f [ i ] [ j ] == 1 ) { cnt ++ ; } } } tmp += p [ i ] [ cnt ] ; } ans = Math . max ( ans , tmp ) ; } }

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 n = in . nextInt ( ) ; String [ ] map = new String [ n ] ; long [ ] [ ] point = new long [ n ] [ 11 ] ; for ( int i = 0 ; i < n ; i ++ ) { String str = " " ; for ( int j = 0 ; j < 10 ; j ++ ) { str += in . next ( ) ; } map [ i ] = str ; } for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < 11 ; j ++ ) { point [ i ] [ j ] = in . nextLong ( ) ; } } long ans = Long . MIN_VALUE ; for ( int i = 1 ; i < 1024 ; i ++ ) { long p = 0 ; for ( int j = 0 ; j < n ; j ++ ) { String str = map [ j ] ; int dec = Integer . parseInt ( str , 2 ) ; int cnt = Integer . bitCount ( dec & i ) ; p += point [ j ] [ cnt ] ; } ans = Math . max ( ans , p ) ; } out . print ( ans ) ; } } }

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 ) { int n = scanner . nextInt ( ) ; int [ ] [ ] f = IntStream . range ( 0 , n ) . mapToObj ( i -> IntStream . range ( 0 , 10 ) . map ( j -> scanner . nextInt ( ) ) . toArray ( ) ) . toArray ( int [ ] [ ] :: new ) ; int [ ] [ ] p = IntStream . range ( 0 , n ) . mapToObj ( i -> IntStream . range ( 0 , 11 ) . map ( j -> scanner . nextInt ( ) ) . toArray ( ) ) . toArray ( int [ ] [ ] :: new ) ; IntStream . range ( 1 , 1024 ) . map ( i -> IntStream . range ( 0 , n ) . map ( j -> p [ j ] [ ( int ) IntStream . range ( 0 , 10 ) . filter ( k -> ( i >> k & 1 ) == 1 && f [ j ] [ k ] == 1 ) . count ( ) ] ) . sum ( ) ) . max ( ) . ifPresent ( System . out :: println ) ; } }

N = int ( input ( ) ) NEW_LINE F = [ ] NEW_LINE for i in range ( N ) : NEW_LINE INDENT F . append ( list ( map ( int , input ( ) . split ( ) ) ) ) NEW_LINE DEDENT P = [ ] NEW_LINE for i in range ( N ) : NEW_LINE INDENT P . append ( list ( map ( int , input ( ) . split ( ) ) ) ) NEW_LINE DEDENT B = [ bin ( i ) [ 2 : ] for i in range ( 1024 ) ] NEW_LINE for i in range ( len ( B ) ) : NEW_LINE INDENT while ( len ( B [ i ] ) < 10 ) : NEW_LINE INDENT B [ i ] = "0" + B [ i ] NEW_LINE DEDENT DEDENT c = 0 NEW_LINE ans = - 10 ** 9 NEW_LINE for b in B [ 1 : ] : NEW_LINE INDENT res = 0 NEW_LINE for index , f in enumerate ( F ) : NEW_LINE INDENT for i , j in zip ( f , b ) : NEW_LINE INDENT if ( str ( i ) == j and i == 1 ) : NEW_LINE INDENT c += 1 NEW_LINE DEDENT DEDENT res += P [ index ] [ c ] NEW_LINE c = 0 NEW_LINE DEDENT ans = max ( ans , res ) NEW_LINE DEDENT print ( ans ) NEW_LINE

from itertools import product NEW_LINE import numpy as np NEW_LINE def solve ( string ) : NEW_LINE INDENT n , * fp = map ( int , string . split ( ) ) NEW_LINE f = fp [ : 10 * n ] NEW_LINE p = fp [ 10 * n : ] NEW_LINE ans = - n * 10 ** 7 NEW_LINE int_f = [ int ( " " . join ( map ( str , f [ 10 * i : 10 * ( i + 1 ) ] ) ) , 2 ) for i in range ( n ) ] NEW_LINE for o in range ( 1 , 2 ** 10 ) : NEW_LINE INDENT tmp = [ sum ( map ( int , " { : b } " . format ( o & _f ) ) ) for _f in int_f ] NEW_LINE ans = max ( ans , sum ( [ p [ 11 * i + t ] for i , t in enumerate ( tmp ) ] ) ) NEW_LINE DEDENT return str ( ans ) NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT n = int ( input ( ) ) NEW_LINE print ( solve ( ' { } \n ' . format ( n ) + ' \n ' . join ( [ input ( ) for _ in range ( 2 * n ) ] ) ) ) NEW_LINE DEDENT

import sys NEW_LINE sys . setrecursionlimit ( 10000 ) NEW_LINE N = int ( input ( ) ) NEW_LINE count = [ ] NEW_LINE F = [ list ( map ( int , input ( ) . split ( ) ) ) for i in range ( N ) ] NEW_LINE P = [ list ( map ( int , input ( ) . split ( ) ) ) for i in range ( N ) ] NEW_LINE INF = 10 ** 9 NEW_LINE def dfs ( s ) : NEW_LINE INDENT if len ( s ) == 10 : NEW_LINE INDENT if "1" not in s : NEW_LINE INDENT val = - INF NEW_LINE DEDENT if "1" in s : NEW_LINE INDENT val = 0 NEW_LINE c = [ 0 for i in range ( N ) ] NEW_LINE for i in range ( N ) : NEW_LINE INDENT count = 0 NEW_LINE for j in range ( 10 ) : NEW_LINE INDENT if int ( int ( s [ j ] ) * F [ i ] [ j ] ) : NEW_LINE INDENT c [ i ] += 1 NEW_LINE DEDENT DEDENT DEDENT for i in range ( N ) : NEW_LINE INDENT val += P [ i ] [ c [ i ] ] NEW_LINE DEDENT DEDENT return val NEW_LINE DEDENT else : NEW_LINE INDENT return max ( dfs ( s + "0" ) , dfs ( s + "1" ) ) NEW_LINE DEDENT DEDENT print ( dfs ( " " ) ) NEW_LINE

import itertools NEW_LINE def main ( ) : NEW_LINE INDENT n = int ( input ( ) ) NEW_LINE ans = - 10 ** 9 NEW_LINE f = [ [ 0 for i in range ( 10 ) ] for j in range ( n ) ] NEW_LINE p = [ [ 0 for i in range ( 11 ) ] for j in range ( n ) ] NEW_LINE for i in range ( n ) : NEW_LINE INDENT f [ i ] = [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE DEDENT for i in range ( n ) : NEW_LINE INDENT p [ i ] = [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE DEDENT ans = - float ( " inf " ) NEW_LINE for i0 , i1 , i2 , i3 , i4 , i5 , i6 , i7 , i8 , i9 in itertools . product ( range ( 2 ) , range ( 2 ) , range ( 2 ) , range ( 2 ) , range ( 2 ) , range ( 2 ) , range ( 2 ) , range ( 2 ) , range ( 2 ) , range ( 2 ) ) : NEW_LINE INDENT i_list = [ i0 , i1 , i2 , i3 , i4 , i5 , i6 , i7 , i8 , i9 ] NEW_LINE if sum ( i_list ) != 0 : NEW_LINE INDENT value = 0 NEW_LINE for j in range ( n ) : NEW_LINE INDENT value += p [ j ] [ sum ( [ i_list [ _ ] * f [ j ] [ _ ] for _ in range ( 10 ) ] ) ] NEW_LINE DEDENT ans = max ( ans , value ) NEW_LINE DEDENT DEDENT print ( ans ) NEW_LINE DEDENT main ( ) NEW_LINE

def base10to ( n , b ) : NEW_LINE INDENT if ( int ( n / b ) ) : NEW_LINE INDENT return base10to ( int ( n / b ) , b ) + str ( n % b ) NEW_LINE DEDENT return str ( n % b ) NEW_LINE DEDENT N = int ( input ( ) ) NEW_LINE f = [ ] NEW_LINE for i in range ( N ) : NEW_LINE INDENT f . append ( list ( map ( int , input ( ) . split ( ) ) ) ) NEW_LINE DEDENT p = [ ] NEW_LINE for i in range ( N ) : NEW_LINE INDENT p . append ( list ( map ( int , input ( ) . split ( ) ) ) ) NEW_LINE DEDENT ans = [ ] NEW_LINE for i in range ( 1 , 1024 ) : NEW_LINE INDENT lis = list ( base10to ( i , 4 ) . zfill ( 5 ) ) NEW_LINE temp = 0 NEW_LINE for k in range ( N ) : NEW_LINE INDENT count = 0 NEW_LINE for j in range ( len ( lis ) ) : NEW_LINE INDENT if lis [ j ] == '0' : NEW_LINE INDENT count += f [ k ] [ 2 * j ] * 0 + f [ k ] [ 2 * j + 1 ] * 0 NEW_LINE DEDENT elif lis [ j ] == '1' : NEW_LINE INDENT count += f [ k ] [ 2 * j ] * 1 + f [ k ] [ 2 * j + 1 ] * 0 NEW_LINE DEDENT elif lis [ j ] == '2' : NEW_LINE INDENT count += f [ k ] [ 2 * j ] * 0 + f [ k ] [ 2 * j + 1 ] * 1 NEW_LINE DEDENT elif lis [ j ] == '3' : NEW_LINE INDENT count += f [ k ] [ 2 * j ] * 1 + f [ k ] [ 2 * j + 1 ] * 1 NEW_LINE DEDENT DEDENT temp += p [ k ] [ count ] NEW_LINE DEDENT ans . append ( temp ) NEW_LINE DEDENT print ( max ( ans ) ) NEW_LINE


import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int b [ ] [ ] = new int [ N ] [ M ] ; for ( int i = 0 ; i < N ; i ++ ) { String str = sc . next ( ) ; for ( int j = 0 ; j < M ; j ++ ) { b [ i ] [ j ] = Integer . parseInt ( str . substring ( j , j + 1 ) ) ; } } int ret [ ] [ ] = new int [ N ] [ M ] ; for ( int i = 1 ; i < N - 1 ; i ++ ) { for ( int j = 1 ; j < M - 1 ; j ++ ) { int min = 10 ; min = Math . min ( b [ i ] [ j - 1 ] , min ) ; min = Math . min ( b [ i - 1 ] [ j ] , min ) ; min = Math . min ( b [ i + 1 ] [ j ] , min ) ; min = Math . min ( b [ i ] [ j + 1 ] , min ) ; b [ i ] [ j - 1 ] -= min ; b [ i - 1 ] [ j ] -= min ; b [ i + 1 ] [ j ] -= min ; b [ i ] [ j + 1 ] -= min ; ret [ i ] [ j ] = min ; } } for ( int i = 0 ; i < N ; i ++ ) { for ( int j = 0 ; j < M ; j ++ ) { System . out . print ( ret [ i ] [ j ] ) ; } System . out . println ( ) ; } } }

import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] [ ] field = new int [ n ] [ m ] ; int [ ] [ ] before = new int [ n ] [ m ] ; for ( int i = 0 ; i < n ; i ++ ) { char [ ] arr = sc . next ( ) . toCharArray ( ) ; for ( int j = 0 ; j < m ; j ++ ) { field [ i ] [ j ] = arr [ j ] - '0' ; } } for ( int i = 1 ; i < n - 1 ; i ++ ) { for ( int j = 1 ; j < m - 1 ; j ++ ) { int x = field [ i - 1 ] [ j ] ; before [ i ] [ j ] = x ; field [ i - 1 ] [ j ] -= x ; field [ i + 1 ] [ j ] -= x ; field [ i ] [ j - 1 ] -= x ; field [ i ] [ j + 1 ] -= x ; } } StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { sb . append ( before [ i ] [ j ] ) ; } sb . append ( " \n " ) ; } System . out . print ( sb ) ; } }

import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int a [ ] [ ] = new int [ N ] [ M ] ; for ( int i = 0 ; i < N ; i ++ ) { String s = sc . next ( ) ; for ( int j = 0 ; j < M ; j ++ ) { a [ i ] [ j ] = Integer . valueOf ( s . substring ( j , j + 1 ) ) ; } } int ret [ ] [ ] = new int [ N ] [ M ] ; for ( int i = 1 ; i < N - 1 ; i ++ ) { for ( int j = 1 ; j < M - 1 ; j ++ ) { int min = 10 ; min = Math . min ( a [ i ] [ j - 1 ] , min ) ; min = Math . min ( a [ i ] [ j + 1 ] , min ) ; min = Math . min ( a [ i + 1 ] [ j ] , min ) ; min = Math . min ( a [ i - 1 ] [ j ] , min ) ; a [ i ] [ j - 1 ] -= min ; a [ i ] [ j + 1 ] -= min ; a [ i + 1 ] [ j ] -= min ; a [ i - 1 ] [ j ] -= min ; ret [ i ] [ j ] = min ; } } for ( int i = 0 ; i < N ; i ++ ) { for ( int j = 0 ; j < M ; j ++ ) { System . out . print ( ret [ i ] [ j ] ) ; } System . out . println ( ) ; } } }

import java . util . * ; public class Main { public static void main ( String [ ] args ) { int i , j , n , m , a [ ] [ ] , b [ ] [ ] ; String a1 [ ] ; Scanner sc = new Scanner ( System . in ) ; n = sc . nextInt ( ) ; m = sc . nextInt ( ) ; a = new int [ n ] [ m ] ; b = new int [ n ] [ m ] ; a1 = new String [ n ] ; for ( i = 0 ; i < n ; i ++ ) a1 [ i ] = sc . next ( ) ; for ( i = 0 ; i < n ; i ++ ) for ( j = 0 ; j < m ; j ++ ) a [ i ] [ j ] = Character . getNumericValue ( a1 [ i ] . charAt ( j ) ) ; for ( i = 0 ; i < n ; i ++ ) for ( j = 0 ; j < m ; j ++ ) b [ i ] [ j ] = 0 ; for ( i = 0 ; i < n - 2 ; i ++ ) { for ( j = 1 ; j < m - 1 ; j ++ ) { if ( a [ i ] [ j ] != 0 ) { b [ i + 1 ] [ j ] = a [ i ] [ j ] ; a [ i + 1 ] [ j - 1 ] -= a [ i ] [ j ] ; a [ i + 1 ] [ j + 1 ] -= a [ i ] [ j ] ; a [ i + 2 ] [ j ] -= a [ i ] [ j ] ; a [ i ] [ j ] = 0 ; } } } for ( i = 0 ; i < n ; i ++ ) { for ( j = 0 ; j < m ; j ++ ) System . out . print ( b [ i ] [ j ] ) ; System . out . println ( " " ) ; } } }

import java . util . Scanner ; public class Main { private static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] [ ] a = new int [ n ] [ m ] ; int [ ] [ ] ret = new int [ n ] [ m ] ; for ( int i = 0 ; i < n ; i ++ ) { String s = sc . next ( ) ; for ( int j = 0 ; j < m ; j ++ ) { a [ i ] [ j ] = Integer . valueOf ( s . substring ( j , j + 1 ) ) ; } } for ( int i = 1 ; i < n - 1 ; i ++ ) { for ( int j = 1 ; j < m - 1 ; j ++ ) { int min = 10 ; min = Math . min ( min , a [ i - 1 ] [ j ] ) ; min = Math . min ( min , a [ i ] [ j - 1 ] ) ; min = Math . min ( min , a [ i + 1 ] [ j ] ) ; min = Math . min ( min , a [ i ] [ j + 1 ] ) ; a [ i - 1 ] [ j ] -= min ; a [ i ] [ j - 1 ] -= min ; a [ i + 1 ] [ j ] -= min ; a [ i ] [ j + 1 ] -= min ; ret [ i ] [ j ] = min ; } } for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { System . out . print ( ret [ i ] [ j ] ) ; } System . out . println ( " " ) ; } } }

n , m = map ( int , input ( ) . split ( ) ) NEW_LINE s = eval ( ' list ( map ( int , input ( ) ) ) , ' * n ) NEW_LINE a = eval ( ' [ 0 ] * m , ' * n ) NEW_LINE for i in range ( n - 2 ) : NEW_LINE INDENT for j in range ( 1 , m - 1 ) : NEW_LINE INDENT a [ i + 1 ] [ j ] = s [ i ] [ j ] NEW_LINE for x , y in ( ( i + 1 , j - 1 ) , ( i + 2 , j ) , ( i + 1 , j + 1 ) , ( i , j ) ) : NEW_LINE INDENT s [ x ] [ y ] -= s [ i ] [ j ] NEW_LINE DEDENT DEDENT DEDENT for i in a : NEW_LINE INDENT print ( * i , sep = ' ' ) NEW_LINE DEDENT

def solve ( N , M , board ) : NEW_LINE INDENT before = [ [ 0 for _ in range ( M ) ] for _ in range ( N ) ] NEW_LINE for i in range ( N ) : NEW_LINE INDENT for j in range ( M ) : NEW_LINE INDENT v = board [ i ] [ j ] NEW_LINE if v > 0 : NEW_LINE INDENT before [ i + 1 ] [ j ] = v NEW_LINE board [ i ] [ j ] -= v NEW_LINE board [ i + 2 ] [ j ] -= v NEW_LINE board [ i + 1 ] [ j - 1 ] -= v NEW_LINE board [ i + 1 ] [ j + 1 ] -= v NEW_LINE DEDENT DEDENT DEDENT return before NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT N , M = map ( int , input ( ) . split ( ) ) NEW_LINE board = [ list ( map ( int , list ( input ( ) ) ) ) for _ in range ( N ) ] NEW_LINE ans = solve ( N , M , board ) NEW_LINE for a in ans : NEW_LINE INDENT print ( * a , sep = " " ) NEW_LINE DEDENT DEDENT

from itertools import product NEW_LINE N , M = map ( int , input ( ) . split ( ) ) NEW_LINE b = [ [ int ( x ) for x in list ( input ( ) ) ] for _ in range ( N ) ] NEW_LINE d = [ 0 , 1 , 0 , - 1 , 0 ] NEW_LINE a = [ [ '0' ] * M for _ in range ( N ) ] NEW_LINE for i , j in product ( range ( N ) [ 1 : - 1 ] , range ( M ) [ 1 : - 1 ] ) : NEW_LINE INDENT m = 10 NEW_LINE for dx , dy in zip ( d [ : - 1 ] , d [ 1 : ] ) : NEW_LINE INDENT x = i + dx NEW_LINE y = j + dy NEW_LINE m = min ( m , b [ x ] [ y ] ) NEW_LINE DEDENT for dx , dy in zip ( d [ : - 1 ] , d [ 1 : ] ) : NEW_LINE INDENT x = i + dx NEW_LINE y = j + dy NEW_LINE b [ x ] [ y ] -= m NEW_LINE DEDENT a [ i ] [ j ] = str ( m ) NEW_LINE DEDENT for x in a : NEW_LINE INDENT print ( ' ' . join ( x ) ) NEW_LINE DEDENT

def b_amoeba ( N , M , Board ) : NEW_LINE INDENT ans_board = [ [ 0 ] * M for _ in [ None ] * N ] NEW_LINE for row in range ( 1 , N - 1 ) : NEW_LINE INDENT for col in range ( 1 , M - 1 ) : NEW_LINE INDENT v = min ( Board [ row - 1 ] [ col ] , Board [ row ] [ col + 1 ] , Board [ row + 1 ] [ col ] , Board [ row ] [ col - 1 ] ) NEW_LINE ans_board [ row ] [ col ] = v NEW_LINE Board [ row - 1 ] [ col ] -= v NEW_LINE Board [ row ] [ col + 1 ] -= v NEW_LINE Board [ row + 1 ] [ col ] -= v NEW_LINE Board [ row ] [ col - 1 ] -= v NEW_LINE DEDENT DEDENT ans = ' \n ' . join ( ' ' . join ( map ( str , row ) ) for row in ans_board ) NEW_LINE return ans NEW_LINE DEDENT N , M = [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE Board = [ [ int ( i ) for i in input ( ) ] for j in range ( N ) ] NEW_LINE print ( b_amoeba ( N , M , Board ) ) NEW_LINE

n , m = ( int ( i ) for i in input ( ) . split ( ) ) NEW_LINE x = [ ] NEW_LINE for _ in range ( n ) : NEW_LINE INDENT b , c = input ( ) , [ ] NEW_LINE for i in b : c . append ( int ( i ) ) NEW_LINE x . append ( c ) NEW_LINE DEDENT ans = [ [ 0 for i in range ( m ) ] for i in range ( n ) ] NEW_LINE for i in range ( n ) : NEW_LINE INDENT for j in range ( m ) : NEW_LINE INDENT if x [ i ] [ j ] == 0 : continue NEW_LINE ans [ i + 1 ] [ j ] = x [ i ] [ j ] NEW_LINE for k , k2 in [ [ i + 1 , j - 1 ] , [ i + 1 , j + 1 ] , [ i + 2 , j ] , [ i , j ] ] : x [ k ] [ k2 ] -= x [ i ] [ j ] NEW_LINE DEDENT DEDENT for i in ans : NEW_LINE INDENT s = " " NEW_LINE for j in i : s += str ( j ) NEW_LINE print ( s ) NEW_LINE DEDENT