import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = Integer . parseInt ( sc . next ( ) ) ; int b = Integer . parseInt ( sc . next ( ) ) ; if ( ( a * b ) % 2 == 0 ) { System . out . println ( " Even " ) ; } else { System . out . println ( " Odd " ) ; } sc . close ( ) ; } }


a , b = list ( map ( int , ( input ( ) . split ( ) ) ) ) NEW_LINE print ( " Even " ) if ( a * b ) % 2 == 0 else print ( " Odd " ) NEW_LINE


work = input ( ) . split ( " ▁ " ) NEW_LINE a = work [ 0 ] NEW_LINE b = work [ 1 ] NEW_LINE c = int ( a ) * int ( b ) NEW_LINE if ( c % 2 == 0 ) : NEW_LINE INDENT print ( " Even " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " Odd " ) NEW_LINE DEDENT


def matmul ( a , b ) : NEW_LINE INDENT c = a * b NEW_LINE return c NEW_LINE DEDENT a , b = map ( int , input ( ) . split ( ) ) NEW_LINE c = matmul ( a , b ) NEW_LINE if c % 2 == 0 : NEW_LINE INDENT print ( " Even " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " Odd " ) NEW_LINE DEDENT


a , b = [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE ans = a * b NEW_LINE if ans % 2 == 0 : NEW_LINE INDENT print ( ' Even ' ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( ' Odd ' ) NEW_LINE DEDENT


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int R = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int D = sc . nextInt ( ) ; int a [ ] [ ] = new int [ R ] [ C ] ; for ( int i = 0 ; i < R ; i ++ ) { for ( int j = 0 ; j < C ; j ++ ) { a [ i ] [ j ] = sc . nextInt ( ) ; } } int max = 0 ; for ( int i = 0 ; i < R ; i ++ ) { for ( int j = 0 ; j < C ; j ++ ) { if ( ( i + j ) <= D && ( i + j ) % 2 == D % 2 ) { max = Math . max ( max , a [ i ] [ j ] ) ; } } } System . out . println ( max ) ; } }

H , W , T = map ( int , input ( ) . split ( ) ) NEW_LINE A = [ list ( map ( int , input ( ) . split ( ) ) ) for i in range ( H ) ] NEW_LINE ans = 0 NEW_LINE for i in range ( H ) : NEW_LINE INDENT for j in range ( W ) : NEW_LINE INDENT if ( i + j ) % 2 == T % 2 and ( i + j ) <= T : NEW_LINE INDENT ans = max ( ans , A [ i ] [ j ] ) NEW_LINE DEDENT DEDENT DEDENT print ( ans ) NEW_LINE


def inpl ( ) : return list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE ans = 0 NEW_LINE R , C , D = inpl ( ) NEW_LINE for i in range ( min ( R , D + 1 ) ) : NEW_LINE INDENT I = inpl ( ) [ ( D + i ) % 2 : D - i + 1 : 2 ] NEW_LINE ans = max ( ans , max ( I + [ 0 ] ) ) NEW_LINE DEDENT print ( ans ) NEW_LINE


r , c , d = map ( int , input ( ) . split ( ) ) NEW_LINE li = [ ] NEW_LINE if d % 2 == 0 : NEW_LINE INDENT for i in range ( r ) : NEW_LINE INDENT if i % 2 == 0 : NEW_LINE INDENT a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE a = a [ : min ( c , max ( 0 , d + 1 - i ) ) : 2 ] NEW_LINE DEDENT else : NEW_LINE INDENT a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE a = a [ 1 : min ( c , max ( 0 , d + 1 - i ) ) : 2 ] NEW_LINE DEDENT if len ( a ) > 0 : NEW_LINE INDENT li += a NEW_LINE DEDENT DEDENT DEDENT else : NEW_LINE INDENT for i in range ( r ) : NEW_LINE INDENT if i % 2 == 0 : NEW_LINE INDENT a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE a = a [ 1 : min ( c , max ( 0 , d + 1 - i ) ) : 2 ] NEW_LINE DEDENT else : NEW_LINE INDENT a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE a = a [ : min ( c , max ( 0 , d + 1 - i ) ) : 2 ] NEW_LINE DEDENT if len ( a ) > 0 : NEW_LINE INDENT li += a NEW_LINE DEDENT DEDENT DEDENT print ( max ( li ) ) NEW_LINE


import sys NEW_LINE sys . setrecursionlimit ( 10 ** 9 ) NEW_LINE R , C , D = map ( int , input ( ) . split ( ) ) NEW_LINE even = ( D % 2 == 0 ) NEW_LINE ans = 0 NEW_LINE for i in range ( R ) : NEW_LINE INDENT l = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE for j , c in enumerate ( l ) : NEW_LINE INDENT if i + j <= D : NEW_LINE INDENT if even : NEW_LINE INDENT if ( i + j ) % 2 == 0 : NEW_LINE INDENT ans = max ( ans , l [ j ] ) NEW_LINE DEDENT DEDENT else : NEW_LINE INDENT if ( i + j ) % 2 == 1 : NEW_LINE INDENT ans = max ( ans , l [ j ] ) NEW_LINE DEDENT DEDENT DEDENT else : NEW_LINE INDENT break NEW_LINE DEDENT DEDENT DEDENT print ( ans ) NEW_LINE


import sys NEW_LINE H , W , D = map ( int , input ( ) . split ( ) ) NEW_LINE a = [ list ( map ( int , l . split ( ) ) ) for l in sys . stdin ] NEW_LINE ans = max ( max ( row [ to_x % 2 : to_x + 1 : 2 ] ) for to_x , row in zip ( range ( D , - 1 , - 1 ) , a [ : D + 1 ] ) ) NEW_LINE print ( ans ) NEW_LINE


import java . util . * ; class Main { public static void main ( String [ ] $ ) { Scanner s = new Scanner ( System . in ) ; int h = s . nextInt ( ) , w = s . nextInt ( ) , d = s . nextInt ( ) , r = 0 ; for ( int i = 0 ; i < h ; ++ i ) for ( int j = 0 ; j < w ; ++ j ) r = Math . max ( r , s . nextInt ( ) * ( ( i + j <= d && ( d - i - j ) % 2 == 0 ) ? 1 : 0 ) ) ; System . out . println ( r ) ; } }


import java . awt . * ; import java . util . * ; public class Main { private static int R ; private static int C ; private static int D ; private static int table [ ] [ ] ; private static boolean flag = true ; private static ArrayList < Integer > even = new ArrayList < > ( ) ; private static ArrayList < Integer > odd = new ArrayList < > ( ) ; public static void input ( ) { Scanner scan = new Scanner ( System . in ) ; R = scan . nextInt ( ) ; C = scan . nextInt ( ) ; D = scan . nextInt ( ) ; table = new int [ R ] [ C ] ; for ( int i = 0 ; i < R ; i ++ ) { for ( int j = 0 ; j < C ; j ++ ) { table [ i ] [ j ] = scan . nextInt ( ) ; } } } public static void main ( String args [ ] ) { input ( ) ; int max = 0 ; for ( int i = 0 ; i < R ; i ++ ) { for ( int j = 0 ; j < C ; j ++ ) { if ( ( i + j ) <= D && ( i + j ) % 2 == D % 2 ) { max = Math . max ( max , table [ i ] [ j ] ) ; } } } System . out . println ( max ) ; } }


import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] arr = br . readLine ( ) . split ( " ▁ " , 3 ) ; int r = Integer . parseInt ( arr [ 0 ] ) ; int c = Integer . parseInt ( arr [ 1 ] ) ; int d = Integer . parseInt ( arr [ 2 ] ) ; int [ ] [ ] field = new int [ r ] [ c ] ; for ( int i = 0 ; i < r ; i ++ ) { String [ ] line = br . readLine ( ) . split ( " ▁ " , c ) ; for ( int j = 0 ; j < c ; j ++ ) { field [ i ] [ j ] = Integer . parseInt ( line [ j ] ) ; } } int max = 0 ; for ( int i = 0 ; i < r ; i ++ ) { for ( int j = ( ( d - i ) % 2 == 0 ) ? 0 : 1 ; j < c && j <= d - i ; j += 2 ) { int x = field [ i ] [ j ] ; if ( max < x ) { max = x ; } } } System . out . println ( max ) ; } }


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 ) ; BX solver = new BX ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class BX { public void solve ( int testNumber , LightScanner in , PrintWriter out ) { int r = in . ints ( ) , c = in . ints ( ) , d = in . ints ( ) ; int ans = 0 ; for ( int i = 0 ; i < r ; i ++ ) { for ( int j = 0 ; j < c ; j ++ ) { int a = in . ints ( ) ; if ( ( i + j ) % 2 == d % 2 && ( i + j ) <= d ) { ans = Math . max ( ans , a ) ; } } } out . println ( ans ) ; } } 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 { static long mod = 1000000007 ; static long arrayCombi [ ] [ ] = new long [ 1000 ] [ 1000 ] ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int row = sc . nextInt ( ) ; int column = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; int desk = sc . nextInt ( ) ; int rack = sc . nextInt ( ) ; int sum = desk + rack ; long ans = 0 ; for ( int i = 0 ; i < 1 << 4 ; i ++ ) { int tmpX = x ; int tmpY = y ; if ( ( i & 1 << 0 ) != 0 ) { tmpX -- ; } if ( ( i & 1 << 1 ) != 0 ) { tmpX -- ; } if ( ( i & 1 << 2 ) != 0 ) { tmpY -- ; } if ( ( i & 1 << 3 ) != 0 ) { tmpY -- ; } if ( tmpX < 0 || tmpY < 0 ) { continue ; } ans = advMod ( ans + combi ( tmpX * tmpY , sum ) * ( Integer . bitCount ( i ) % 2 == 0 ? 1 : - 1 ) ) ; } ans = advMod ( ans * combi ( sum , desk ) ) ; ans = advMod ( ans * ( row - x + 1 ) * ( column - y + 1 ) ) ; System . out . println ( ( ans + mod ) % mod ) ; } public static long combi ( int n , int r ) { if ( n <= 0 || n < r ) { return 0 ; } r = Math . min ( n - r , r ) ; if ( r == 0 ) { return 1 ; } if ( arrayCombi [ n ] [ r ] > 0 ) { return arrayCombi [ n ] [ r ] ; } arrayCombi [ n ] [ r ] = advMod ( combi ( n - 1 , r - 1 ) + combi ( n - 1 , r ) ) ; return arrayCombi [ n ] [ r ] ; } public static long advMod ( long i ) { return i % mod + ( ( i % mod ) < 0 ? mod : 0 ) ; } }


class BigCombination ( object ) : NEW_LINE INDENT __slots__ = [ " mod " , " factorial " , " inverse " ] NEW_LINE def __init__ ( self , mod : int = 10 ** 9 + 7 , max_n : int = 10 ** 6 ) : NEW_LINE INDENT fac , inv = [ 1 ] , [ ] NEW_LINE fac_append , inv_append = fac . append , inv . append NEW_LINE for i in range ( 1 , max_n + 1 ) : NEW_LINE INDENT fac_append ( fac [ - 1 ] * i % mod ) NEW_LINE DEDENT inv_append ( pow ( fac [ - 1 ] , mod - 2 , mod ) ) NEW_LINE for i in range ( max_n , 0 , - 1 ) : NEW_LINE INDENT inv_append ( inv [ - 1 ] * i % mod ) NEW_LINE DEDENT self . mod , self . factorial , self . inverse = mod , fac , inv [ : : - 1 ] NEW_LINE DEDENT def get_combination ( self , n , r ) : NEW_LINE INDENT return self . factorial [ n ] * self . inverse [ r ] * self . inverse [ n - r ] % self . mod NEW_LINE DEDENT DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT from itertools import product NEW_LINE R , C = map ( int , input ( ) . split ( ) ) NEW_LINE X , Y = map ( int , input ( ) . split ( ) ) NEW_LINE D , L = map ( int , input ( ) . split ( ) ) NEW_LINE mod = 10 ** 9 + 7 NEW_LINE comb = BigCombination ( mod , X * Y ) NEW_LINE get_comb = comb . get_combination NEW_LINE square_comb = ( R - X + 1 ) * ( C - Y + 1 ) NEW_LINE ans = 0 NEW_LINE for a in product ( ( 0 , 1 ) , repeat = 4 ) : NEW_LINE INDENT x , y = ( X - sum ( a [ : 2 ] ) ) , ( Y - sum ( a [ 2 : ] ) ) NEW_LINE if min ( x , y ) <= 0 or D + L > x * y : NEW_LINE INDENT continue NEW_LINE DEDENT ans = ( ans + get_comb ( x * y , D + L ) * get_comb ( D + L , D ) * ( - 1 if a . count ( 1 ) % 2 == 1 else 1 ) ) % mod NEW_LINE DEDENT print ( ans * square_comb % mod ) NEW_LINE DEDENT


import math NEW_LINE R , C = map ( int , input ( ) . strip ( ) . split ( ) ) NEW_LINE X , Y = map ( int , input ( ) . strip ( ) . split ( ) ) NEW_LINE D , L = map ( int , input ( ) . strip ( ) . split ( ) ) NEW_LINE def ct_combi ( n , r ) : NEW_LINE INDENT if n < r : NEW_LINE INDENT x = 0 NEW_LINE DEDENT else : NEW_LINE INDENT x = math . factorial ( n ) // ( math . factorial ( n - r ) * math . factorial ( r ) ) NEW_LINE DEDENT return x NEW_LINE DEDENT a = R - X NEW_LINE b = C - Y NEW_LINE n_1 = 0 NEW_LINE if a and not b : NEW_LINE INDENT n_1 = a + 1 NEW_LINE DEDENT elif b and not a : NEW_LINE INDENT n_1 = b + 1 NEW_LINE DEDENT elif a and b : NEW_LINE INDENT for i in range ( a + 1 ) : NEW_LINE INDENT for j in range ( b + 1 ) : NEW_LINE INDENT n_1 += 1 NEW_LINE DEDENT DEDENT DEDENT else : NEW_LINE INDENT n_1 = 1 NEW_LINE DEDENT if X * Y != D + L : NEW_LINE INDENT sum_1 = 2 * ct_combi ( X * ( Y - 1 ) , D + L ) + 2 * ct_combi ( ( X - 1 ) * Y , D + L ) NEW_LINE sum_2 = ct_combi ( ( X - 2 ) * Y , D + L ) + ct_combi ( ( Y - 2 ) * X , D + L ) + 4 * ct_combi ( ( X - 1 ) * ( Y - 1 ) , D + L ) NEW_LINE sum_3 = 2 * ct_combi ( ( X - 1 ) * ( Y - 2 ) , D + L ) + 2 * ct_combi ( ( X - 2 ) * ( Y - 1 ) , D + L ) NEW_LINE sum_4 = ct_combi ( ( X - 2 ) * ( Y - 2 ) , D + L ) NEW_LINE sum = ct_combi ( X * Y , D + L ) - sum_1 + sum_2 - sum_3 + sum_4 NEW_LINE n_2 = sum * ct_combi ( D + L , D ) NEW_LINE DEDENT else : NEW_LINE INDENT n_2 = ct_combi ( D + L , D ) NEW_LINE DEDENT print ( n_1 * n_2 % ( 10 ** 9 + 7 ) ) NEW_LINE


from math import factorial as f NEW_LINE print ( sum ( f ( x * y ) // f ( x * y - D - L ) // f ( D + L ) * f ( D + L ) // f ( D ) // f ( L ) * ( R - X + 1 ) * ( C - Y + 1 ) * ( - 1 ) ** ( dx + dy % 2 ) for R , C , X , Y , D , L in [ ( int ( x ) for _ in [ 0 ] * 3 for x in input ( ) . split ( ) ) ] for x , dx in zip ( [ X , X - 1 , X - 1 , X - 2 ] , [ 0 , 1 , 1 , 2 ] ) for y , dy in zip ( [ Y , Y - 1 , Y - 1 , Y - 2 ] , [ 0 , 1 , 1 , 2 ] ) if min ( x , y ) > 0 and D + L <= ( x * y ) ) % ( 10 ** 9 + 7 ) ) NEW_LINE


from math import factorial as fact NEW_LINE from functools import lru_cache NEW_LINE div = int ( 1e9 + 7 ) NEW_LINE @ lru_cache ( maxsize = None ) NEW_LINE def iCj ( i , j ) : NEW_LINE INDENT if i < j : NEW_LINE INDENT return ( 0 ) NEW_LINE DEDENT return ( fact ( i ) // ( fact ( j ) * fact ( i - j ) ) ) NEW_LINE DEDENT numdl = lambda n , d , l : iCj ( n , d ) * iCj ( n - d , l ) NEW_LINE def inner ( x , y , d , l ) : NEW_LINE INDENT if x * y == d + l : NEW_LINE INDENT num = iCj ( x * y , d ) NEW_LINE DEDENT else : NEW_LINE INDENT num = numdl ( x * y , d , l ) NEW_LINE num -= numdl ( x * ( y - 1 ) , d , l ) * 2 NEW_LINE num -= numdl ( ( x - 1 ) * y , d , l ) * 2 NEW_LINE num += numdl ( x * ( y - 2 ) , d , l ) NEW_LINE num += numdl ( ( x - 2 ) * y , d , l ) NEW_LINE num += numdl ( ( x - 1 ) * ( y - 1 ) , d , l ) * 4 NEW_LINE num -= numdl ( ( x - 2 ) * ( y - 1 ) , d , l ) * 2 NEW_LINE num -= numdl ( ( x - 1 ) * ( y - 2 ) , d , l ) * 2 NEW_LINE num += numdl ( ( x - 2 ) * ( y - 2 ) , d , l ) NEW_LINE DEDENT return ( num ) NEW_LINE DEDENT r , c = map ( int , input ( ) . rstrip ( ) . split ( ) ) NEW_LINE x , y = map ( int , input ( ) . rstrip ( ) . split ( ) ) NEW_LINE d , l = map ( int , input ( ) . rstrip ( ) . split ( ) ) NEW_LINE area = ( r - x + 1 ) * ( c - y + 1 ) NEW_LINE print ( inner ( x , y , d , l ) * area % div ) NEW_LINE


import java . util . * ; import static java . lang . System . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int sx = sc . nextInt ( ) ; int sy = sc . nextInt ( ) ; int tx = sc . nextInt ( ) ; int ty = sc . nextInt ( ) ; int xd = tx - sx ; int yd = ty - sy ; for ( int y = 0 ; y < yd ; y ++ ) { out . print ( " U " ) ; } for ( int x = 0 ; x < xd ; x ++ ) { out . print ( " R " ) ; } for ( int y = 0 ; y < yd ; y ++ ) { out . print ( " D " ) ; } for ( int x = 0 ; x < xd ; x ++ ) { out . print ( " L " ) ; } out . print ( " L " ) ; for ( int y = 0 ; y < yd + 1 ; y ++ ) { out . print ( " U " ) ; } for ( int x = 0 ; x < xd + 1 ; x ++ ) { out . print ( " R " ) ; } out . print ( " D " ) ; out . print ( " R " ) ; for ( int y = 0 ; y < yd + 1 ; y ++ ) { out . print ( " D " ) ; } for ( int x = 0 ; x < xd + 1 ; x ++ ) { out . print ( " L " ) ; } out . print ( " U " ) ; out . println ( ) ; } }

sx , sy , tx , ty = map ( int , input ( ) . split ( ) ) NEW_LINE dx = tx - sx NEW_LINE dy = ty - sy NEW_LINE root1 = ' U ' * dy + ' R ' * dx NEW_LINE root2 = ' D ' * dy + ' L ' * dx NEW_LINE root3 = ' L ' + ' U ' * ( dy + 1 ) + ' R ' * ( dx + 1 ) + ' D ' NEW_LINE root4 = ' R ' + ' D ' * ( dy + 1 ) + ' L ' * ( dx + 1 ) + ' U ' NEW_LINE print ( root1 + root2 + root3 + root4 ) NEW_LINE


import sys NEW_LINE import collections 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 nsl = lambda : map ( str , sys . stdin . readline ( ) . split ( ) ) NEW_LINE sx , sy , tx , ty = nm ( ) NEW_LINE ans = ' ' NEW_LINE ans += ' L ' NEW_LINE ans += ' U ' * ( ty - sy + 1 ) NEW_LINE ans += ' R ' * ( tx - sx + 1 ) NEW_LINE ans += ' D ' NEW_LINE ans += ' L ' * ( tx - sx ) NEW_LINE ans += ' D ' * ( ty - sy ) NEW_LINE ans += ' D ' NEW_LINE ans += ' R ' * ( tx - sx + 1 ) NEW_LINE ans += ' U ' * ( ty - sy + 1 ) NEW_LINE ans += ' L ' NEW_LINE ans += ' D ' * ( ty - sy ) NEW_LINE ans += ' L ' * ( tx - sx ) NEW_LINE print ( ans ) NEW_LINE


sx , sy , tx , ty = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE ans = ' R ' NEW_LINE x = tx - sx NEW_LINE y = ty - sy NEW_LINE for _ in range ( x - 1 ) : NEW_LINE INDENT ans += ' R ' NEW_LINE DEDENT for _ in range ( y ) : NEW_LINE INDENT ans += ' U ' NEW_LINE DEDENT for _ in range ( x ) : NEW_LINE INDENT ans += ' L ' NEW_LINE DEDENT for _ in range ( y ) : NEW_LINE INDENT ans += ' D ' NEW_LINE DEDENT ans += ' LU ' NEW_LINE for _ in range ( y ) : NEW_LINE INDENT ans += ' U ' NEW_LINE DEDENT for _ in range ( x ) : NEW_LINE INDENT ans += ' R ' NEW_LINE DEDENT ans += ' RD ' NEW_LINE ans += ' RD ' NEW_LINE for _ in range ( y ) : NEW_LINE INDENT ans += ' D ' NEW_LINE DEDENT for _ in range ( x ) : NEW_LINE INDENT ans += ' L ' NEW_LINE DEDENT ans += ' LU ' NEW_LINE print ( ans ) NEW_LINE


from functools import reduce NEW_LINE def main ( ) : NEW_LINE INDENT sx , sy , tx , ty = ( int ( _ ) for _ in input ( ) . split ( ) ) NEW_LINE tx = tx - sx NEW_LINE ty = ty - sy NEW_LINE print ( ' R ' * tx + ' U ' * ty + ' L ' * tx + ' D ' * ty + ' L ' + ' U ' * ( ty + 1 ) + ' R ' * ( tx + 1 ) + ' D ' + ' R ' + ' D ' * ( ty + 1 ) + ' L ' * ( tx + 1 ) + ' U ' ) NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT main ( ) NEW_LINE DEDENT


lis = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE S = " " NEW_LINE x = lis [ 2 ] - lis [ 0 ] NEW_LINE y = lis [ 3 ] - lis [ 1 ] NEW_LINE S += " U " * y NEW_LINE S += " R " * x NEW_LINE S += " D " * y NEW_LINE S += " L " * ( x + 1 ) NEW_LINE S += " U " * ( y + 1 ) NEW_LINE S += " R " * ( x + 1 ) NEW_LINE S += " D " NEW_LINE S += " R " NEW_LINE S += " D " * ( y + 1 ) NEW_LINE S += " L " * ( x + 1 ) NEW_LINE S += " U " NEW_LINE print ( S ) NEW_LINE


public class Main { private static java . util . Scanner scanner = new java . util . Scanner ( System . in ) ; public static void main ( String [ ] args ) { int sx = scanner . nextInt ( ) , sy = scanner . nextInt ( ) , tx = scanner . nextInt ( ) , ty = scanner . nextInt ( ) , dx = tx - sx , dy = ty - sy ; for ( int i = 0 ; i < dy ; i ++ ) System . out . print ( ' U ' ) ; for ( int i = 0 ; i < dx ; i ++ ) System . out . print ( ' R ' ) ; for ( int i = 0 ; i < dy ; i ++ ) System . out . print ( ' D ' ) ; for ( int i = 0 ; i <= dx ; i ++ ) System . out . print ( ' L ' ) ; for ( int i = 0 ; i <= dy ; i ++ ) System . out . print ( ' U ' ) ; for ( int i = 0 ; i <= dx ; i ++ ) System . out . print ( ' R ' ) ; System . out . print ( " DR " ) ; for ( int i = 0 ; i <= dy ; i ++ ) System . out . print ( ' D ' ) ; for ( int i = 0 ; i <= dx ; i ++ ) System . out . print ( ' L ' ) ; System . out . print ( ' U ' ) ; } }


import java . util . LinkedList ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Main main = new Main ( ) ; Scanner sc = new Scanner ( System . in ) ; main . solve ( sc ) ; sc . close ( ) ; } void solve ( Scanner sc ) { int sx = sc . nextInt ( ) ; int sy = sc . nextInt ( ) ; int tx = sc . nextInt ( ) ; int ty = sc . nextInt ( ) ; StringBuilder sb = new StringBuilder ( ) ; for ( int k = 0 ; k < ty - sy ; k ++ ) { sb . append ( " U " ) ; } for ( int k = 0 ; k < tx - sx ; k ++ ) { sb . append ( " R " ) ; } for ( int k = 0 ; k < ty - sy ; k ++ ) { sb . append ( " D " ) ; } for ( int k = 0 ; k < tx - sx ; k ++ ) { sb . append ( " L " ) ; } sx -- ; sb . append ( " L " ) ; for ( int k = 0 ; k < ty + 1 - sy ; k ++ ) { sb . append ( " U " ) ; } for ( int k = 0 ; k < tx - sx ; k ++ ) { sb . append ( " R " ) ; } sb . append ( " D " ) ; sb . append ( " R " ) ; for ( int k = 0 ; k < ty + 1 - sy ; k ++ ) { sb . append ( " D " ) ; } for ( int k = 0 ; k < tx - sx ; k ++ ) { sb . append ( " L " ) ; } sb . append ( " U " ) ; System . out . println ( sb ) ; } }


import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int sx = sc . nextInt ( ) ; int sy = sc . nextInt ( ) ; int tx = sc . nextInt ( ) ; int ty = sc . nextInt ( ) ; int gapx = tx - sx ; int gapy = ty - sy ; ArrayList < Character > list = new ArrayList < Character > ( ) ; for ( int i = 0 ; i < gapy ; i ++ ) { list . add ( ' U ' ) ; } for ( int i = 0 ; i < gapx ; i ++ ) { list . add ( ' R ' ) ; } for ( int i = 0 ; i < gapy ; i ++ ) { list . add ( ' D ' ) ; } for ( int i = 0 ; i < gapx ; i ++ ) { list . add ( ' L ' ) ; } list . add ( ' L ' ) ; for ( int i = 0 ; i < gapy + 1 ; i ++ ) { list . add ( ' U ' ) ; } for ( int i = 0 ; i < gapx + 1 ; i ++ ) { list . add ( ' R ' ) ; } list . add ( ' D ' ) ; list . add ( ' R ' ) ; for ( int i = 0 ; i < gapy + 1 ; i ++ ) { list . add ( ' D ' ) ; } for ( int i = 0 ; i < gapx + 1 ; i ++ ) { list . add ( ' L ' ) ; } list . add ( ' U ' ) ; for ( Character route : list ) { System . out . print ( route ) ; } } }


import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int sx = scanner . nextInt ( ) ; int sy = scanner . nextInt ( ) ; int tx = scanner . nextInt ( ) ; int ty = scanner . nextInt ( ) ; int x = ( ( tx - sx ) >> 31 ) | 1 ; int y = ( ( ty - sy ) >> 31 ) | 1 ; int nx = ( tx - sx ) * x ; int ny = ( ty - sy ) * y ; StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < ny ; i ++ ) sb . append ( y > 0 ? ' U ' : ' D ' ) ; y *= - 1 ; for ( int i = 0 ; i < nx + 1 ; i ++ ) sb . append ( x > 0 ? ' R ' : ' L ' ) ; x *= - 1 ; for ( int i = 0 ; i < ny + 1 ; i ++ ) sb . append ( y > 0 ? ' U ' : ' D ' ) ; y *= - 1 ; for ( int i = 0 ; i < nx + 1 ; i ++ ) sb . append ( x > 0 ? ' R ' : ' L ' ) ; sb . append ( y > 0 ? ' U ' : ' D ' ) ; sb . append ( x > 0 ? ' R ' : ' L ' ) ; x *= - 1 ; for ( int i = 0 ; i < ny + 1 ; i ++ ) sb . append ( y > 0 ? ' U ' : ' D ' ) ; y *= - 1 ; for ( int i = 0 ; i < nx + 1 ; i ++ ) sb . append ( x > 0 ? ' R ' : ' L ' ) ; x *= - 1 ; for ( int i = 0 ; i < ny + 1 ; i ++ ) sb . append ( y > 0 ? ' U ' : ' D ' ) ; for ( int i = 0 ; i < nx ; i ++ ) sb . append ( x > 0 ? ' R ' : ' L ' ) ; System . out . println ( sb . toString ( ) ) ; } }


import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner keyboard = new Scanner ( System . in ) ; String s = keyboard . next ( ) ; String [ ] command = new String [ s . length ( ) ] ; String [ ] result = new String [ s . length ( ) ] ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { command [ i ] = s . substring ( i , i + 1 ) ; } int jj = 0 ; int count = 1 ; for ( int j = s . length ( ) - 1 ; j >= 0 ; j -- ) { if ( command [ j ] . equals ( " B " ) ) { while ( j != 0 && command [ j - 1 ] . equals ( " B " ) ) { count ++ ; j -- ; } j -= count ; } else { result [ jj ] = command [ j ] ; jj ++ ; } } for ( int k = jj - 1 ; k >= 0 ; k -- ) { System . out . print ( result [ k ] ) ; } keyboard . close ( ) ; } }

s = list ( input ( ) ) NEW_LINE ans = " " NEW_LINE for i in range ( 0 , len ( s ) , 1 ) : NEW_LINE INDENT if s [ i ] == "1" or s [ i ] == "0" : NEW_LINE INDENT ans = ans + s [ i ] NEW_LINE DEDENT else : NEW_LINE INDENT ans = ans [ : - 1 ] NEW_LINE DEDENT DEDENT print ( ans ) NEW_LINE


answer = [ ] NEW_LINE for letter in input ( ) : NEW_LINE INDENT if letter == "1" : NEW_LINE INDENT answer . append ( "1" ) NEW_LINE DEDENT elif letter == "0" : NEW_LINE INDENT answer . append ( "0" ) NEW_LINE DEDENT elif letter == " B " and len ( answer ) > 0 : NEW_LINE INDENT answer . pop ( ) NEW_LINE DEDENT DEDENT print ( " " . join ( answer ) ) NEW_LINE


S = input ( ) NEW_LINE new_S = str ( ) NEW_LINE for ii in list ( S ) : NEW_LINE INDENT if ii == ' B ' : NEW_LINE INDENT new_S = new_S [ : - 1 ] NEW_LINE DEDENT else : NEW_LINE INDENT new_S += ii NEW_LINE DEDENT DEDENT print ( new_S ) NEW_LINE


def unhappy_hacking ( s : str ) -> str : NEW_LINE INDENT display = ' ' NEW_LINE for key in s : NEW_LINE INDENT if key == '0' : NEW_LINE INDENT display += '0' NEW_LINE DEDENT elif key == '1' : NEW_LINE INDENT display += '1' NEW_LINE DEDENT else : NEW_LINE INDENT display = display [ : - 1 ] NEW_LINE DEDENT DEDENT return display NEW_LINE DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT s = input ( ) NEW_LINE ans = unhappy_hacking ( s ) NEW_LINE print ( ans ) NEW_LINE DEDENT


s = input ( ) NEW_LINE s = list ( s ) NEW_LINE l = [ ] NEW_LINE ls = len ( s ) NEW_LINE for i in range ( ls ) : NEW_LINE INDENT if s [ i ] == '1' : NEW_LINE INDENT l . append ( 1 ) NEW_LINE DEDENT elif s [ i ] == '0' : NEW_LINE INDENT l . append ( 0 ) NEW_LINE DEDENT else : NEW_LINE INDENT if len ( l ) == 0 : NEW_LINE INDENT l = l NEW_LINE DEDENT else : NEW_LINE INDENT l . pop ( ) NEW_LINE DEDENT DEDENT DEDENT ans = " " NEW_LINE for i in range ( len ( l ) ) : NEW_LINE INDENT ans = ans + str ( l [ i ] ) NEW_LINE DEDENT print ( ans ) NEW_LINE


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 ) ; TaskB solver = new TaskB ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskB { public void solve ( int testNumber , FastScanner in , PrintWriter out ) { StringBuilder sb = new StringBuilder ( ) ; for ( char cc : in . next ( ) . toCharArray ( ) ) { switch ( cc ) { case '0' : sb . append ( '0' ) ; break ; case '1' : sb . append ( '1' ) ; break ; case ' B ' : if ( sb . length ( ) > 0 ) sb . deleteCharAt ( sb . length ( ) - 1 ) ; break ; } } out . println ( sb ) ; } } 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 ; this . bufPointer = 0 ; this . bufLength = 0 ; } 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 isPrintableChar ( int c ) { return c >= 33 && c <= 126 ; } public String next ( ) { StringBuilder sb = new StringBuilder ( ) ; int b = readByte ( ) ; while ( ! isPrintableChar ( b ) ) b = readByte ( ) ; while ( isPrintableChar ( b ) ) { sb . appendCodePoint ( b ) ; b = readByte ( ) ; } return sb . toString ( ) ; } } }


import java . util . * ; import java . lang . * ; import java . math . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String w = sc . next ( ) ; List l = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < w . length ( ) ; i ++ ) { if ( w . charAt ( i ) == ' B ' ) { if ( l . size ( ) > 0 ) { l . remove ( l . size ( ) - 1 ) ; } } else { l . add ( w . charAt ( i ) ) ; } } for ( int i = 0 ; i < l . size ( ) ; i ++ ) { System . out . print ( l . get ( i ) ) ; } System . out . println ( " " ) ; sc . close ( ) ; } } Note : . / Main . java uses unchecked or unsafe operations . Note : Recompile with - Xlint : unchecked for details .


import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { MyScanner sc = new MyScanner ( ) ; String s = sc . next ( ) ; StringBuffer buf = new StringBuffer ( ) ; int l = s . length ( ) ; for ( int i = 0 ; i < l ; i ++ ) { switch ( s . charAt ( i ) ) { case ( '1' ) : buf . append ( "1" ) ; break ; case ( '0' ) : buf . append ( "0" ) ; break ; case ( ' B ' ) : int a = buf . length ( ) ; if ( a != 0 ) { buf . deleteCharAt ( a - 1 ) ; } break ; } } String ans = buf . toString ( ) ; System . out . println ( ans ) ; } public static PrintWriter out ; public static class MyScanner { BufferedReader br ; StringTokenizer st ; public MyScanner ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } }


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String line = scanner . nextLine ( ) ; Stack < Character > items = new Stack < > ( ) ; for ( char letter : line . toCharArray ( ) ) { if ( Character . isDigit ( letter ) ) { items . push ( letter ) ; } else if ( letter == ' B ' && ! items . isEmpty ( ) ) { items . pop ( ) ; } } StringBuilder builder = new StringBuilder ( ) ; for ( char letter : items ) { builder . append ( letter ) ; } System . out . println ( builder ) ; } }


import java . util . * ; import static java . lang . System . * ; public class Main { static final int [ ] dx = new int [ ] { 1 , 0 , - 1 , 0 } ; static final int [ ] dy = new int [ ] { 0 , 1 , 0 , - 1 } ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int H = sc . nextInt ( ) ; int W = sc . nextInt ( ) ; boolean [ ] [ ] s = new boolean [ H ] [ W ] ; for ( int i = 0 ; i < H ; i ++ ) { String str = sc . next ( ) ; for ( int j = 0 ; j < W ; j ++ ) { s [ i ] [ j ] = str . charAt ( j ) == ' # ' ? true : false ; } } boolean isOk = true ; loop : for ( int i = 0 ; i < H ; i ++ ) { for ( int j = 0 ; j < W ; j ++ ) { if ( s [ i ] [ j ] ) { boolean tmpIsOk = false ; for ( int k = 0 ; k < 4 ; k ++ ) { int ni = i + dx [ k ] ; int nj = j + dy [ k ] ; if ( ni >= 0 && ni < H && nj >= 0 && nj < W && s [ ni ] [ nj ] ) { tmpIsOk = true ; } } if ( ! tmpIsOk ) { isOk = false ; break loop ; } } } } if ( isOk ) { out . println ( " Yes " ) ; } else { out . println ( " No " ) ; } } }

H , W = ( int ( x ) for x in input ( ) . split ( ) ) NEW_LINE s = [ ] NEW_LINE for i in range ( H ) : NEW_LINE INDENT s += [ [ ' . ' ] + list ( input ( ) ) + [ ' . ' ] ] NEW_LINE DEDENT s = [ [ ' . ' for i in range ( W + 2 ) ] ] + s + [ [ ' . ' for i in range ( W + 2 ) ] ] NEW_LINE around = [ [ - 1 , 0 ] , [ 0 , - 1 ] , [ 0 , 1 ] , [ 1 , 0 ] ] NEW_LINE clear = True NEW_LINE for i in range ( 1 , H + 1 ) : NEW_LINE INDENT for j in range ( 1 , W + 1 ) : NEW_LINE INDENT if s [ i ] [ j ] == ' # ' : NEW_LINE INDENT if all ( ( s [ i + k [ 0 ] ] [ j + k [ 1 ] ] == ' . ' for k in around ) ) : NEW_LINE INDENT clear = False NEW_LINE break NEW_LINE DEDENT DEDENT DEDENT else : NEW_LINE INDENT continue NEW_LINE DEDENT break NEW_LINE DEDENT if clear : NEW_LINE INDENT print ( ' Yes ' ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( ' No ' ) NEW_LINE DEDENT


def main ( ) : NEW_LINE INDENT input = sys . stdin . readline NEW_LINE try : NEW_LINE INDENT H , W = map ( int , input ( ) . split ( ) ) NEW_LINE s = [ list ( input ( ) ) for _ in range ( H ) ] NEW_LINE dir4 = ( ( 0 , 1 ) , ( 0 , - 1 ) , ( 1 , 0 ) , ( - 1 , 0 ) ) NEW_LINE for i in range ( H ) : NEW_LINE INDENT for j in range ( W ) : NEW_LINE INDENT if s [ i ] [ j ] == " . " : continue NEW_LINE cnt = 0 NEW_LINE for d in dir4 : NEW_LINE INDENT nx = i + d [ 0 ] NEW_LINE ny = j + d [ 1 ] NEW_LINE if not ( 0 <= nx < H ) : continue NEW_LINE if not ( 0 <= ny < W ) : continue NEW_LINE if s [ nx ] [ ny ] == " # " : cnt += 1 NEW_LINE DEDENT if cnt == 0 : NEW_LINE INDENT print ( " No " ) NEW_LINE exit ( ) NEW_LINE DEDENT DEDENT DEDENT print ( " Yes " ) NEW_LINE DEDENT finally : NEW_LINE INDENT input = None NEW_LINE DEDENT DEDENT import sys ; sys . setrecursionlimit ( 50000 ) NEW_LINE if __name__ == " _ _ main _ _ " : NEW_LINE INDENT main ( ) NEW_LINE DEDENT


def count ( i , j ) : NEW_LINE INDENT count = 0 NEW_LINE if list [ i ] [ j - 1 ] == ' # ' : NEW_LINE INDENT count += 1 NEW_LINE DEDENT if list [ i ] [ j + 1 ] == ' # ' : NEW_LINE INDENT count += 1 NEW_LINE DEDENT if list [ i - 1 ] [ j ] == ' # ' : NEW_LINE INDENT count += 1 NEW_LINE DEDENT if list [ i + 1 ] [ j ] == ' # ' : NEW_LINE INDENT count += 1 NEW_LINE DEDENT if count >= 1 : NEW_LINE INDENT return True NEW_LINE DEDENT else : NEW_LINE INDENT return False NEW_LINE DEDENT DEDENT h , w = map ( int , input ( ) . split ( ) ) NEW_LINE s_init = '0' * ( w + 2 ) NEW_LINE flag = True NEW_LINE list = [ ] NEW_LINE list . append ( s_init ) NEW_LINE for i in range ( h ) : NEW_LINE INDENT s = str ( input ( ) ) NEW_LINE list . append ( '0' + s + '0' ) NEW_LINE DEDENT list . append ( s_init ) NEW_LINE for i in range ( 1 , h + 1 ) : NEW_LINE INDENT for j in range ( 1 , w + 1 ) : NEW_LINE INDENT if list [ i ] [ j ] == ' # ' : NEW_LINE INDENT if not ( count ( i , j ) ) : NEW_LINE INDENT flag = False NEW_LINE DEDENT DEDENT DEDENT DEDENT if flag : NEW_LINE INDENT print ( ' Yes ' ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( ' No ' ) NEW_LINE DEDENT


h , w = map ( int , input ( ) . split ( ) ) NEW_LINE glid = [ 0 ] * ( h + 2 ) NEW_LINE h_index = [ - 1 , 0 , 0 , 1 ] NEW_LINE w_index = [ 0 , - 1 , 1 , 0 ] NEW_LINE glid [ 0 ] = [ " . " ] * ( w + 2 ) NEW_LINE glid [ h + 1 ] = [ " . " ] * ( w + 2 ) NEW_LINE for i in range ( h ) : NEW_LINE INDENT temp1 = [ " . " ] NEW_LINE temp2 = list ( input ( ) ) NEW_LINE temp1 . extend ( temp2 ) NEW_LINE temp1 . append ( " . " ) NEW_LINE glid [ i + 1 ] = temp1 NEW_LINE DEDENT cnt = 0 NEW_LINE for j in range ( h ) : NEW_LINE INDENT for k in range ( w ) : NEW_LINE INDENT if glid [ j + 1 ] [ k + 1 ] == " # " and glid [ j ] [ k + 1 ] == " . " and glid [ j + 2 ] [ k + 1 ] == " . " and glid [ j + 1 ] [ k ] == " . " and glid [ j + 1 ] [ k + 2 ] == " . " : NEW_LINE INDENT cnt += 1 NEW_LINE DEDENT DEDENT DEDENT if cnt > 0 : NEW_LINE INDENT print ( " No " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " Yes " ) NEW_LINE DEDENT


H , W = map ( int , input ( ) . split ( ) ) NEW_LINE S = [ ] NEW_LINE S . append ( list ( ' @ ' * ( W + 2 ) ) ) NEW_LINE for i in range ( H ) : NEW_LINE INDENT s = list ( input ( ) ) NEW_LINE s . insert ( 0 , ' @ ' ) NEW_LINE s . append ( ' @ ' ) NEW_LINE S . append ( s ) NEW_LINE DEDENT S . append ( list ( ' @ ' * ( W + 2 ) ) ) NEW_LINE judge = 1 NEW_LINE count = 0 NEW_LINE vy = [ 0 , 0 , 1 , - 1 ] NEW_LINE vx = [ 1 , - 1 , 0 , 0 ] NEW_LINE for i in range ( H + 2 ) : NEW_LINE INDENT if ( count == 4 ) : break NEW_LINE if ( ( i != 0 ) and ( i != H + 1 ) ) : NEW_LINE INDENT for j in range ( W + 2 ) : NEW_LINE INDENT if ( count == 4 ) : break NEW_LINE if ( ( j != 0 ) and ( j != W + 1 ) ) : NEW_LINE INDENT if ( S [ i ] [ j ] == ' # ' ) : NEW_LINE INDENT count = 0 NEW_LINE for k in range ( 4 ) : NEW_LINE INDENT if ( S [ i + vy [ k ] ] [ j + vx [ k ] ] == ' # ' ) : break NEW_LINE count += 1 NEW_LINE DEDENT if ( count == 4 ) : NEW_LINE INDENT judge = 0 NEW_LINE break NEW_LINE DEDENT DEDENT DEDENT DEDENT DEDENT DEDENT if ( judge == 1 ) : NEW_LINE INDENT print ( ' Yes ' ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( ' No ' ) NEW_LINE DEDENT


import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int H = sc . nextInt ( ) ; int W = sc . nextInt ( ) ; sc . nextLine ( ) ; String [ ] [ ] S = new String [ H ] [ W ] ; final int height = H ; final int width = W ; int [ ] [ ] number = new int [ H ] [ W ] ; String [ ] tmp = new String [ H ] ; for ( int i = 0 ; i < H ; i ++ ) { tmp [ i ] = sc . nextLine ( ) ; } for ( int i = 0 ; i < H ; i ++ ) { String [ ] str = tmp [ i ] . split ( " " ) ; for ( int j = 0 ; j < W ; j ++ ) { S [ i ] [ j ] = str [ j ] ; } } for ( int i = 0 ; i < H ; i ++ ) { for ( int j = 0 ; j < W ; j ++ ) { if ( S [ i ] [ j ] . equals ( " # " ) ) { if ( countMine ( i , j , height , width , S ) == true ) { continue ; } else { System . out . println ( " No " ) ; System . exit ( 0 ) ; } } } } System . out . println ( " Yes " ) ; sc . close ( ) ; } public static boolean countMine ( int i , int j , int height , int width , String [ ] [ ] S ) { boolean result = false ; if ( i - 1 >= 0 && S [ i - 1 ] [ j ] . equals ( " # " ) ) { result = true ; } else if ( i + 1 < height && S [ i + 1 ] [ j ] . equals ( " # " ) ) { result = true ; } else if ( j + 1 < width && S [ i ] [ j + 1 ] . equals ( " # " ) ) { result = true ; } else if ( j - 1 >= 0 && S [ i ] [ j - 1 ] . equals ( " # " ) ) { result = true ; } else { } return result ; } }


import java . util . Scanner ; public class Main { private static String [ ] [ ] s ; private static boolean hasNeighbor ( int h , int w ) { return ( h != 0 && " # " . equals ( s [ h - 1 ] [ w ] ) ) || ( h != s . length - 1 && " # " . equals ( s [ h + 1 ] [ w ] ) ) || ( w != 0 && " # " . equals ( s [ h ] [ w - 1 ] ) ) || ( w != s [ h ] . length - 1 && " # " . equals ( s [ h ] [ w + 1 ] ) ) ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int h = sc . nextInt ( ) ; int w = sc . nextInt ( ) ; s = new String [ h ] [ w ] ; for ( int i = 0 ; i < h ; i ++ ) { s [ i ] = sc . next ( ) . split ( " " ) ; } for ( int i = 0 ; i < h ; i ++ ) { for ( int j = 0 ; j < w ; j ++ ) { if ( " . " . equals ( s [ i ] [ j ] ) ) { continue ; } if ( ! hasNeighbor ( i , j ) ) { System . out . println ( " No " ) ; return ; } } } System . out . println ( " Yes " ) ; } }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) { int h = 0 ; int w = 0 ; char [ ] [ ] square = null ; String [ ] tmp = null ; try ( BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { tmp = br . readLine ( ) . split ( " \\ s " ) ; h = Integer . parseInt ( tmp [ 0 ] ) ; w = Integer . parseInt ( tmp [ 1 ] ) ; square = new char [ h ] [ w ] ; for ( int i = 0 ; i < h ; i ++ ) { square [ i ] = br . readLine ( ) . toCharArray ( ) ; } } catch ( IOException e ) { e . printStackTrace ( ) ; System . exit ( 1 ) ; } boolean result = true ; parentLoop : for ( int i = 0 ; i < square . length ; i ++ ) { final char [ ] line = square [ i ] ; for ( int j = 0 ; j < line . length ; j ++ ) { if ( line [ j ] == ' # ' ) { if ( 0 <= i - 1 && square [ i - 1 ] [ j ] != ' # ' ) { if ( i + 1 < h && square [ i + 1 ] [ j ] != ' # ' ) { if ( 0 <= j - 1 && square [ i ] [ j - 1 ] != ' # ' ) { if ( j + 1 < w && square [ i ] [ j + 1 ] != ' # ' ) { result = false ; break parentLoop ; } } } } } } } if ( result ) { System . out . print ( " Yes " ) ; } else { System . out . print ( " No " ) ; } } }


import java . util . Scanner ; public class Main { static char [ ] [ ] cv ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int h = sc . nextInt ( ) ; int w = sc . nextInt ( ) ; sc . nextLine ( ) ; cv = new char [ h ] [ w ] ; for ( int i = 0 ; i < h ; i ++ ) { String str = sc . nextLine ( ) ; for ( int j = 0 ; j < w ; j ++ ) { cv [ i ] [ j ] = str . charAt ( j ) ; } } boolean flg = true ; boolean up , down , left , right ; for ( int i = 0 ; i < h && flg ; i ++ ) { for ( int j = 0 ; j < w && flg ; j ++ ) { if ( isBlack ( i , j ) ) { up = isBlack ( i - 1 , j ) ; down = isBlack ( i + 1 , j ) ; left = isBlack ( i , j - 1 ) ; right = isBlack ( i , j + 1 ) ; if ( ! ( up || down || left || right ) ) { flg = false ; } } } } if ( flg ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } static boolean isBlack ( int y , int x ) { try { if ( cv [ y ] [ x ] == ' # ' ) { return true ; } else { return false ; } } catch ( ArrayIndexOutOfBoundsException e ) { return false ; } } }


import java . text . ParseException ; import java . text . SimpleDateFormat ; import java . util . Date ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String [ ] data = sc . nextLine ( ) . split ( " ▁ " ) ; int N = Integer . parseInt ( data [ 0 ] ) ; int M = Integer . parseInt ( data [ 1 ] ) ; int [ ] food = new int [ M ] ; for ( int i = 0 ; i < M ; i ++ ) { food [ i ] = 0 ; } for ( int i = 0 ; i < N ; i ++ ) { data = sc . nextLine ( ) . split ( " ▁ " ) ; int K = Integer . parseInt ( data [ 0 ] ) ; for ( int j = 1 ; j <= K ; j ++ ) { int value = Integer . parseInt ( data [ j ] ) ; food [ -- value ] ++ ; } } int cnt = 0 ; for ( int i = 0 ; i < M ; i ++ ) { if ( food [ i ] == N ) cnt ++ ; } System . out . println ( cnt ) ; } }

N , M = map ( int , input ( ) . split ( ) ) NEW_LINE KA = [ ] NEW_LINE a = [ ] NEW_LINE ans = 0 NEW_LINE for i in range ( N ) : NEW_LINE INDENT KA = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE A = KA [ 1 : ] NEW_LINE a += A NEW_LINE DEDENT for j in range ( 1 , M + 1 ) : NEW_LINE INDENT if a . count ( j ) == N : NEW_LINE INDENT ans += 1 NEW_LINE DEDENT DEDENT print ( ans ) NEW_LINE


import functools NEW_LINE N , M = map ( int , input ( ) . split ( ) ) NEW_LINE A = [ set ( map ( int , input ( ) . split ( ) [ 1 : ] ) ) for _ in range ( N ) ] NEW_LINE print ( len ( functools . reduce ( set . intersection , A ) ) ) NEW_LINE


def main ( ) : NEW_LINE INDENT n , m = [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE ans = [ 0 for i in range ( m + 1 ) ] NEW_LINE for i in range ( n ) : NEW_LINE INDENT k , * a = [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE for j in range ( k ) : NEW_LINE INDENT ans [ a [ j ] ] += 1 NEW_LINE DEDENT DEDENT print ( ans . count ( n ) ) NEW_LINE DEDENT main ( ) NEW_LINE


N , M = [ int ( s ) for s in input ( ) . split ( ' ▁ ' ) ] NEW_LINE vote = [ 0 ] * M NEW_LINE for _ in range ( N ) : NEW_LINE INDENT answer = [ int ( s ) for s in input ( ) . split ( ' ▁ ' ) ] [ 1 : ] NEW_LINE for a in answer : NEW_LINE INDENT vote [ a - 1 ] += 1 NEW_LINE DEDENT DEDENT vote_all = 0 NEW_LINE for v in vote : NEW_LINE INDENT if v == N : NEW_LINE INDENT vote_all += 1 NEW_LINE DEDENT DEDENT print ( vote_all ) NEW_LINE


N , M = map ( int , input ( ) . split ( ) ) NEW_LINE K = [ 0 ] * N NEW_LINE A = [ [ 0 for j in range ( M ) ] for i in range ( N ) ] NEW_LINE for i in range ( N ) : NEW_LINE INDENT inpt = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE K [ i ] = inpt [ 0 ] NEW_LINE for j in range ( 1 , K [ i ] + 1 , 1 ) : NEW_LINE INDENT A [ i ] [ j - 1 ] = inpt [ j ] NEW_LINE DEDENT DEDENT count = 0 NEW_LINE for j in range ( 1 , M + 1 , 1 ) : NEW_LINE INDENT likecount = 0 NEW_LINE for i in range ( N ) : NEW_LINE INDENT for k in range ( K [ i ] ) : NEW_LINE INDENT if A [ i ] [ k ] == j : NEW_LINE INDENT likecount += 1 NEW_LINE DEDENT DEDENT DEDENT if likecount == N : NEW_LINE INDENT count += 1 NEW_LINE DEDENT DEDENT print ( count ) NEW_LINE


import java . io . InputStream ; import java . io . PrintStream ; import java . util . BitSet ; import java . util . Scanner ; public class Main { InputStream in = System . in ; PrintStream out = System . out ; public void _main ( String [ ] args ) { Scanner sc = new Scanner ( in ) ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; BitSet a = new BitSet ( M ) ; a . flip ( 0 , M ) ; for ( int i = 0 ; i < N ; i ++ ) { int K = sc . nextInt ( ) ; BitSet x = new BitSet ( M ) ; for ( int j = 0 ; j < K ; j ++ ) { x . set ( sc . nextInt ( ) - 1 ) ; } a . and ( x ) ; } out . println ( a . cardinality ( ) ) ; sc . close ( ) ; } public static void main ( String [ ] args ) { new Main ( ) . _main ( args ) ; } }


import java . util . ArrayList ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; ArrayList < Integer > [ ] list = new ArrayList [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { list [ i ] = new ArrayList < Integer > ( ) ; } for ( int i = 0 ; i < N ; i ++ ) { int S = sc . nextInt ( ) ; for ( int j = 0 ; j < S ; j ++ ) { list [ i ] . add ( sc . nextInt ( ) ) ; } } int counter = 0 ; for ( int i = 0 ; i <= M ; i ++ ) { boolean flag = true ; for ( int j = 0 ; j < N ; j ++ ) { if ( list [ j ] . contains ( i ) ) { } else { flag = false ; } } if ( flag ) { counter ++ ; } } System . out . println ( counter ) ; } } Note : . / Main . java uses unchecked or unsafe operations . Note : Recompile with - Xlint : unchecked for details .


import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ; import java . util . stream . IntStream ; public class Main { public static void main ( String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { int n = scanner . nextInt ( ) ; scanner . nextInt ( ) ; scanner . nextLine ( ) ; Set < Integer > commonSet = new HashSet < > ( ) ; IntStream . range ( 0 , n ) . forEach ( i -> { int number = scanner . nextInt ( ) ; Set < Integer > set = new HashSet < > ( ) ; IntStream . range ( 0 , number ) . forEach ( j -> set . add ( scanner . nextInt ( ) ) ) ; scanner . nextLine ( ) ; if ( 0 == i ) { commonSet . addAll ( set ) ; } else { Set < Integer > removeSet = new HashSet < > ( ) ; for ( Integer integer : commonSet ) { if ( ! set . contains ( integer ) ) { removeSet . add ( integer ) ; } } commonSet . removeAll ( removeSet ) ; } } ) ; System . out . println ( commonSet . size ( ) ) ; } } }


import java . util . Arrays ; import java . util . Scanner ; import java . util . stream . IntStream ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int answers = sc . nextInt ( ) ; int kinds = sc . nextInt ( ) ; int [ ] likeCounts = new int [ kinds + 1 ] ; Arrays . fill ( likeCounts , 0 ) ; for ( int i = 0 ; i < answers ; i ++ ) { int ansCount = sc . nextInt ( ) ; for ( int j = 0 ; j < ansCount ; j ++ ) { likeCounts [ sc . nextInt ( ) ] ++ ; } } System . out . println ( IntStream . of ( likeCounts ) . filter ( i -> i == answers ) . count ( ) ) ; } }


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 ) ) ; String input = br . readLine ( ) ; int n = input . length ( ) ; int ts = n ; for ( int i = 1 ; i < n ; i ++ ) { if ( input . charAt ( i - 1 ) != input . charAt ( i ) ) { ts = Math . min ( Math . max ( i , n - i ) , ts ) ; } } System . out . println ( ts ) ; } }

def main ( ) : NEW_LINE INDENT s = input ( ) NEW_LINE n = len ( s ) NEW_LINE chs = changes ( s , n ) NEW_LINE res = n NEW_LINE for c in chs : NEW_LINE INDENT di = max ( c , n - c ) NEW_LINE res = min ( res , di ) NEW_LINE DEDENT print ( res ) NEW_LINE DEDENT def changes ( s , n ) : NEW_LINE INDENT res = [ ] NEW_LINE for i in range ( 1 , n ) : NEW_LINE INDENT if s [ i - 1 ] != s [ i ] : NEW_LINE INDENT res . append ( i ) NEW_LINE DEDENT DEDENT return res NEW_LINE DEDENT main ( ) NEW_LINE


s = list ( input ( ) ) NEW_LINE s = list ( map ( int , s ) ) NEW_LINE length = len ( s ) NEW_LINE i = 0 NEW_LINE while i < len ( s ) - 1 : NEW_LINE INDENT if s [ i ] != s [ i + 1 ] : NEW_LINE INDENT length = min ( length , max ( i + 1 , len ( s ) - i - 1 ) ) NEW_LINE DEDENT i += 1 NEW_LINE DEDENT print ( length ) NEW_LINE


S = list ( input ( ) ) NEW_LINE K = ( len ( S ) + 1 ) // 2 NEW_LINE if len ( S ) % 2 == 0 : NEW_LINE INDENT mark = S [ len ( S ) // 2 ] NEW_LINE if mark != S [ len ( S ) // 2 - 1 ] : NEW_LINE INDENT print ( K ) NEW_LINE exit ( ) NEW_LINE DEDENT count = 1 NEW_LINE while ( 0 < len ( S ) - K - count ) : NEW_LINE INDENT if mark != S [ len ( S ) // 2 - 1 - count ] or mark != S [ len ( S ) // 2 + count ] : NEW_LINE INDENT print ( K + count ) NEW_LINE exit ( ) NEW_LINE DEDENT count += 1 NEW_LINE DEDENT print ( K + count ) NEW_LINE DEDENT else : NEW_LINE INDENT mark = S [ len ( S ) // 2 ] NEW_LINE count = 0 NEW_LINE while ( 0 < len ( S ) - K - count ) : NEW_LINE INDENT if mark != S [ len ( S ) // 2 - 1 - count ] or mark != S [ len ( S ) // 2 + 1 + count ] : NEW_LINE INDENT print ( K + count ) NEW_LINE exit ( ) NEW_LINE DEDENT count += 1 NEW_LINE DEDENT print ( K + count ) NEW_LINE DEDENT


import sys NEW_LINE S = [ 1 if i == '1' else 0 for i in input ( ) ] NEW_LINE l = len ( S ) NEW_LINE if l % 2 == 1 : NEW_LINE INDENT t = l // 2 NEW_LINE a = S [ t ] NEW_LINE for i in range ( 1 , t + 1 ) : NEW_LINE INDENT if S [ t - i ] != a or S [ t + i ] != a : NEW_LINE INDENT print ( t + i ) NEW_LINE sys . exit ( ) NEW_LINE DEDENT DEDENT print ( l ) NEW_LINE sys . exit ( ) NEW_LINE DEDENT if l % 2 == 0 : NEW_LINE INDENT t = l // 2 NEW_LINE a = S [ t - 1 ] NEW_LINE b = S [ t ] NEW_LINE if a != b : NEW_LINE INDENT print ( t ) NEW_LINE sys . exit ( ) NEW_LINE DEDENT for i in range ( 1 , t ) : NEW_LINE INDENT if S [ t - 1 - i ] != a or S [ t + i ] != a : NEW_LINE INDENT print ( t + i ) NEW_LINE sys . exit ( ) NEW_LINE DEDENT DEDENT print ( l ) NEW_LINE sys . exit ( ) NEW_LINE DEDENT


import array NEW_LINE from bisect import * NEW_LINE from collections import * NEW_LINE import fractions NEW_LINE import heapq NEW_LINE from itertools import * NEW_LINE import math NEW_LINE import random NEW_LINE import re NEW_LINE import string NEW_LINE import sys NEW_LINE S = input ( ) NEW_LINE size = len ( S ) NEW_LINE if len ( S ) % 2 == 0 : NEW_LINE INDENT ans = size // 2 NEW_LINE base = S [ size // 2 ] NEW_LINE for i in range ( size // 2 ) : NEW_LINE INDENT if S [ size // 2 - 1 - i ] == S [ size // 2 + i ] == base : NEW_LINE INDENT ans += 1 NEW_LINE DEDENT else : NEW_LINE INDENT break NEW_LINE DEDENT DEDENT print ( ans ) NEW_LINE DEDENT else : NEW_LINE INDENT ans = size // 2 + 1 NEW_LINE base = S [ size // 2 ] NEW_LINE for i in range ( size // 2 ) : NEW_LINE INDENT if S [ size // 2 - 1 - i ] == S [ size // 2 + 1 + i ] == base : NEW_LINE INDENT ans += 1 NEW_LINE DEDENT else : NEW_LINE INDENT break NEW_LINE DEDENT DEDENT print ( ans ) NEW_LINE DEDENT


import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; import java . io . IOException ; import java . util . InputMismatchException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskD solver = new TaskD ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskD { public void solve ( int testNumber , InputReader in , PrintWriter out ) { String s = in . nextString ( ) ; int n = s . length ( ) ; int ans = n ; for ( int i = 0 ; i < n - 1 ; i ++ ) { if ( s . charAt ( i ) != s . charAt ( i + 1 ) ) { ans = Math . min ( ans , Math . max ( i + 1 , n - 1 - i ) ) ; } } out . println ( ans ) ; } } static class InputReader { BufferedReader in ; StringTokenizer tok ; public String nextString ( ) { while ( ! tok . hasMoreTokens ( ) ) { try { tok = new StringTokenizer ( in . readLine ( ) , " ▁ " ) ; } catch ( IOException e ) { throw new InputMismatchException ( ) ; } } return tok . nextToken ( ) ; } public InputReader ( InputStream inputStream ) { in = new BufferedReader ( new InputStreamReader ( inputStream ) ) ; tok = new StringTokenizer ( " " ) ; } } }


import java . util . * ; import java . io . * ; public class Main { public static int centerLength ( String s ) { int N = s . length ( ) ; if ( N % 2 == 0 ) { if ( s . charAt ( N / 2 ) != s . charAt ( N / 2 - 1 ) ) return 0 ; char center = s . charAt ( N / 2 ) ; int length = 2 ; int left = N / 2 - 2 , right = N / 2 + 1 ; while ( left >= 0 && s . charAt ( left ) == center && s . charAt ( right ) == center ) { left -- ; right ++ ; length += 2 ; } return length ; } else { char center = s . charAt ( N / 2 ) ; int left = N / 2 - 1 , right = N / 2 + 1 ; int length = 1 ; while ( left >= 0 && s . charAt ( left ) == center && s . charAt ( right ) == center ) { left -- ; right ++ ; length += 2 ; } return length ; } } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; int N = S . length ( ) ; System . out . println ( N - ( N - centerLength ( S ) ) / 2 ) ; } }


import java . io . FileNotFoundException ; import java . util . Arrays ; import java . util . Scanner ; class Main { final long MOD = 1_000_000_000 + 7 ; void run ( ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; int n = S . length ( ) ; int ans = n / 2 ; int left = n - ans - 1 ; int right = ans ; char c = S . charAt ( left ) ; while ( left >= 0 && S . charAt ( left ) == S . charAt ( right ) && S . charAt ( left ) == c ) { -- left ; ++ right ; ++ ans ; } System . out . println ( ans ) ; } void tr ( Object ... objects ) { System . out . println ( Arrays . deepToString ( objects ) ) ; } public static void main ( String [ ] args ) throws FileNotFoundException { new Main ( ) . run ( ) ; } }


import java . util . * ; public class Main { public void main ( Scanner sc ) { String s = sc . next ( ) ; int len = s . length ( ) ; int ans = len ; int index = 0 ; while ( true ) { int next ; char c = s . charAt ( index ) ; if ( c == '0' ) { next = s . indexOf ( '1' , index + 1 ) ; } else { next = s . indexOf ( '0' , index + 1 ) ; } if ( next == - 1 ) { break ; } ans = Math . min ( ans , Math . max ( next , len - next ) ) ; index = next ; } System . out . println ( ans ) ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; new Main ( ) . main ( sc ) ; sc . close ( ) ; } }


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 ans ; if ( m == 1 ) { ans = 2 ; } else { ans = 1 ; } System . out . println ( ans ) ; } }

print ( ( input ( ) [ 2 ] < '2' ) + 1 ) NEW_LINE


def main ( ) : NEW_LINE INDENT n , m = map ( int , input ( ) . split ( ) ) NEW_LINE for i in range ( 1 , n + 1 ) : NEW_LINE INDENT if i != m : NEW_LINE INDENT print ( i ) NEW_LINE return NEW_LINE DEDENT DEDENT DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT main ( ) NEW_LINE DEDENT


import sys NEW_LINE sys . setrecursionlimit ( 10 ** 9 ) NEW_LINE input = sys . stdin . readline NEW_LINE N , M = map ( int , input ( ) . split ( ) ) NEW_LINE if M >= 2 : NEW_LINE INDENT print ( M - 1 ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( 2 ) NEW_LINE DEDENT


def ans ( ) : NEW_LINE INDENT N , M = map ( int , input ( ) . split ( ) ) NEW_LINE for i in range ( 1 , N + 1 ) : NEW_LINE INDENT if ( i != M ) : NEW_LINE INDENT print ( i ) NEW_LINE break NEW_LINE DEDENT DEDENT DEDENT ans ( ) NEW_LINE


print ( "12" [ int ( input ( ) [ - 1 ] ) < 2 ] ) NEW_LINE


import java . util . * ; public class Main { private static int n ; private static int m ; public static void input ( ) { Scanner scan = new Scanner ( System . in ) ; n = scan . nextInt ( ) ; m = scan . nextInt ( ) ; } public static void main ( String args [ ] ) { input ( ) ; for ( int i = 1 ; i <= n ; i ++ ) { if ( i != m ) { System . out . println ( i ) ; break ; } } } }


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; ArrayList < Integer > ans = new ArrayList < Integer > ( ) ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; for ( int i = 1 ; i <= N ; i ++ ) { if ( i == M ) { continue ; } ans . add ( i ) ; } System . out . println ( ans . get ( 0 ) ) ; } }


import java . util . * ; import java . awt . * ; import java . awt . geom . * ; import static java . lang . System . * ; import static java . lang . Math . * ; public class Main { public static void main ( String [ ] $ ) { Scanner sc = new Scanner ( in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; for ( int i = 1 ; i <= n ; i ++ ) { if ( i != m ) { out . println ( i ) ; exit ( 0 ) ; } } } }


import java . util . Scanner ; public class Main { static Scanner s = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int n = s . nextInt ( ) , m = s . nextInt ( ) ; System . out . println ( m % n + 1 ) ; } }


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

A , B = map ( int , input ( ) . split ( ) ) NEW_LINE a = A + B NEW_LINE if A * B > a : NEW_LINE INDENT a = A * B NEW_LINE DEDENT if A - B > a : NEW_LINE INDENT a = A - B NEW_LINE DEDENT print ( a ) NEW_LINE


i = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE A = i [ 0 ] NEW_LINE B = i [ 1 ] NEW_LINE a = 0 NEW_LINE s = 0 NEW_LINE m = 0 NEW_LINE def add ( a , b ) : NEW_LINE INDENT return a + b NEW_LINE DEDENT def sub ( a , b ) : NEW_LINE INDENT return a - b NEW_LINE DEDENT def mul ( a , b ) : NEW_LINE INDENT return a * b NEW_LINE DEDENT a = add ( A , B ) NEW_LINE s = sub ( A , B ) NEW_LINE m = mul ( A , B ) NEW_LINE print ( max ( a , s , m ) ) NEW_LINE


s = [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE l = [ s [ 0 ] + s [ 1 ] , s [ 0 ] - s [ 1 ] , s [ 0 ] * s [ 1 ] ] NEW_LINE print ( max ( l ) ) NEW_LINE


a , b = map ( int , input ( ) . split ( ) ) NEW_LINE x = a + b NEW_LINE y = a - b NEW_LINE z = a * b NEW_LINE if y <= x and z <= x : NEW_LINE INDENT print ( x ) NEW_LINE DEDENT elif x <= y and z <= y : NEW_LINE INDENT print ( y ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( z ) NEW_LINE DEDENT


a , b = [ int ( _ ) for _ in input ( ) . split ( ) ] NEW_LINE print ( max ( a + b , a - b , a * b ) ) NEW_LINE


import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { new Main ( ) . solveA ( ) ; } private void solveA ( ) { Scanner scanner = null ; int numA = 0 ; int numB = 0 ; try { scanner = new Scanner ( System . in ) ; numA = scanner . nextInt ( ) ; numB = scanner . nextInt ( ) ; System . out . println ( Math . max ( numA + numB , Math . max ( numA - numB , numA * numB ) ) ) ; } finally { if ( scanner != null ) { scanner . close ( ) ; } } } private void solveB ( ) { Scanner scanner = null ; int numN = 0 ; int numK = 0 ; int numS = 0 ; try { scanner = new Scanner ( System . in ) ; numN = scanner . nextInt ( ) ; System . out . println ( " " ) ; } finally { if ( scanner != null ) { scanner . close ( ) ; } } } private void solveC ( ) { Scanner scanner = null ; int numN = 0 ; int numK = 0 ; int numS = 0 ; try { scanner = new Scanner ( System . in ) ; numN = scanner . nextInt ( ) ; System . out . println ( " " ) ; } finally { if ( scanner != null ) { scanner . close ( ) ; } } } private void solveD ( ) { Scanner scanner = null ; int numN = 0 ; int numK = 0 ; int numS = 0 ; try { scanner = new Scanner ( System . in ) ; numN = scanner . nextInt ( ) ; System . out . println ( " " ) ; } finally { if ( scanner != null ) { scanner . close ( ) ; } } } }


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 ( ) ; int ans = Math . max ( A + B , A * B ) ; ans = Math . max ( ans , A - B ) ; 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 int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } } }


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 add = A + B ; int sub = A - B ; int mul = A * B ; int max = 0 ; if ( add >= sub && add >= mul ) max = add ; if ( sub >= add && sub >= mul ) max = sub ; if ( mul >= add && mul >= sub ) max = mul ; System . out . println ( max ) ; } }


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 ) ; ABC098_A solver = new ABC098_A ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class ABC098_A { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int a = in . nextInt ( ) ; int b = in . nextInt ( ) ; int ans = Math . max ( Math . max ( a + b , a - b ) , a * b ) ; out . print ( ans ) ; } } }


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; double d1 = sc . nextInt ( ) ; double x = sc . nextInt ( ) ; double ans = 0 ; for ( ; N > 0 ; N -- ) { ans += d1 + ( N - 0.5 ) * x ; d1 = ( ( 2 * N + 2 ) * d1 + 5 * x ) / ( 2 * N ) ; x = ( ( double ) N + 2 ) / N * x ; } System . out . println ( ans ) ; sc . close ( ) ; } }

def solve ( n , d , x ) : NEW_LINE INDENT ans = 0 NEW_LINE while n : NEW_LINE INDENT ans += d + ( 2 * n - 1 ) * x / 2 NEW_LINE d = ( ( n + 1 ) * d + 5 * x / 2 ) / n NEW_LINE x *= ( n + 2 ) / n NEW_LINE n -= 1 NEW_LINE DEDENT return ans NEW_LINE DEDENT print ( ' { : . 10f } ' . format ( solve ( * map ( float , input ( ) . split ( ) ) ) ) ) NEW_LINE


import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . HashMap ; import java . util . HashSet ; import java . util . List ; import java . util . Scanner ; import java . util . concurrent . SynchronousQueue ; public class Main { public static void main ( String [ ] args ) { new Main ( ) . solve ( ) ; } void solve ( ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; double [ ] F = new double [ 200001 ] ; double [ ] G = new double [ 200001 ] ; { Arrays . fill ( F , - 1 ) ; Arrays . fill ( G , - 1 ) ; } F [ 1 ] = 0.5 ; G [ 1 ] = 1 ; for ( int i = 2 ; i <= 200000 ; ++ i ) { F [ i ] = ( 1 + 2. / i ) * F [ i - 1 ] + 5. / ( 2 * i ) * G [ i - 1 ] + 1. / ( 2 * i ) * i * ( 2 * i - 1 ) ; G [ i ] = ( 1 + 1d / i ) * G [ i - 1 ] + 1 ; } System . out . println ( String . format ( " % .20f " , F [ n ] * x + d * G [ n ] ) ) ; } public static void tr ( Object ... objects ) { System . out . println ( Arrays . deepToString ( objects ) ) ; } }


import java . util . * ; import java . math . * ; public class Main { public static void main ( String [ ] args ) { MathContext mc = new MathContext ( 25 , RoundingMode . HALF_DOWN ) ; Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int a = in . nextInt ( ) ; int x = in . nextInt ( ) ; BigDecimal L = new BigDecimal ( 1 ) ; BigDecimal ans = new BigDecimal ( 2 * x ) ; for ( int i = 2 ; i <= n ; ++ i ) { BigDecimal t = new BigDecimal ( i ) ; L = L . add ( BigDecimal . ONE . divide ( BigDecimal . valueOf ( i ) , mc ) ) ; t = L . add ( BigDecimal . valueOf ( i ) ) ; t = t . multiply ( BigDecimal . valueOf ( x ) ) ; BigDecimal t2 = ans . multiply ( BigDecimal . valueOf ( 2 ) ) . divide ( BigDecimal . valueOf ( i ) , mc ) ; ans = ans . add ( t ) . add ( t2 ) ; } L = L . add ( BigDecimal . ONE . divide ( BigDecimal . valueOf ( n + 1 ) , mc ) ) ; L = L . subtract ( BigDecimal . ONE ) ; L = L . multiply ( BigDecimal . valueOf ( n + 1 ) ) . multiply ( BigDecimal . valueOf ( 2 * a - 3 * x ) ) ; L = L . divide ( BigDecimal . valueOf ( 2 ) , mc ) ; ans = ans . add ( L ) ; System . out . print ( ans ) ; } }


import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . HashMap ; import java . util . HashSet ; import java . util . List ; import java . util . Scanner ; import java . util . concurrent . SynchronousQueue ; public class Main { public static void main ( String [ ] args ) { new Main ( ) . solve ( ) ; } void solve ( ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; double [ ] F = new double [ 200001 ] ; double [ ] G = new double [ 200001 ] ; { Arrays . fill ( F , - 1 ) ; Arrays . fill ( G , - 1 ) ; } F [ 1 ] = 0.5 ; G [ 1 ] = 1 ; for ( int i = 2 ; i <= 200000 ; ++ i ) { F [ i ] = ( 1 + 2. / i ) * F [ i - 1 ] + 5. / ( 2 * i ) * G [ i - 1 ] + 1. / ( 2 * i ) * i * ( 2 * i - 1 ) ; G [ i ] = ( 1 + 1. / i ) * G [ i - 1 ] + 1 ; } System . out . println ( String . format ( " % .20f " , F [ n ] * x + d * G [ n ] ) ) ; } public static void tr ( Object ... objects ) { System . out . println ( Arrays . deepToString ( objects ) ) ; } }


import java . math . BigDecimal ; import java . text . DecimalFormat ; import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; double N = scan . nextDouble ( ) ; double d = scan . nextDouble ( ) ; double x = scan . nextDouble ( ) ; BigDecimal ans = new BigDecimal ( "0.0" ) ; while ( N > 0.5 ) { BigDecimal adnum = BigDecimal . valueOf ( d + x * ( N - 0.5 ) ) ; ans = ans . add ( adnum ) ; d = ( N + 1.0 ) * d / N + ( 5.0 * x ) / ( 2.0 * N ) ; x = ( 1.0 + ( 2.0 / N ) ) * x ; -- N ; } DecimalFormat format = new DecimalFormat ( " # . # " ) ; format . setMinimumFractionDigits ( 20 ) ; System . out . println ( format . format ( ans ) ) ; } }


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int output = 0 ; for ( int i = 0 ; i < 12 ; i ++ ) { if ( sc . next ( ) . contains ( " r " ) ) { output ++ ; } } System . out . println ( output ) ; } }

c = 0 NEW_LINE for i in range ( 12 ) : NEW_LINE INDENT if ' r ' in input ( ) : NEW_LINE INDENT c += 1 NEW_LINE DEDENT DEDENT print ( c ) NEW_LINE


def oyster ( S : list ) -> int : NEW_LINE INDENT return sum ( ' r ' in s for s in S ) NEW_LINE DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT S = [ input ( ) for _ in range ( 12 ) ] NEW_LINE ans = oyster ( S ) NEW_LINE print ( ans ) NEW_LINE DEDENT


def start_process ( ) : NEW_LINE INDENT X , Y , Z , K = map ( int , input ( ) . split ( ) ) NEW_LINE A = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE return NEW_LINE DEDENT def main ( ) : NEW_LINE INDENT count = 0 NEW_LINE for i in range ( 12 ) : NEW_LINE INDENT a = list ( input ( ) ) NEW_LINE if ' r ' in a : NEW_LINE INDENT count += 1 NEW_LINE DEDENT DEDENT print ( count ) NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT main ( ) NEW_LINE DEDENT


print ( sum ( [ ' r ' in input ( ) . strip ( ) for _ in range ( 12 ) ] ) ) NEW_LINE


import sys NEW_LINE a = 0 NEW_LINE for i in sys . stdin : NEW_LINE INDENT if " r " in i : NEW_LINE INDENT a += 1 NEW_LINE DEDENT DEDENT print ( a ) NEW_LINE


import java . util . InputMismatchException ; import java . util . Scanner ; public class Main { public static void find ( String [ ] str1 , int n ) { int i = 0 ; int j = 0 ; int count = 0 ; while ( i < n ) { for ( j = 0 ; j < str1 [ i ] . length ( ) ; j ++ ) { if ( str1 [ i ] . substring ( j , j + 1 ) . equals ( " r " ) ) { count = count + 1 ; break ; } } i ++ ; } System . out . println ( count ) ; } public static void input ( ) { Scanner sc = null ; try { sc = new Scanner ( System . in ) ; int i = 0 ; String str ; String [ ] str1 = new String [ 12 ] ; while ( i < 12 ) { str = sc . next ( ) ; str1 [ i ] = str ; i ++ ; } find ( str1 , 12 ) ; } catch ( InputMismatchException e ) { } finally { } } public static void main ( String [ ] args ) { input ( ) ; } }


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 ) ; TaskB solver = new TaskB ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskB { public void solve ( int testNumber , FastScanner in , PrintWriter out ) { int count = 0 ; for ( int i = 0 ; i < 12 ; i ++ ) if ( in . next ( ) . contains ( " r " ) ) count ++ ; out . println ( count ) ; } } 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 ; this . bufPointer = 0 ; this . bufLength = 0 ; } 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 isPrintableChar ( int c ) { return c >= 33 && c <= 126 ; } public String next ( ) { StringBuilder sb = new StringBuilder ( ) ; int b = readByte ( ) ; while ( ! isPrintableChar ( b ) ) b = readByte ( ) ; while ( isPrintableChar ( b ) ) { sb . appendCodePoint ( b ) ; b = readByte ( ) ; } return sb . toString ( ) ; } } }


import java . util . * ; import static java . lang . System . in ; import static java . lang . System . out ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( in ) ; int counter = 0 ; for ( int i = 0 ; i < 12 ; i ++ ) { String str = sc . nextLine ( ) ; if ( str . contains ( " r " ) ) counter ++ ; } out . println ( counter ) ; } }


import java . util . Scanner ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String [ ] str = new String [ 12 ] ; for ( int i = 0 ; i < 12 ; i ++ ) { str [ i ] = sc . next ( ) ; } int ans = 0 ; for ( int i = 0 ; i < 12 ; i ++ ) { for ( int j = 0 ; j < str [ i ] . length ( ) ; j ++ ) { if ( str [ i ] . charAt ( j ) == ' r ' ) { ans ++ ; break ; } } } System . out . println ( ans ) ; } }


import java . util . * ; public class Main { static boolean masu [ ] ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int R = sc . nextInt ( ) ; String S = sc . next ( ) ; int lastindex = - 1 ; masu = new boolean [ N ] ; int last = 0 ; for ( int i = 0 ; i < N ; i ++ ) { masu [ i ] = S . charAt ( i ) == ' o ' ; if ( ! masu [ i ] ) { last = i + 1 ; } } int ans = 0 ; int idx = 1 ; while ( true ) { if ( check ( ) ) break ; if ( last - idx < R ) { ans ++ ; break ; } else if ( masu [ idx - 1 ] ) { ans ++ ; idx ++ ; } else { ans ++ ; for ( int i = idx ; i < idx + R ; i ++ ) { masu [ i - 1 ] = true ; } } } System . out . println ( ans ) ; } static boolean check ( ) { for ( int i = 0 ; i < masu . length ; i ++ ) { if ( ! masu [ i ] ) return false ; } return true ; } }

N , R = map ( int , input ( ) . split ( " ▁ " ) ) NEW_LINE S = list ( input ( ) ) NEW_LINE while ( S ) and S [ - 1 ] == " o " : NEW_LINE INDENT S . pop ( ) NEW_LINE N -= 1 NEW_LINE DEDENT p = 0 NEW_LINE cost = 0 NEW_LINE for i in range ( N ) : NEW_LINE INDENT if S [ i ] != " . " : NEW_LINE INDENT continue NEW_LINE DEDENT S [ i : i + R ] = [ " o " ] * R NEW_LINE p = i NEW_LINE cost += 1 NEW_LINE DEDENT cost += min ( max ( 0 , N - R ) , p ) NEW_LINE print ( cost ) NEW_LINE


def b_paint_line ( N , R , S ) : NEW_LINE INDENT try : NEW_LINE INDENT ans = max ( S . rindex ( ' . ' ) - R + 1 , 0 ) NEW_LINE DEDENT except ValueError : NEW_LINE INDENT return 0 NEW_LINE DEDENT s = list ( S ) NEW_LINE while s . count ( ' . ' ) != 0 : NEW_LINE INDENT ans += 1 NEW_LINE idx = s . index ( ' . ' ) NEW_LINE for j in range ( idx , idx + R ) : NEW_LINE INDENT if j >= N : NEW_LINE INDENT break NEW_LINE DEDENT s [ j ] = ' o ' NEW_LINE DEDENT DEDENT return ans NEW_LINE DEDENT N , R = [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE S = input ( ) NEW_LINE print ( b_paint_line ( N , R , S ) ) NEW_LINE


def check ( d ) : NEW_LINE INDENT l = 0 NEW_LINE for i in d : NEW_LINE INDENT if i == " o " : NEW_LINE INDENT l += 1 NEW_LINE DEDENT DEDENT if l == len ( d ) : NEW_LINE INDENT return True NEW_LINE DEDENT return False NEW_LINE DEDENT n , r = map ( int , input ( ) . split ( ) ) NEW_LINE s = list ( input ( ) ) NEW_LINE ans = 0 NEW_LINE p = 0 NEW_LINE for i in range ( n ) : NEW_LINE INDENT if s [ i ] == " . " : NEW_LINE INDENT p = i NEW_LINE DEDENT DEDENT i = 0 NEW_LINE j = 0 NEW_LINE for _ in range ( n ) : NEW_LINE INDENT if s [ j ] == " o " : NEW_LINE INDENT j += 1 NEW_LINE DEDENT DEDENT if j == n : NEW_LINE INDENT print ( 0 ) NEW_LINE quit ( ) NEW_LINE DEDENT while i < n : NEW_LINE INDENT if s [ i ] == " o " and i < p - r + 1 : NEW_LINE INDENT i += 1 NEW_LINE ans += 1 NEW_LINE DEDENT else : NEW_LINE INDENT for j in range ( i , min ( i + r , n ) ) : NEW_LINE INDENT s [ j ] = " o " NEW_LINE DEDENT ans += 1 NEW_LINE DEDENT if check ( s ) : NEW_LINE INDENT break NEW_LINE DEDENT DEDENT print ( ans ) NEW_LINE


import sys NEW_LINE sys . setrecursionlimit ( 10 ** 9 ) NEW_LINE input = sys . stdin . readline NEW_LINE N , M = map ( int , input ( ) . split ( ) ) NEW_LINE L = input ( ) [ : - 1 ] NEW_LINE ans = 0 NEW_LINE i = len ( L ) - 1 NEW_LINE first = True NEW_LINE while i >= 0 : NEW_LINE INDENT if L [ i ] == " o " : NEW_LINE INDENT i -= 1 NEW_LINE DEDENT else : NEW_LINE INDENT if first : NEW_LINE INDENT ans += 1 NEW_LINE i -= M NEW_LINE if i >= 0 : NEW_LINE INDENT ans += i + 1 NEW_LINE DEDENT first = False NEW_LINE DEDENT else : NEW_LINE INDENT ans += 1 NEW_LINE i -= M NEW_LINE DEDENT DEDENT DEDENT print ( ans ) NEW_LINE


N , R = map ( int , input ( ) . split ( ) ) NEW_LINE inputs = list ( input ( ) ) NEW_LINE remain = inputs . count ( ' . ' ) NEW_LINE ans = 0 NEW_LINE for i in range ( N - R + 1 ) : NEW_LINE INDENT not_painted = inputs [ i : i + R ] . count ( ' . ' ) NEW_LINE if remain == 0 : NEW_LINE INDENT break NEW_LINE DEDENT if remain == not_painted : NEW_LINE INDENT ans += 1 NEW_LINE break NEW_LINE DEDENT if inputs [ i ] == ' . ' : NEW_LINE INDENT for j in range ( i , i + R ) : NEW_LINE INDENT inputs [ j ] = ' o ' NEW_LINE DEDENT remain -= not_painted NEW_LINE ans += 1 NEW_LINE DEDENT ans += 1 NEW_LINE DEDENT print ( ans ) NEW_LINE


import java . util . * ; import java . awt . * ; import java . awt . geom . * ; import static java . lang . System . * ; import static java . lang . Math . * ; public class Main { public static void main ( String [ ] $ ) { Scanner sc = new Scanner ( in ) ; long [ ] a = new long [ 61 ] ; for ( int i = 0 ; i < 61 ; i ++ ) { a [ i ] = power ( 2 , i ) ; } long n = sc . nextLong ( ) ; int exponent = 0 ; while ( n / a [ exponent ] > 0 ) exponent ++ ; exponent -- ; int count = 0 ; long t = 1 ; while ( t <= n ) { if ( exponent % 2 == 1 ) { if ( count % 2 == 0 ) t = right ( t ) ; else t = left ( t ) ; } else { if ( count % 2 == 0 ) t = left ( t ) ; else t = right ( t ) ; } count ++ ; } String [ ] ans = { " Aoki " , " Takahashi " } ; out . println ( ans [ ( count + 1 ) % 2 ] ) ; } static long power ( long x , int n ) { if ( n == 0 ) return 1 ; if ( n % 2 == 0 ) { long e = power ( x , n / 2 ) ; return ( e * e ) ; } long e = ( x * power ( x , n - 1 ) ) ; return e ; } static long right ( long a ) { return a * 2 ; } static long left ( long a ) { return a * 2 + 1 ; } }

n = int ( input ( ) ) NEW_LINE row = 0 NEW_LINE for i in range ( 100 ) : NEW_LINE INDENT if 2 ** i <= n <= 2 ** ( i + 1 ) - 1 : NEW_LINE INDENT row = i NEW_LINE break NEW_LINE DEDENT DEDENT def seki ( k , n ) : NEW_LINE INDENT for _ in range ( n ) : NEW_LINE INDENT k = 4 * k + 2 NEW_LINE DEDENT return k NEW_LINE DEDENT k = 0 NEW_LINE if row % 2 != 0 : NEW_LINE INDENT k = 2 NEW_LINE cri = seki ( k , row // 2 ) NEW_LINE if n < cri : NEW_LINE INDENT print ( " Aoki " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " Takahashi " ) NEW_LINE DEDENT DEDENT else : NEW_LINE INDENT k = 1 NEW_LINE cri = seki ( k , row // 2 ) NEW_LINE if n < cri : NEW_LINE INDENT print ( " Takahashi " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " Aoki " ) NEW_LINE DEDENT DEDENT


def baibai_chance ( N : int ) -> str : NEW_LINE INDENT depth = 0 NEW_LINE n = N NEW_LINE while 1 < n : NEW_LINE INDENT depth += 1 NEW_LINE n >>= 1 NEW_LINE DEDENT def m2 ( x ) : return x << 1 NEW_LINE def m2p1 ( x ) : return ( x << 1 ) + 1 NEW_LINE if depth % 2 == 0 : NEW_LINE INDENT Tst , Ast = m2p1 , m2 NEW_LINE DEDENT else : NEW_LINE INDENT Tst , Ast = m2 , m2p1 NEW_LINE DEDENT x = 1 NEW_LINE while True : NEW_LINE INDENT x = Tst ( x ) NEW_LINE if N < x : NEW_LINE INDENT return " Aoki " NEW_LINE DEDENT x = Ast ( x ) NEW_LINE if N < x : NEW_LINE INDENT return ' Takahashi ' NEW_LINE DEDENT DEDENT DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT N = int ( input ( ) ) NEW_LINE ans = baibai_chance ( N ) NEW_LINE print ( ans ) NEW_LINE DEDENT


N = bin ( int ( input ( ) ) ) [ 2 : ] NEW_LINE ret = [ ' Aoki ' , ' Takahashi ' ] NEW_LINE point = 0 NEW_LINE for i in range ( 1 , len ( N ) ) : NEW_LINE INDENT if N [ i ] == '0' : NEW_LINE INDENT if i % 2 != ( len ( N ) - 1 ) % 2 : NEW_LINE INDENT print ( ret [ i % 2 ] ) NEW_LINE break NEW_LINE DEDENT DEDENT if N [ i ] == '1' : NEW_LINE INDENT if i % 2 == ( len ( N ) - 1 ) % 2 : NEW_LINE INDENT print ( ret [ i % 2 ] ) NEW_LINE break NEW_LINE DEDENT DEDENT DEDENT else : NEW_LINE INDENT print ( ret [ ( len ( N ) - 1 ) % 2 ] ) NEW_LINE DEDENT


N = int ( input ( ) ) NEW_LINE depth = len ( bin ( N ) ) - 2 NEW_LINE def func ( ) : NEW_LINE INDENT x = 1 NEW_LINE for d in range ( 80 ) : NEW_LINE INDENT if d % 2 == depth % 2 : NEW_LINE INDENT x = 2 * x NEW_LINE DEDENT elif d % 2 != depth % 2 : NEW_LINE INDENT x = 2 * x + 1 NEW_LINE DEDENT if x > N : NEW_LINE INDENT break NEW_LINE DEDENT DEDENT return d NEW_LINE DEDENT d = func ( ) NEW_LINE ans = [ " Aoki " , " Takahashi " ] NEW_LINE index = d % 2 NEW_LINE print ( ans [ index ] ) NEW_LINE


from math import log2 NEW_LINE import sys NEW_LINE sys . setrecursionlimit ( 10 ** 9 ) NEW_LINE input = sys . stdin . readline NEW_LINE def left ( x ) : NEW_LINE INDENT return 2 * x NEW_LINE DEDENT def right ( x ) : NEW_LINE INDENT return 2 * x + 1 NEW_LINE DEDENT def floor ( x ) : NEW_LINE INDENT return x // 1 NEW_LINE DEDENT def depth ( x ) : NEW_LINE INDENT return floor ( log2 ( x ) ) + 1 NEW_LINE DEDENT def solve ( ) : NEW_LINE INDENT n = int ( input ( ) ) NEW_LINE turn = True NEW_LINE d = depth ( n ) NEW_LINE if d % 2 == 0 : NEW_LINE INDENT taka = ( lambda x : left ( x ) ) NEW_LINE aoki = ( lambda x : right ( x ) ) NEW_LINE DEDENT else : NEW_LINE INDENT aoki = ( lambda x : left ( x ) ) NEW_LINE taka = ( lambda x : right ( x ) ) NEW_LINE DEDENT x = 1 NEW_LINE while x <= n : NEW_LINE INDENT if turn : NEW_LINE INDENT x = taka ( x ) NEW_LINE DEDENT else : NEW_LINE INDENT x = aoki ( x ) NEW_LINE DEDENT turn = not turn NEW_LINE DEDENT if turn : NEW_LINE INDENT print ( " Takahashi " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " Aoki " ) NEW_LINE DEDENT DEDENT solve ( ) NEW_LINE


import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . PrintWriter ; @ SuppressWarnings ( " unchecked " ) public class Main { static final String Takahashi = " Takahashi " ; static final String Aoki = " Aoki " ; static long N ; static boolean odd ; static boolean f ( ) { boolean turn = true ; long num = 1 ; while ( num <= N ) { if ( turn ) { if ( odd ) num = 2 * num + 1 ; else num = 2 * num ; } else { if ( odd ) num = 2 * num ; else num = 2 * num + 1 ; } turn = ! turn ; } boolean flg = true ; if ( ! turn ) flg = false ; return flg ; } public static void main ( String [ ] args ) throws IOException { final String s ; try ( BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { s = reader . readLine ( ) ; } PrintWriter out = new PrintWriter ( System . out ) ; N = Long . parseLong ( s ) ; long depth = 0 ; for ( long i = N ; 0 < i ; i /= 2 ) depth ++ ; odd = depth % 2 == 1 ; if ( f ( ) ) out . println ( Takahashi ) ; else out . println ( Aoki ) ; out . flush ( ) ; } }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class Main { long n ; public static void main ( String args [ ] ) { new Main ( ) . run ( ) ; } void run ( ) { FastReader sc = new FastReader ( ) ; n = sc . nextLong ( ) ; solve ( ) ; } void solve ( ) { int depth = 0 ; for ( long k = n ; k > 0 ; k /= 2 ) { depth ++ ; } long x = 1 ; int turn = 0 ; boolean even = depth % 2 == 0 ; while ( x <= n ) { if ( turn == 0 ) { if ( even ) { x *= 2 ; } else { x = 2 * x + 1 ; } } else { if ( even ) { x = 2 * x + 1 ; } else { x *= 2 ; } } turn = ( turn + 1 ) % 2 ; } if ( turn == 0 ) { System . out . println ( " Takahashi " ) ; } else { System . out . println ( " Aoki " ) ; } } static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } }


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long N = sc . nextLong ( ) ; int depth = 0 ; for ( long n = N ; n > 0 ; n /= 2 ) { depth ++ ; } if ( depth % 2 == 1 ) { long x = 1 ; while ( true ) { if ( x * 2 > N ) { System . out . println ( " Aoki " ) ; return ; } x = x * 2 + 1 ; if ( x * 2 > N ) { System . out . println ( " Takahashi " ) ; return ; } x *= 2 ; } } else { long x = 1 ; while ( true ) { if ( x * 2 > N ) { System . out . println ( " Aoki " ) ; return ; } x *= 2 ; if ( x * 2 > N ) { System . out . println ( " Takahashi " ) ; return ; } x = x * 2 + 1 ; } } } }


public class Main { private static java . util . Scanner scanner = new java . util . Scanner ( System . in ) ; public static void main ( String [ ] $ ) { long n = scanner . nextLong ( ) , x = 1 ; int depth = Long . numberOfTrailingZeros ( Long . highestOneBit ( n ) ) & 1 ; boolean turn = false ; while ( n >= x ) x = x * 2 + ( ( turn = ! turn ) ? 1 - depth : depth ) ; System . out . println ( turn ? " Aoki " : " Takahashi " ) ; } }


import java . awt . Point ; import java . util . ArrayDeque ; import java . util . Queue ; import java . util . Scanner ; public class Main { static int INF = 10000 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Queue < Point > que = new ArrayDeque < > ( ) ; int dx [ ] = { 1 , 0 , - 1 , 0 } ; int dy [ ] = { 0 , 1 , 0 , - 1 } ; int h = sc . nextInt ( ) ; int w = sc . nextInt ( ) ; int sx = sc . nextInt ( ) - 1 ; int sy = sc . nextInt ( ) - 1 ; int gx = sc . nextInt ( ) - 1 ; int gy = sc . nextInt ( ) - 1 ; char f [ ] [ ] = new char [ h ] [ w ] ; int dist [ ] [ ] = new int [ h ] [ w ] ; for ( int i = 0 ; i < h ; i ++ ) for ( int j = 0 ; j < w ; j ++ ) dist [ i ] [ j ] = INF ; for ( int i = 0 ; i < h ; i ++ ) { f [ i ] = sc . next ( ) . toCharArray ( ) ; } Point start = new Point ( sx , sy ) ; dist [ sx ] [ sy ] = 0 ; que . add ( start ) ; while ( ! que . isEmpty ( ) ) { Point p = que . poll ( ) ; if ( p . x == gx && p . y == gy ) break ; for ( int i = 0 ; i < 4 ; i ++ ) { int nx = p . x + dx [ i ] ; int ny = p . y + dy [ i ] ; if ( f [ nx ] [ ny ] == ' . ' && dist [ nx ] [ ny ] == INF ) { que . add ( new Point ( nx , ny ) ) ; dist [ nx ] [ ny ] = dist [ p . x ] [ p . y ] + 1 ; } } } System . out . println ( dist [ gx ] [ gy ] ) ; } }

from queue import Queue NEW_LINE h , w = map ( int , input ( ) . split ( ) ) NEW_LINE sy , sx = map ( int , input ( ) . split ( ) ) NEW_LINE sy -= 1 NEW_LINE sx -= 1 NEW_LINE gy , gx = map ( int , input ( ) . split ( ) ) NEW_LINE gy -= 1 NEW_LINE gx -= 1 NEW_LINE map = [ [ 0 ] for _ in range ( h ) ] NEW_LINE for i in range ( h ) : NEW_LINE INDENT map [ i ] = list ( input ( ) ) NEW_LINE DEDENT que = Queue ( ) NEW_LINE que . put ( [ sx , sy ] ) NEW_LINE checked = [ [ - 1 ] * w for _ in range ( h ) ] NEW_LINE checked [ sy ] [ sx ] = 0 NEW_LINE ans = 0 NEW_LINE def bfs ( ) : NEW_LINE INDENT global que , checked , ans NEW_LINE while not que . empty ( ) : NEW_LINE INDENT xy = que . get ( ) NEW_LINE if xy [ 0 ] == gx and xy [ 1 ] == gy : NEW_LINE INDENT ans = checked [ xy [ 1 ] ] [ xy [ 0 ] ] NEW_LINE DEDENT for i in range ( - 1 , 2 ) : NEW_LINE INDENT for j in range ( - 1 , 2 ) : NEW_LINE INDENT if i == j or i == - j : NEW_LINE INDENT continue NEW_LINE DEDENT if 0 <= xy [ 0 ] + i < w and 0 <= xy [ 1 ] + j < h : NEW_LINE INDENT if map [ xy [ 1 ] + j ] [ xy [ 0 ] + i ] == " . " and checked [ xy [ 1 ] + j ] [ xy [ 0 ] + i ] == - 1 : NEW_LINE INDENT checked [ xy [ 1 ] + j ] [ xy [ 0 ] + i ] = checked [ xy [ 1 ] ] [ xy [ 0 ] ] + 1 NEW_LINE que . put ( [ xy [ 0 ] + i , xy [ 1 ] + j ] ) NEW_LINE DEDENT DEDENT DEDENT DEDENT DEDENT DEDENT bfs ( ) NEW_LINE print ( ans ) NEW_LINE


from collections import deque NEW_LINE R , C = ( int ( _ ) for _ in input ( ) . split ( ) ) NEW_LINE sy , sx = ( int ( _ ) for _ in input ( ) . split ( ) ) NEW_LINE gy , gx = ( int ( _ ) for _ in input ( ) . split ( ) ) NEW_LINE maze = [ list ( input ( ) ) for _ in range ( R ) ] NEW_LINE distance_from_start = [ [ - 1 ] * C for _ in range ( R ) ] NEW_LINE move = [ [ 1 , 0 ] , [ - 1 , 0 ] , [ 0 , 1 ] , [ 0 , - 1 ] ] NEW_LINE que = deque ( ) NEW_LINE que . append ( ( sx , sy ) ) NEW_LINE distance_from_start [ sy - 1 ] [ sx - 1 ] = 0 NEW_LINE def minimum_distance ( ) : NEW_LINE INDENT while len ( que ) != 0 : NEW_LINE INDENT x , y = que . popleft ( ) NEW_LINE for i in range ( 4 ) : NEW_LINE INDENT next_x = x + move [ i ] [ 0 ] NEW_LINE next_y = y + move [ i ] [ 1 ] NEW_LINE if next_x <= 0 or next_x > C or next_y <= 0 or next_y > R or distance_from_start [ next_y - 1 ] [ next_x - 1 ] != - 1 or maze [ next_y - 1 ] [ next_x - 1 ] == " # " : NEW_LINE INDENT continue NEW_LINE DEDENT distance_from_start [ next_y - 1 ] [ next_x - 1 ] = distance_from_start [ y - 1 ] [ x - 1 ] + 1 NEW_LINE que . append ( ( next_x , next_y ) ) NEW_LINE DEDENT DEDENT DEDENT minimum_distance ( ) NEW_LINE print ( distance_from_start [ gy - 1 ] [ gx - 1 ] ) NEW_LINE


from collections import deque NEW_LINE r , c = map ( int , input ( ) . split ( ) ) NEW_LINE root = [ [ None for __ in range ( c ) ] for __ in range ( r ) ] NEW_LINE sx , sy = map ( int , input ( ) . split ( ) ) NEW_LINE gx , gy = map ( int , input ( ) . split ( ) ) NEW_LINE sy -= 1 NEW_LINE sx -= 1 NEW_LINE gy -= 1 NEW_LINE gx -= 1 NEW_LINE m = [ list ( input ( ) ) for __ in range ( r ) ] NEW_LINE root [ sx ] [ sy ] = 0 NEW_LINE celx = deque ( ) NEW_LINE cely = deque ( ) NEW_LINE x = sx NEW_LINE y = sy NEW_LINE while root [ gx ] [ gy ] == None : NEW_LINE INDENT if x != 0 and m [ x - 1 ] [ y ] != ' # ' and root [ x - 1 ] [ y ] == None : NEW_LINE INDENT root [ x - 1 ] [ y ] = root [ x ] [ y ] + 1 NEW_LINE celx . append ( x - 1 ) NEW_LINE cely . append ( y ) NEW_LINE DEDENT if x != r - 1 and m [ x + 1 ] [ y ] != ' # ' and root [ x + 1 ] [ y ] == None : NEW_LINE INDENT root [ x + 1 ] [ y ] = root [ x ] [ y ] + 1 NEW_LINE celx . append ( x + 1 ) NEW_LINE cely . append ( y ) NEW_LINE DEDENT if y != 0 and m [ x ] [ y - 1 ] != ' # ' and root [ x ] [ y - 1 ] == None : NEW_LINE INDENT root [ x ] [ y - 1 ] = root [ x ] [ y ] + 1 NEW_LINE celx . append ( x ) NEW_LINE cely . append ( y - 1 ) NEW_LINE DEDENT if y != c - 1 and m [ x ] [ y + 1 ] != ' # ' and root [ x ] [ y + 1 ] == None : NEW_LINE INDENT root [ x ] [ y + 1 ] = root [ x ] [ y ] + 1 NEW_LINE celx . append ( x ) NEW_LINE cely . append ( y + 1 ) NEW_LINE DEDENT x = celx . popleft ( ) NEW_LINE y = cely . popleft ( ) NEW_LINE DEDENT print ( root [ gx ] [ gy ] ) NEW_LINE


from collections import deque NEW_LINE def bfs ( maze , visited , sy , sx , gy , gx ) : NEW_LINE INDENT queue = deque ( [ [ sy , sx ] ] ) NEW_LINE visited [ sy ] [ sx ] = 0 NEW_LINE while queue : NEW_LINE INDENT y , x = queue . popleft ( ) NEW_LINE if [ y , x ] == [ gy , gx ] : NEW_LINE INDENT return visited [ y ] [ x ] NEW_LINE DEDENT for j , k in ( [ 1 , 0 ] , [ - 1 , 0 ] , [ 0 , 1 ] , [ 0 , - 1 ] ) : NEW_LINE INDENT new_y , new_x = y + j , x + k NEW_LINE if maze [ new_y ] [ new_x ] == " . " and visited [ new_y ] [ new_x ] == - 1 : NEW_LINE INDENT visited [ new_y ] [ new_x ] = visited [ y ] [ x ] + 1 NEW_LINE queue . append ( [ new_y , new_x ] ) NEW_LINE DEDENT DEDENT DEDENT DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT R , C = map ( int , input ( ) . split ( ) ) NEW_LINE sy , sx = map ( int , input ( ) . split ( ) ) NEW_LINE gy , gx = map ( int , input ( ) . split ( ) ) NEW_LINE sy , sx , gy , gx = sy - 1 , sx - 1 , gy - 1 , gx - 1 NEW_LINE maze = [ input ( ) for i in range ( R ) ] NEW_LINE visited = [ [ - 1 ] * C for j in range ( R ) ] NEW_LINE print ( bfs ( maze , visited , sy , sx , gy , gx ) ) NEW_LINE DEDENT


from collections import deque NEW_LINE R , C = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE sy , sx = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE gy , gx = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE _d = { ' # ' : 1 , ' . ' : 0 } NEW_LINE _map = [ [ _d [ x ] for x in input ( ) ] for _ in range ( R ) ] NEW_LINE moves = [ ( 0 , 1 ) , ( 1 , 0 ) , ( 0 , - 1 ) , ( - 1 , 0 ) ] NEW_LINE dq = deque ( [ ( sy , sx , 0 ) ] ) NEW_LINE visited = set ( [ ( sy , sx ) ] ) NEW_LINE while dq : NEW_LINE INDENT y , x , dist = dq . popleft ( ) NEW_LINE for m in moves : NEW_LINE INDENT next_y = y + m [ 0 ] NEW_LINE next_x = x + m [ 1 ] NEW_LINE if next_y == gy and next_x == gx : NEW_LINE INDENT print ( dist + 1 ) NEW_LINE break NEW_LINE DEDENT if ( next_y , next_x ) not in visited : NEW_LINE INDENT if _map [ next_y - 1 ] [ next_x - 1 ] == 0 : NEW_LINE INDENT dq . append ( ( next_y , next_x , dist + 1 ) ) NEW_LINE visited . add ( ( next_y , next_x ) ) NEW_LINE DEDENT DEDENT DEDENT else : NEW_LINE INDENT continue NEW_LINE DEDENT break NEW_LINE DEDENT else : NEW_LINE INDENT print ( ' Something ▁ wrong ' ) NEW_LINE DEDENT


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 H = sc . nextInt ( ) ; int W = sc . nextInt ( ) ; int sy = sc . nextInt ( ) - 1 , sx = sc . nextInt ( ) - 1 , gy = sc . nextInt ( ) - 1 , gx = sc . nextInt ( ) - 1 ; int [ ] dx = { - 1 , 0 , 1 , 0 } ; int [ ] dy = { 0 , 1 , 0 , - 1 } ; char [ ] [ ] c = new char [ W ] [ H ] ; int [ ] [ ] step = new int [ W ] [ H ] ; for ( int i = 0 ; i < H ; i ++ ) { String s = sc . next ( ) ; for ( int j = 0 ; j < W ; j ++ ) { c [ j ] [ i ] = s . charAt ( j ) ; step [ j ] [ i ] = 100000 ; } } Deque < Point > stack = new ArrayDeque < > ( ) ; step [ sx ] [ sy ] = 0 ; stack . addFirst ( new Point ( sx , sy ) ) ; while ( stack . size ( ) > 0 ) { Point p = stack . pollFirst ( ) ; for ( int i = 0 ; i < 4 ; i ++ ) { int x = p . x + dx [ i ] ; int y = p . y + dy [ i ] ; if ( 0 <= x && x < W && 0 <= y && y < H && c [ x ] [ y ] == ' . ' ) { if ( step [ x ] [ y ] > step [ p . x ] [ p . y ] + 1 ) { stack . addFirst ( new Point ( x , y ) ) ; step [ x ] [ y ] = step [ p . x ] [ p . y ] + 1 ; } } } } out . println ( step [ gx ] [ gy ] ) ; } }


import java . awt . * ; import java . util . * ; import java . util . stream . IntStream ; public class Main { private static Scanner scanner = new Scanner ( System . in ) ; public static void main ( String [ ] $ ) { int r = scanner . nextInt ( ) , c = scanner . nextInt ( ) ; Point start = new Point ( scanner . nextInt ( ) - 1 , scanner . nextInt ( ) - 1 ) ; Point goal = new Point ( scanner . nextInt ( ) - 1 , scanner . nextInt ( ) - 1 ) ; int [ ] [ ] a = IntStream . range ( 0 , r ) . mapToObj ( j -> scanner . next ( ) . chars ( ) . map ( ch -> ch == ' # ' ? - 1 : 0 ) . toArray ( ) ) . toArray ( int [ ] [ ] :: new ) ; Queue < Point > queue = new ArrayDeque < > ( ) ; a [ start . x ] [ start . y ] ++ ; queue . add ( start ) ; while ( ! queue . isEmpty ( ) ) { Point point = queue . poll ( ) ; for ( int i = 0 ; i < 4 ; i ++ ) { try { int x1 = ( new int [ ] { - 1 , 1 , 0 , 0 } ) [ i ] , y1 = ( new int [ ] { 0 , 0 , - 1 , 1 } ) [ i ] ; if ( a [ point . x + x1 ] [ point . y + y1 ] > a [ point . x ] [ point . y ] + 1 || a [ point . x + x1 ] [ point . y + y1 ] == 0 ) { a [ point . x + x1 ] [ point . y + y1 ] = a [ point . x ] [ point . y ] + 1 ; queue . add ( new Point ( point . x + x1 , point . y + y1 ) ) ; } } catch ( ArrayIndexOutOfBoundsException e ) { } } } System . out . println ( a [ goal . x ] [ goal . y ] - 1 ) ; } }


import java . util . * ; import static java . lang . System . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int R = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int sy = sc . nextInt ( ) - 1 ; int sx = sc . nextInt ( ) - 1 ; int gy = sc . nextInt ( ) - 1 ; int gx = sc . nextInt ( ) - 1 ; String [ ] [ ] c = new String [ R ] [ C ] ; for ( int i = 0 ; i < R ; i ++ ) { c [ i ] = sc . next ( ) . split ( " " ) ; } Queue < Point > points = new ArrayDeque < Point > ( ) ; points . add ( new Point ( sy , sx , 0 ) ) ; c [ sy ] [ sx ] = " ! " ; out . println ( bfs ( c , points , new Point ( gy , gx , - 1 ) ) ) ; } public static int bfs ( String [ ] [ ] cource , Queue < Point > points , Point goal ) { Point point = points . poll ( ) ; int count = point . count ; if ( point . x == goal . x && point . y == goal . y ) { return count ; } int [ ] [ ] move = { { - 1 , 0 } , { 1 , 0 } , { 0 , - 1 } , { 0 , 1 } } ; count ++ ; for ( int i = 0 ; i < move . length ; i ++ ) { Point nextPoint = new Point ( point . y + move [ i ] [ 0 ] , point . x + move [ i ] [ 1 ] , count ) ; if ( cource [ nextPoint . y ] [ nextPoint . x ] . equals ( " . " ) ) { cource [ nextPoint . y ] [ nextPoint . x ] = " ! " ; points . add ( nextPoint ) ; } } return bfs ( cource , points , goal ) ; } } class Point { int y ; int x ; int count ; Point ( int y , int x , int count ) { this . y = y ; this . x = x ; this . count = count ; } }


import java . awt . Point ; import java . util . ArrayDeque ; import java . util . Queue ; import java . util . Scanner ; public class Main { static int INF = 10000 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Queue < Point > que = new ArrayDeque < > ( ) ; int dx [ ] = { 1 , 0 , - 1 , 0 } ; int dy [ ] = { 0 , 1 , 0 , - 1 } ; int h = sc . nextInt ( ) ; int w = sc . nextInt ( ) ; int sx = sc . nextInt ( ) - 1 ; int sy = sc . nextInt ( ) - 1 ; int gx = sc . nextInt ( ) - 1 ; int gy = sc . nextInt ( ) - 1 ; int dist [ ] [ ] = new int [ h ] [ w ] ; for ( int i = 0 ; i < h ; i ++ ) for ( int j = 0 ; j < w ; j ++ ) dist [ i ] [ j ] = INF ; char f [ ] [ ] = new char [ h ] [ w ] ; for ( int i = 0 ; i < h ; i ++ ) { f [ i ] = sc . next ( ) . toCharArray ( ) ; } dist [ sx ] [ sy ] = 0 ; que . add ( new Point ( sx , sy ) ) ; while ( ! que . isEmpty ( ) ) { Point p = que . poll ( ) ; if ( p . x == gx && p . y == gy ) break ; for ( int i = 0 ; i < 4 ; i ++ ) { int nx = p . x + dx [ i ] ; int ny = p . y + dy [ i ] ; if ( f [ nx ] [ ny ] == ' . ' && dist [ nx ] [ ny ] == INF ) { que . add ( new Point ( nx , ny ) ) ; dist [ nx ] [ ny ] = dist [ p . x ] [ p . y ] + 1 ; } } } System . out . println ( dist [ gx ] [ gy ] ) ; } }


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int max = 0 ; int min = 1000000000 ; int [ ] b = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { int a = sc . nextInt ( ) ; b [ i ] = a ; if ( max < b [ i ] ) { max = b [ i ] ; } if ( b [ i ] < min ) { min = b [ i ] ; } } System . out . println ( Math . abs ( max - min ) ) ; } }

N = int ( input ( ) ) NEW_LINE A = [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE print ( max ( A ) - min ( A ) ) NEW_LINE


import itertools NEW_LINE N = int ( input ( ) ) NEW_LINE A = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE X = 0 NEW_LINE for v in itertools . combinations ( A , 2 ) : NEW_LINE INDENT if abs ( v [ 0 ] - v [ 1 ] ) > X : NEW_LINE INDENT X = abs ( v [ 0 ] - v [ 1 ] ) NEW_LINE DEDENT DEDENT print ( X ) NEW_LINE


n = int ( input ( ) ) NEW_LINE a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE minval = 10 ** 10 NEW_LINE maxval = 0 NEW_LINE for i in range ( n ) : NEW_LINE INDENT if a [ i ] > maxval : NEW_LINE INDENT maxval = a [ i ] NEW_LINE DEDENT if a [ i ] < minval : NEW_LINE INDENT minval = a [ i ] NEW_LINE DEDENT DEDENT print ( abs ( maxval - minval ) ) NEW_LINE


N = int ( input ( ) ) NEW_LINE A = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE ans = 0 NEW_LINE for i in range ( N ) : NEW_LINE INDENT for j in range ( N ) : NEW_LINE INDENT ans = max ( A [ j ] - A [ i ] , ans ) NEW_LINE DEDENT DEDENT print ( ans ) NEW_LINE