s = list ( input ( ) ) NEW_LINE n = len ( s ) - 1 NEW_LINE ans = 0 NEW_LINE while s [ n ] != '1' : NEW_LINE INDENT ans += 1 NEW_LINE n -= 1 NEW_LINE DEDENT if n == 0 : NEW_LINE INDENT print ( ans ) NEW_LINE exit ( ) NEW_LINE DEDENT counter = 0 NEW_LINE while n >= 0 : NEW_LINE INDENT if s [ n ] != '0' : NEW_LINE INDENT counter += 1 NEW_LINE n -= 1 NEW_LINE continue NEW_LINE DEDENT ans += ( counter + 1 ) NEW_LINE s [ n ] = '1' NEW_LINE counter = 0 NEW_LINE DEDENT ans += counter + 1 NEW_LINE print ( ans ) NEW_LINE


import java . io . * ; import java . math . * ; import java . security . * ; import java . text . * ; import java . util . * ; import javafx . util . Pair ; public class CodeForce { static BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; static StringBuilder sb = new StringBuilder ( ) ; static boolean flag = false ; static int next ( String [ ] sr , int ind ) { return Integer . parseInt ( sr [ ind ] ) ; } public static void main ( String [ ] args ) throws IOException { String sr = br . readLine ( ) ; char [ ] arr = sr . toCharArray ( ) ; int i = sr . length ( ) - 1 ; int count = 0 ; while ( i > 0 ) { if ( arr [ i ] == '0' ) { count ++ ; } else { int j = i - 1 ; while ( j >= 0 && arr [ j ] != '0' ) { arr [ j ] = '0' ; j -- ; } count = count + 2 ; if ( j >= 0 ) arr [ j ] = 1 ; else { count += i ; System . out . println ( count ) ; return ; } } i -- ; } if ( arr [ 0 ] == '0' ) count ++ ; System . out . println ( count ) ; } }

a = input ( ) [ : : - 1 ] . replace ( ' ' , ' ▁ ' ) . split ( ) NEW_LINE z = len ( a ) - 1 NEW_LINE ans = 0 NEW_LINE i = 0 NEW_LINE while i < z : NEW_LINE INDENT if a [ i ] == '0' : NEW_LINE INDENT while i < z and a [ i ] == '0' : i += 1 ; ans += 1 NEW_LINE DEDENT else : NEW_LINE INDENT ans += 1 NEW_LINE while i < z and a [ i ] == '1' : i += 1 ; ans += 1 NEW_LINE if i == z : ans += 1 NEW_LINE a [ i ] = '1' NEW_LINE DEDENT DEDENT print ( ans ) NEW_LINE


import sys NEW_LINE from array import array NEW_LINE def input ( ) : NEW_LINE INDENT return sys . stdin . buffer . readline ( ) . decode ( ' utf - 8' ) NEW_LINE DEDENT x = list ( map ( int , input ( ) . rstrip ( ) ) ) NEW_LINE y = 0 NEW_LINE ans = 0 NEW_LINE while len ( x ) > 1 : NEW_LINE INDENT if x [ - 1 ] ^ y == 1 : NEW_LINE INDENT y = 1 NEW_LINE ans += 1 NEW_LINE DEDENT else : NEW_LINE INDENT y = ( x [ - 1 ] + y ) >> 1 NEW_LINE DEDENT ans += 1 NEW_LINE x . pop ( ) NEW_LINE DEDENT if y == 1 : NEW_LINE INDENT ans += 1 NEW_LINE DEDENT print ( ans ) NEW_LINE


import java . util . * ; import java . io . * ; public class Binary_Number { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter pw = new PrintWriter ( System . out ) ; int t = 1 ; while ( t -- > 0 ) { int carry = 0 ; char a [ ] = br . readLine ( ) . trim ( ) . toCharArray ( ) ; long ans = 0 ; int n = a . length ; for ( int i = n - 1 ; i > 0 ; i -- ) { int val = Integer . parseInt ( " " + a [ i ] ) + carry ; if ( val == 2 ) { ans ++ ; carry = 1 ; } else if ( val == 1 ) { ans += 2 ; carry = 1 ; } else { ans ++ ; } } int val = Integer . parseInt ( " " + a [ 0 ] ) + carry ; if ( val == 2 ) ans ++ ; pw . println ( ans ) ; } pw . flush ( ) ; } }

s = list ( input ( ) [ : : - 1 ] ) NEW_LINE i = 0 NEW_LINE l = len ( s ) NEW_LINE carry = False NEW_LINE c = 0 NEW_LINE if s . count ( '1' ) == 1 : NEW_LINE INDENT print ( l - 1 ) NEW_LINE exit ( 0 ) NEW_LINE DEDENT while i < l : NEW_LINE INDENT if s [ i ] == '1' : NEW_LINE INDENT if not carry : NEW_LINE INDENT c += 2 NEW_LINE i += 1 NEW_LINE carry = True NEW_LINE DEDENT else : NEW_LINE INDENT s [ i ] = '0' NEW_LINE c += 1 NEW_LINE i += 1 NEW_LINE DEDENT DEDENT else : NEW_LINE INDENT if carry : NEW_LINE INDENT s [ i ] = '1' NEW_LINE carry = False NEW_LINE DEDENT else : NEW_LINE INDENT c += 1 NEW_LINE i += 1 NEW_LINE DEDENT DEDENT DEDENT print ( c ) NEW_LINE


import java . util . Scanner ; public class BinaryNumber { static public void print ( String s ) { int rem = 0 ; int count = 0 ; for ( int i = s . length ( ) - 1 ; i >= 1 ; i -- ) { int x = s . charAt ( i ) - '0' ; int y = x + rem ; if ( y % 2 == 0 ) { count = count + 1 ; } else { count = count + 2 ; } if ( y != 0 ) { rem = 1 ; } else { rem = 0 ; } } System . out . print ( count + rem ) ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; print ( s ) ; } }


import java . util . Scanner ; public class GymContest { static int [ ] [ ] mem ; public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; mem = new int [ n ] [ 3 ] ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) arr [ i ] = s . nextInt ( ) ; System . out . println ( dp ( arr , 0 , 0 ) ) ;

def answer ( n , a ) : num_rest = 0 if a [ 0 ] == 0 : num_rest += 1 NEW_LINE


n = int ( input ( ) )   day = list ( map ( int , input ( ) . split ( ) ) )   inf = 10 ** 20 dp = [ [ inf for _ in range ( 3 ) ] for _ in range ( n + 5 ) ]   NEW_LINE


import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . * ; import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ;   public class Newbie {   public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskA solver = new TaskA ( ) ; int t ;


import java . util . * ;   public class Test {   static Scanner sc ; static Map < String , Integer > dp ; public static void main ( String [ ] args ) { sc = new Scanner ( System . in ) ; dp = new HashMap < > ( ) ; int t = 1 ; while ( t -- > 0 ) solve ( ) ; }   static void solve ( ) { int n = sc . nextInt ( ) ; int [ ] arr = new int [ n ] ;   for ( int i = 0 ; i < n ; i ++ ) arr [ i ] = sc . nextInt ( ) ;   int ans = 0 ; ans = rest ( 0 , 0 , arr ) ;   System . out . println ( ans ) ;   }   static int rest ( int pvs , int curr_ind , int [ ] arr ) { int ans = 0 ;   if ( curr_ind >= arr . length ) return ans ;   String key = pvs + " - " + curr_ind ; if ( dp . containsKey ( key ) ) return dp . get ( key ) ;   if ( arr [ curr_ind ] == 0 ) { ans = rest ( 0 , curr_ind + 1 , arr ) + 1 ; } else if ( arr [ curr_ind ] == 3 ) { if ( pvs == 1 ) { ans = Math . min ( 1 + rest ( 0 , curr_ind + 1 , arr ) , rest ( 2 , curr_ind + 1 , arr ) ) ; } else if ( pvs == 2 ) ans = Math . min ( rest ( 1 , curr_ind + 1 , arr ) , 1 + rest ( 0 , curr_ind + 1 , arr ) ) ; else ans = Math . min ( rest ( 1 , curr_ind + 1 , arr ) , rest ( 2 , curr_ind + 1 , arr ) ) ;   } else { if ( pvs == arr [ curr_ind ] ) ans = 1 + rest ( 0 , curr_ind + 1 , arr ) ; else ans = rest ( arr [ curr_ind ] , curr_ind + 1 , arr ) ; }   dp . put ( key , ans ) ;   return ans ;   } }


import java . util . Scanner ;   public class Main {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; String str1 = in . next ( ) ; String str2 = in . next ( ) ; char c1 , c2 ; int a1 , a2 ; int ansSum = 0 ; int arr [ ] = new int [ 26 ] ; for ( int i = 0 ; i < 26 ; i ++ ) { arr [ i ] = - 1 ; } in . close ( ) ; for ( int i = 0 ; i < str1 . length ( ) ; i ++ ) { c1 = str1 . charAt ( i ) ; c2 = str2 . charAt ( i ) ; a1 = ( int ) c1 - 97 ; a2 = ( int ) c2 - 97 ; if ( ( arr [ a2 ] != a1 || arr [ a1 ] != a2 ) && ( arr [ a1 ] != - 1 || arr [ a2 ] != - 1 ) ) { System . out . println ( - 1 ) ; return ; } else if ( a1 == a2 ) { arr [ a1 ] = a1 ; } else if ( arr [ a1 ] == - 1 && arr [ a2 ] == - 1 ) { arr [ a1 ] = a2 ; arr [ a2 ] = a1 ; ansSum ++ ; } } System . out . println ( ansSum ) ; for ( int i = 0 ; i < 26 ; i ++ ) { if ( arr [ i ] != - 1 && arr [ i ] != arr [ arr [ i ] ] ) { System . out . println ( ( char ) ( arr [ i ] + 97 ) + " ▁ " + ( char ) ( arr [ arr [ i ] ] + 97 ) ) ; arr [ arr [ i ] ] = - 1 ; arr [ i ] = - 1 ; } } }   }

first = input ( ) . strip ( ) second = input ( ) . strip ( ) mapping = dict ( ) printed = Falsefor i , letter in enumerate ( first ) : if letter == second [ i ] : mapping [ letter ] = second [ i ] else : if mapping . get ( letter ) : if mapping . get ( letter ) != second [ i ] : printed = True print ( - 1 ) break else : if first . count ( letter ) == second . count ( second [ i ] ) : mapping [ letter ] = second [ i ] else : printed = True print ( - 1 ) breakanswers = dict ( ) for k , v in mapping . items ( ) : if answers . get ( v ) : if mapping . get ( v ) == k : continue else : printed = True print ( - 1 ) break else : if k != v : answers [ k ] = v   if not printed : print ( len ( answers ) ) for k , v in answers . items ( ) : print ( k , v ) NEW_LINE


def fun ( s1 , s2 ) : if s1 == s2 : return 0 , [ ] d = { } rep = set ( ) ans = [ ] for k in range ( len ( s1 ) ) : if s1 [ k ] != s2 [ k ] : if s1 [ k ] in d and d [ s1 [ k ] ] != s2 [ k ] or s2 [ k ] in d and d [ s2 [ k ] ] != s1 [ k ] : return - 1 , [ ] if s1 [ k ] in rep or s2 [ k ] in rep : return - 1 , [ ] if s1 [ k ] not in d : ans . append ( s1 [ k ] + s2 [ k ] ) d [ s1 [ k ] ] = s2 [ k ] d [ s2 [ k ] ] = s1 [ k ] else : if s1 [ k ] in d : return - 1 , [ ] rep . add ( s1 [ k ] ) return len ( ans ) , ans s1 = input ( ) s2 = input ( ) ans , changes = fun ( s1 , s2 ) if ans < 1 : print ( ans ) else : print ( ans ) for k in range ( ans ) : print ( changes [ k ] [ 0 ] , changes [ k ] [ 1 ] ) NEW_LINE


import syss = input ( ) t = input ( ) st1 = [ ] st2 = [ ] checked = [ ] right = [ ] for i in range ( len ( s ) ) : if s [ i ] in checked and t [ i ] not in checked : print ( ' - 1' ) sys . exit ( ) if s [ i ] not in checked and t [ i ] in checked : print ( ' - 1' ) sys . exit ( ) if s [ i ] in right and t [ i ] not in right : print ( ' - 1' ) sys . exit ( ) if s [ i ] not in right and t [ i ] in right : print ( ' - 1' ) sys . exit ( ) if s [ i ] not in st1 and s [ i ] not in st2 : if t [ i ] not in st1 and t [ i ] not in st2 : if s [ i ] != t [ i ] : checked . append ( s [ i ] ) checked . append ( t [ i ] ) st1 . append ( s [ i ] ) st2 . append ( t [ i ] ) else : right . append ( s [ i ] ) right . append ( t [ i ] ) if s [ i ] == t [ i ] : if s [ i ] in st1 or s [ i ] in st2 : print ( ' - 1' ) sys . exit ( ) elif t [ i ] in st1 or t [ i ] in st2 : print ( ' - 1' ) sys . exit ( ) if s [ i ] in st2 : if st1 [ st2 . index ( s [ i ] ) ] != t [ i ] : print ( ' - 1' ) sys . exit ( ) if s [ i ] in right or t [ i ] in right : if s [ i ] != t [ i ] : print ( ' - 1' ) sys . exit ( ) print ( len ( st1 ) ) for i in range ( len ( st1 ) ) : print ( st1 [ i ] , end = " ▁ " ) print ( st2 [ i ] ) NEW_LINE


import syss = input ( ) t = input ( ) st1 = [ ] st2 = [ ] checked = [ ] right = [ ] for i in range ( len ( s ) ) : a = [ ] if s [ i ] in checked and t [ i ] not in checked : print ( ' - 1' ) sys . exit ( ) if s [ i ] not in checked and t [ i ] in checked : print ( ' - 1' ) sys . exit ( ) if s [ i ] in right and t [ i ] not in right : print ( ' - 1' ) sys . exit ( ) if s [ i ] not in right and t [ i ] in right : print ( ' - 1' ) sys . exit ( ) if s [ i ] not in st1 and s [ i ] not in st2 : if t [ i ] not in st1 and t [ i ] not in st2 : if s [ i ] != t [ i ] : checked . append ( s [ i ] ) checked . append ( t [ i ] ) st1 . append ( s [ i ] ) st2 . append ( t [ i ] ) else : right . append ( s [ i ] ) right . append ( t [ i ] ) if s [ i ] == t [ i ] : if s [ i ] in st1 or s [ i ] in st2 : print ( ' - 1' ) sys . exit ( ) elif t [ i ] in st1 or t [ i ] in st2 : print ( ' - 1' ) sys . exit ( ) if s [ i ] in st2 : if st1 [ st2 . index ( s [ i ] ) ] != t [ i ] : print ( ' - 1' ) sys . exit ( ) if s [ i ] in right or t [ i ] in right : if s [ i ] != t [ i ] : print ( ' - 1' ) sys . exit ( ) print ( len ( st1 ) ) for i in range ( len ( st1 ) ) : print ( st1 [ i ] , end = " ▁ " ) print ( st2 [ i ] ) NEW_LINE


import sys   string1 = input ( ) string2 = input ( ) st1 = [ ] st2 = [ ] checked = [ ] right = [ ] for i in range ( len ( string1 ) ) : a = [ ] if string1 [ i ] in checked and string2 [ i ] not in checked : print ( ' - 1' ) sys . exit ( ) if string1 [ i ] not in checked and string2 [ i ] in checked : print ( ' - 1' ) sys . exit ( )   if string1 [ i ] in right and string2 [ i ] not in right : print ( ' - 1' ) sys . exit ( ) if string1 [ i ] not in right and string2 [ i ] in right : print ( ' - 1' ) sys . exit ( )   if string1 [ i ] not in st1 and string1 [ i ] not in st2 : if string2 [ i ] not in st1 and string2 [ i ] not in st2 : if string1 [ i ] != string2 [ i ] : checked . append ( string1 [ i ] ) checked . append ( string2 [ i ] ) st1 . append ( string1 [ i ] ) st2 . append ( string2 [ i ] ) else : right . append ( string1 [ i ] ) right . append ( string2 [ i ] ) if string1 [ i ] == string2 [ i ] : if string1 [ i ] in st1 or string1 [ i ] in st2 : print ( ' - 1' ) sys . exit ( ) elif string2 [ i ] in st1 or string2 [ i ] in st2 : print ( ' - 1' ) sys . exit ( ) if string1 [ i ] in st2 : if st1 [ st2 . index ( string1 [ i ] ) ] != string2 [ i ] : print ( ' - 1' ) sys . exit ( ) if string1 [ i ] in right or string2 [ i ] in right : if string1 [ i ] != string2 [ i ] : print ( ' - 1' ) sys . exit ( ) print ( len ( st1 ) ) for i in range ( len ( st1 ) ) : print ( st1 [ i ] , end = " ▁ " ) print ( st2 [ i ] ) NEW_LINE


import java . io . * ; import java . math . BigInteger ; import java . util . * ;   public class icpc { public static void main ( String [ ] args ) throws IOException {


import java . io . * ; import java . util . * ;   public class A {   static final boolean stdin = true ; static final String filename = " " ; static FastScanner br ; static PrintWriter pw ;   public static void main ( String [ ] args ) throws IOException {   if ( stdin ) { br = new FastScanner ( ) ; pw = new PrintWriter ( new OutputStreamWriter ( System . out ) ) ; } else { br = new FastScanner ( filename + " . in " ) ; pw = new PrintWriter ( new FileWriter ( filename + " . out " ) ) ; }   Solver solver = new Solver ( ) ; solver . solve ( br , pw ) ; }   static class Solver { public void solve ( FastScanner br , PrintWriter pw ) throws IOException { char [ ] a = br . nextToken ( ) . toCharArray ( ) , b = br . nextToken ( ) . toCharArray ( ) ; int c = a . length ; boolean poss = true ; ArrayList < Character > d = new ArrayList < Character > ( ) ; for ( int i = 0 ; i < c ; i ++ ) { if ( a [ i ] != b [ i ] ) { if ( d . contains ( a [ i ] ) || d . contains ( b [ i ] ) ) { poss = false ; break ; } d . add ( a [ i ] ) ; d . add ( b [ i ] ) ; for ( int j = 0 ; j < c ; j ++ ) { if ( b [ j ] == d . get ( d . size ( ) - 1 ) ) { b [ j ] = d . get ( d . size ( ) - 2 ) ; } else if ( b [ j ] == d . get ( d . size ( ) - 2 ) ) { b [ j ] = d . get ( d . size ( ) - 1 ) ; } } }


import java . util . * ;   public class CodeForces698 {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ;

n , k = map ( int , input ( ) . split ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) diff = max ( l ) - min ( l ) if diff == 0 : print ( 0 , 0 ) elif diff == 1 : print ( 1 , 0 ) else : s = 0 ans = [ ] while ( s < k ) : x = l . index ( min ( l ) ) y = l . index ( max ( l ) ) if max ( l ) - min ( l ) <= 1 : break else :   s += 1 l [ x ] += 1 l [ y ] -= 1 ans . append ( [ y + 1 , x + 1 ] ) print ( max ( l ) - min ( l ) , s ) for i in range ( len ( ans ) ) : print ( * ans [ i ] ) NEW_LINE


towers , operationsNum = map ( int , input ( ) . split ( ) ) towersHeights = list ( map ( int , input ( ) . split ( ) ) ) changes = [ ] for i in range ( operationsNum ) : minH , maxH = min ( towersHeights ) , max ( towersHeights ) instability = max ( towersHeights ) - min ( towersHeights ) minindex , maxindex = towersHeights . index ( minH ) , towersHeights . index ( maxH ) if instability != 0 : changes . append ( str ( maxindex + 1 ) + " ▁ " + str ( minindex + 1 ) ) towersHeights [ minindex ] += 1 towersHeights [ maxindex ] -= 1 print ( max ( towersHeights ) - min ( towersHeights ) , len ( changes ) ) for i in changes : print ( i ) NEW_LINE


''' ▁ ▁ ▁ ▁ Problem ▁ Link ▁ https : / / codeforces . com / contest / 479 / problem / B '''   n , k = map ( int , input ( ) . split ( ) ) towers = list ( map ( int , input ( ) . split ( ) ) )   def get_min_max_indices ( ) : tmp = towers [ 0 ] max_index = 0 min_index = 0 for i in range ( 1 , len ( towers ) ) : if ( towers [ i ] > towers [ max_index ] ) : max_index = i if ( towers [ i ] < towers [ min_index ] ) : min_index = i return min_index , max_index   tracks = [ ] for i in range ( k ) : min_index , max_index = get_min_max_indices ( ) if ( towers [ min_index ] == towers [ max_index ] ) : break towers [ max_index ] -= 1 towers [ min_index ] += 1 tracks . append ( [ max_index + 1 , min_index + 1 ] )   lowest_point , highest_point = get_min_max_indices ( ) print ( towers [ highest_point ] - towers [ lowest_point ] , len ( tracks ) )   for record in tracks : print ( * record ) NEW_LINE


numOfTowers , numOfOperations = map ( int , input ( ) . split ( ) ) heights = list ( map ( int , input ( ) . split ( ) ) ) l = [ ] for i in range ( numOfOperations ) : max_index = heights . index ( max ( heights ) ) min_index = heights . index ( min ( heights ) )   if min_index != max_index : heights [ max_index ] -= 1 heights [ min_index ] += 1 l . append ( [ max_index + 1 , min_index + 1 ] )   print ( max ( heights ) - min ( heights ) , len ( l ) ) for j in l : print ( ' ▁ ' . join ( map ( str , j ) ) ) NEW_LINE


n , k = map ( int , input ( ) . split ( ) )   heights = list ( map ( int , input ( ) . split ( ) ) ) stabilities = [ max ( heights ) - min ( heights ) ] pos = [ ( 0 , 0 ) ]   for i in range ( k ) : higher = heights . index ( max ( heights ) ) lower = heights . index ( min ( heights ) ) heights [ higher ] -= 1 heights [ lower ] += 1 stabilities . append ( max ( heights ) - min ( heights ) ) pos . append ( ( higher + 1 , lower + 1 ) )   smallest = min ( stabilities ) operations = stabilities . index ( smallest )   print ( smallest , operations ) for i in range ( operations ) : print ( * pos [ i + 1 ] ) NEW_LINE


import java . io . BufferedReader ; import java . io . * ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . StringTokenizer ; import java . util . * ; import java . math . * ; public class Main { 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 ; } } public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; PrintWriter pw = new PrintWriter ( System . out ) ; int t = 1 ;


import java . io . * ; import java . util . * ;   public class Dpairs {   public static void main ( String [ ] args ) throws IOException { BufferedReader ob = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringBuffer sb = new StringBuffer ( ) ; String s [ ] = ob . readLine ( ) . split ( " ▁ " ) ; int n = Integer . parseInt ( s [ 0 ] ) ; int k = Integer . parseInt ( s [ 1 ] ) ; int cpy = 0 ; String str [ ] = ob . readLine ( ) . split ( " ▁ " ) ; int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = Integer . parseInt ( str [ i ] ) ;


import java . io . BufferedReader ; import java . io . * ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . StringTokenizer ; import java . util . * ; import java . math . * ; public class Main { 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 ; } } public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; PrintWriter pw = new PrintWriter ( System . out ) ; int t = 1 ;


import java . util . * ;   public class Q4 {   public static void main ( String [ ] args ) {

n = int ( input ( ) ) m = 0 while n > 0 : d = n % 10 if d == 4 or d == 7 : m += 1 n = n // 10 if m == 4 or m == 7 : print ( " YES " ) else : print ( " NO " ) NEW_LINE


n = input ( ) k = n . count ( '4' ) + n . count ( '7' ) if k == 4 or k == 7 : print ( " YES " ) else : print ( " NO " ) NEW_LINE


n = input ( ) c = 0 for i in n : if ( i == '4' or i == '7' ) : c += 1 if ( c == 4 or c == 7 ) : print ( ' YES ' ) else : print ( ' NO ' ) NEW_LINE


print ( " NYOE ▁ S " [ sum ( i in '47' for i in input ( ) ) in ( 4 , 7 ) : : 2 ] ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class A_Nearly_Lucky_Number { public static void main ( String [ ] args ) { FastScanner fs = new FastScanner ( ) ; char [ ] s = fs . next ( ) . toCharArray ( ) ;   int lucky = 0 ; for ( char c : s ) { if ( c == '4' || c == '7' ) { lucky ++ ; } }   System . out . println ( ( lucky == 4 || lucky == 7 ) ? " YES " : " NO " ) ; }   static int min ( int a , int b ) { return Math . min ( a , b ) ; }   static int max ( int a , int b ) { return Math . max ( a , b ) ; }   static long min ( long a , long b ) { return Math . min ( a , b ) ; }   static long max ( long a , long b ) { return Math . max ( a , b ) ; }   static class FastScanner { BufferedReader br ; StringTokenizer st ;   public FastScanner ( ) { 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 ( ) ) ; } char nextChar ( ) { return next ( ) . charAt ( 0 ) ; }   String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } }


import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) throws java . lang . Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s = ( br . readLine ( ) ) ; int c = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == '4' || s . charAt ( i ) == '7' ) { c ++ ; } } if ( c == 4 || c == 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } }


import java . io . * ; import java . util . Scanner ; public class Solution { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; if ( System . getProperty ( " ONLINE _ JUDGE " ) == null ) { try { System . setOut ( new PrintStream ( new FileOutputStream ( " output . txt " ) ) ) ; sc = new Scanner ( new File ( " input . txt " ) ) ; } catch ( Exception e ) { } }


import java . util . Scanner ;   public class StupidBusPrice { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ;   int n = scanner . nextInt ( ) ; int m = scanner . nextInt ( ) ;   if ( n == 0 ) { if ( m == 0 ) System . out . println ( "0 ▁ 0" ) ; else System . out . println ( " Impossible " ) ; return ; }   if ( m > n ) { System . out . print ( m + " ▁ " ) ; System . out . println ( n + m - 1 ) ; } else { System . out . print ( n + " ▁ " ) ; if ( m > 1 ) System . out . println ( n + m - 1 ) ; else System . out . println ( n ) ; } } }

arr = list ( map ( int , input ( ) . split ( ) ) ) n = arr [ 0 ] m = arr [ 1 ] if ( n == 0 and m > 0 ) : print ( " Impossible " ) else : a = max ( m , n ) b = m + n - 1 if ( m == 0 ) : b = n a = n print ( str ( a ) + " ▁ " + str ( b ) ) NEW_LINE


n , m = map ( int , input ( ) . split ( ) ) if m == 0 : print ( n , n ) elif n == 0 : print ( ' Impossible ' ) else : print ( max ( n , m ) , n + m - 1 ) NEW_LINE


n , m = map ( int , input ( ) . split ( ) )   if n == 0 : if m == 0 : print ( '0 ▁ 0' ) else : print ( ' Impossible ' )   else : if m == 0 : print ( str ( n ) + ' ▁ ' + str ( n ) ) NEW_LINE


n , m = map ( int , input ( ) . split ( ) ) if n == 0 : if m == 0 : print ( 0 , 0 ) else : print ( " Impossible " ) else : print ( n + max ( 0 , m - n ) , n + max ( 0 , m - 1 ) ) NEW_LINE


import java . util . * ;    public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; int m = input . nextInt ( ) ;


import java . util . * ; import java . util . stream . Collectors ; import java . lang . * ; import java . io . * ; public class Problem { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; if ( n == 0 && m > 0 ) System . out . println ( " Impossible " ) ; else if ( m == 0 ) { System . out . println ( n + " ▁ " + n ) ; } else { int max = 0 , min = n * m ; if ( n >= m ) { min = n ; max = ( n - 1 ) + m ; } else { min = m ; max = n - 1 + m ; } System . out . println ( min + " ▁ " + max ) ; } }   }


import java . util . Scanner ; public class Main { public static boolean notSqr ( int num ) { return ( num < 0 ) ? true : Math . sqrt ( num ) > ( int ) Math . sqrt ( num ) ; } public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) , i , k = - 1 ; int [ ] a = new int [ 1000 ] ; for ( i = 0 ; i < n ; i ++ ) { a [ i ] = scan . nextInt ( ) ; if ( notSqr ( a [ i ] ) ) k = ( k == - 1 ) ? i : ( ( a [ i ] > a [ k ] ) ? i : k ) ; } System . out . println ( a [ k ] ) ; } }

import math   n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) mx = - 10000000 for num in l : if ( num < 0 ) : mx = max ( mx , num ) else : k = int ( math . sqrt ( num ) ) if ( k * k < num ) : mx = max ( mx , num ) print ( mx ) NEW_LINE


import mathn = int ( input ( ) ) s = list ( map ( int , input ( ) . strip ( ) . split ( ) ) ) s . sort ( reverse = True ) for i in s : if i >= 0 : t = math . sqrt ( i ) if t != int ( t ) : print ( i ) break else : print ( i ) break NEW_LINE


import mathdef check ( x ) : y = int ( math . sqrt ( x ) ) if ( x == y * y ) : return False return Truen = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) a . sort ( ) for i in range ( n - 1 , - 1 , - 1 ) : if ( a [ i ] < 0 or check ( a [ i ] ) ) : print ( a [ i ] ) break NEW_LINE


num = int ( input ( ) ) arr = sorted ( map ( int , input ( ) . split ( ) ) )     for n in arr : if n < 0 : ans = n else : x = int ( n ** 0.5 ) if n != x * x : ans = n   print ( ans )     NEW_LINE


n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) mx = - 10000000 for num in l : if ( num < 0 ) : mx = max ( mx , num ) beg = 0 end = 1000 while ( beg <= end ) : mid = beg + ( end - beg ) // 2 if ( mid * mid <= num ) : beg = mid + 1 else : end = mid - 1 if ( end * end < num ) : mx = max ( mx , num ) print ( mx ) NEW_LINE


import java . util . * ;    public class Main {   public static void main ( String [ ] args ) {


import java . util . Arrays ; import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int [ ] nums = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { nums [ i ] = scanner . nextInt ( ) ; } Arrays . sort ( nums ) ; for ( int i = n - 1 ; i >= 0 ; i -- ) { if ( ( Math . sqrt ( nums [ i ] ) % 1 ) != 0 ) { System . out . println ( nums [ i ] ) ; break ; } } } }


import java . util . * ; public class PerfectSquare { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int a [ ] = new int [ n ] ; int max = - ( int ) Math . pow ( 10 , 6 ) ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; if ( ! isPerfect ( a [ i ] ) ) { if ( a [ i ] > max ) { max = a [ i ] ; } } } System . out . println ( max ) ; } static boolean isPerfect ( int n ) { double b = Math . sqrt ( n ) ; if ( b == ( int ) b ) return true ; else return false ; } }


import java . util . Scanner ;   public class LoveTriangle {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int planesNumber = sc . nextInt ( ) ;   sc . nextLine ( ) ;

n = int ( input ( ) ) f = [ 1 ] + list ( map ( int , input ( ) . split ( ) ) ) for i in range ( 1 , n + 1 ) : if f [ f [ f [ i ] ] ] == i : print ( ' Yes ' ) breakelse : print ( ' No ' ) NEW_LINE


import sys   stdin = sys . stdininf = 1 << 60 mod = 1000000007 eps = 1e-10   sys . setrecursionlimit ( 10 ** 7 )   ni = lambda : int ( ns ( ) ) nin = lambda y : [ ni ( ) for _ in range ( y ) ] na = lambda : list ( map ( int , stdin . readline ( ) . split ( ) ) ) nan = lambda y : [ na ( ) for _ in range ( y ) ] ns = lambda : stdin . readline ( ) . rstrip ( ) nsn = lambda y : [ ns ( ) for _ in range ( y ) ] nas = lambda : stdin . readline ( ) . split ( )   n = ni ( ) a = list ( map ( lambda x : x - 1 , na ( ) ) )   ok = Falsefor i in range ( n ) : A = i B = a [ A ] C = a [ B ] if A != B and B != C and A != C and a [ C ] == A : ok = True   if ok : print ( " YES " ) else : print ( " NO " ) NEW_LINE


n = int ( input ( ) ) l = [ ] a = ( input ( ) . split ( " ▁ " ) ) NEW_LINE


import java . util . Scanner ;   public class Problem25 {   public static void main ( String [ ] args ) {


import java . util . * ;    public class Triangle {   static class Edge { int v , u ; public Edge ( int v , int u ) { this . v = v ; this . u = u ; } } public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; int n = scn . nextInt ( ) ; int [ ] [ ] adj = new int [ n ] [ n ] ; LinkedList < Edge > edges = new LinkedList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { int v = scn . nextInt ( ) - 1 ; adj [ i ] [ v ] = 1 ; adj [ v ] [ i ] = 1 ; edges . add ( new Edge ( i , v ) ) ; } for ( Edge e : edges ) for ( int i = 0 ; i < n ; i ++ ) if ( adj [ i ] [ e . v ] == 1 && adj [ i ] [ e . u ] == 1 ) { System . out . println ( " YES " ) ; return ; } System . out . println ( " NO " ) ; } }


import java . util . * ;   public class CodeForces990B { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) , k = input . nextInt ( ) ; int ans = 0 ; List < Integer > list = new ArrayList < > ( ) ; int [ ] count = new int [ 1000000 * 4 ] ; for ( int i = 0 ; i < n ; i ++ ) { int x = input . nextInt ( ) ; list . add ( x ) ; count [ x ] ++ ; } Collections . sort ( list ) ; for ( int i = n - 1 ; i >= 1 ; i -- ) { if ( list . get ( i ) > list . get ( i - 1 ) && list . get ( i ) <= list . get ( i - 1 ) + k ) ans += count [ list . get ( i - 1 ) ] ; } System . out . println ( n - ans ) ; } }

n , k = map ( int , input ( ) . split ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) l . sort ( ) a = 0 i = 0 while i < ( n - 1 ) : j = i + 1 while j < n and l [ j ] == l [ i ] : j += 1 if j == n : break else : if l [ j ] <= l [ i ] + k : a += ( j - i ) i = jprint ( n - a ) NEW_LINE


n , K = map ( int , input ( ) . split ( ) ) b = sorted ( [ int ( x ) for x in input ( ) . split ( ) ] ) l = cur = 0 for i in range ( 1 , n ) : if b [ i ] == b [ i - 1 ] : continue if b [ i ] > b [ i - 1 ] + K : l = i else : cur += ( i - l ) ; l = iprint ( n - cur ) NEW_LINE


n , k = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) j = 0 a . sort ( ) n1 = nfor i in range ( n ) : while a [ j ] < a [ i ] : if a [ i ] <= a [ j ] + k : n1 -= 1 j += 1 print ( n1 ) NEW_LINE


n , k = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) a . sort ( ) slow , fast = 0 , 0 while fast < n : if a [ slow ] == a [ fast ] : fast += 1 elif abs ( a [ slow ] - a [ fast ] ) <= k : a [ slow ] = 0 slow += 1 else : slow += 1 ans = 0 for i in a : if i != 0 : ans += 1 print ( ans ) NEW_LINE


import com . sun . security . jgss . GSSUtil ;   import javax . swing . table . AbstractTableModel ; import java . io . * ; import java . util . * ; import java . util . concurrent . atomic . AtomicReferenceFieldUpdater ;


import java . io . * ; import java . util . * ; public class Asd { static PrintWriter w = new PrintWriter ( System . out ) ; static FastScanner s = new FastScanner ( ) ; public static void main ( String [ ] args ) { int t = 1 ;


import java . util . * ; public class contest10 { static Scanner scn = new Scanner ( System . in ) ;

n , m = map ( int , input ( ) . split ( ) ) A = [ list ( map ( int , input ( ) . split ( ) ) ) for i in range ( n ) ] B = [ list ( map ( int , input ( ) . split ( ) ) ) for i in range ( n ) ]   X = [ [ 0 ] * m for i in range ( n ) ] Y = [ [ 0 ] * m for i in range ( n ) ]   for i in range ( n ) : for j in range ( m ) : X [ i ] [ j ] = min ( A [ i ] [ j ] , B [ i ] [ j ] ) Y [ i ] [ j ] = max ( A [ i ] [ j ] , B [ i ] [ j ] )   NEW_LINE


N , M = map ( int , input ( ) . split ( ) ) mat1 = [ list ( map ( int , input ( ) . split ( ) ) ) for i in range ( N ) ] mat2 = [ list ( map ( int , input ( ) . split ( ) ) ) for i in range ( N ) ]   ans = ' Possible ' for r in range ( N ) : for c in range ( M ) : bigger_v = max ( mat1 [ r ] [ c ] , mat2 [ r ] [ c ] ) smaller_v = min ( mat1 [ r ] [ c ] , mat2 [ r ] [ c ] ) if r > 0 : bigger_prev = max ( mat1 [ r - 1 ] [ c ] , mat2 [ r - 1 ] [ c ] ) smaller_prev = min ( mat1 [ r - 1 ] [ c ] , mat2 [ r - 1 ] [ c ] ) if not ( bigger_v > bigger_prev and smaller_v > smaller_prev ) : ans = ' Impossible ' break if c > 0 : bigger_prev = max ( mat1 [ r ] [ c - 1 ] , mat2 [ r ] [ c - 1 ] ) smaller_prev = min ( mat1 [ r ] [ c - 1 ] , mat2 [ r ] [ c - 1 ] ) if not ( bigger_v > bigger_prev and smaller_v > smaller_prev ) : NEW_LINE


a , b = map ( int , input ( ) . split ( ) ) flag = 0 l1 = [ ] l2 = [ ] for i in range ( a * 2 ) : l3 = list ( map ( int , input ( ) . split ( ) ) ) if i < a : l1 . append ( l3 ) else : l2 . append ( l3 ) for x in range ( b ) : if l1 [ i - a ] [ x ] > l2 [ i - a ] [ x ] : l1 [ i - a ] [ x ] , l2 [ i - a ] [ x ] = l2 [ i - a ] [ x ] , l1 [ i - a ] [ x ] if x > 0 and ( l1 [ i - a ] [ x ] <= l1 [ i - a ] [ x - 1 ] or l2 [ i - a ] [ x ] <= l2 [ i - a ] [ x - 1 ] ) : flag = 1 if flag : print ( ' Impossible ' ) exit ( ) for x in range ( b ) : for i in range ( a - 1 ) : if l1 [ i ] [ x ] >= l1 [ i + 1 ] [ x ] or l2 [ i ] [ x ] >= l2 [ i + 1 ] [ x ] : print ( ' Impossible ' ) exit ( ) print ( ' Possible ' ) NEW_LINE


def check ( a , n , m ) : for i in range ( n ) :   if ( sorted ( a [ i ] ) != a [ i ] or len ( a [ i ] ) != len ( set ( a [ i ] ) ) ) : return 0   return 1   n , m = map ( int , input ( ) . split ( ) ) a = [ ] b = [ ] a1 = [ ] b1 = [ ] for i in range ( m ) : a1 . append ( [ 0 ] * n ) b1 . append ( [ 0 ] * n ) for i in range ( n ) : l = [ int ( x ) for x in input ( ) . split ( ) ] a . append ( l ) for i in range ( n ) : l = [ int ( x ) for x in input ( ) . split ( ) ] b . append ( l )     for i in range ( n ) : for j in range ( m ) : x = a [ i ] [ j ] y = b [ i ] [ j ] a [ i ] [ j ] = min ( x , y ) b [ i ] [ j ] = max ( x , y )     for i in range ( n ) : for j in range ( m ) : a1 [ j ] [ i ] = a [ i ] [ j ] b1 [ j ] [ i ] = b [ i ] [ j ]     if ( check ( a , n , m ) == 1 and check ( a1 , m , n ) == 1 and check ( b , n , m ) == 1 and check ( b1 , m , n ) == 1 ) : print ( " Possible " ) else : print ( " Impossible " ) NEW_LINE


def inp ( ) : return map ( int , input ( ) . split ( ) )   def check ( arr , n , m ) : for i in range ( n ) : for j in range ( 1 , m ) : if arr [ i ] [ j ] <= arr [ i ] [ j - 1 ] : return 1 for i in range ( m ) : for j in range ( 1 , n ) : if arr [ j ] [ i ] <= arr [ j - 1 ] [ i ] : return 1 return 0   n , m = inp ( ) arr = [ ] for i in range ( n ) : arr . append ( list ( inp ( ) ) ) brr = [ ] for i in range ( n ) : brr . append ( list ( inp ( ) ) ) for i in range ( n ) : for j in range ( m ) : if arr [ i ] [ j ] > brr [ i ] [ j ] : x = arr [ i ] [ j ] arr [ i ] [ j ] = brr [ i ] [ j ] brr [ i ] [ j ] = xf = check ( arr , n , m ) | check ( brr , n , m ) if f == 1 : print ( " Impossible " ) else : print ( " Possible " ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ;   public class Codeforces {   private static final Scanner sc = new Scanner ( System . in ) ; private static final BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; private static final long MOD = ( long ) ( 1e9 + 7 ) ;   public static int [ ] LPS ( String p ) { int [ ] lps = new int [ p . length ( ) ] ;   int i = 1 ; int j = 0 ; while ( i < p . length ( ) ) { if ( p . charAt ( i ) == p . charAt ( j ) ) { lps [ i ] = j + 1 ; i ++ ; j ++ ; } else { if ( j == 0 ) { lps [ i ] = 0 ; i ++ ; } else { j = lps [ j - 1 ] ; } } } return lps ; }   public static void KMP ( String text , String pattern ) { int [ ] lps = LPS ( pattern ) ; int i = 0 ; int j = 0 ; ArrayList < Integer > matches = new ArrayList < > ( ) ; while ( i < text . length ( ) ) { if ( text . charAt ( i ) == pattern . charAt ( j ) ) { i ++ ; j ++ ; } else { if ( j != 0 ) { j = lps [ j - 1 ] ; } else { i ++ ; } } if ( j == pattern . length ( ) ) { matches . add ( i - j ) ; j = lps [ j - 1 ] ; } } for ( int x : matches ) { System . out . println ( " Match ▁ at ▁ : ▁ " + x ) ; } }   private static class SegmentTree { private long [ ] st ; private int size ; private int n ; private long [ ] a ; SegmentTree ( long [ ] a , int n ) { this . size = 4 * n ; this . n = n ; this . a = a ; st = new long [ size ] ;


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 ; FastReader in = new FastReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; BDoubleMatrix solver = new BDoubleMatrix ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }   static class BDoubleMatrix { public void solve ( int testNumber , FastReader in , PrintWriter out ) { int n = in . nextInt ( ) , m = in . nextInt ( ) ; int [ ] [ ] a = new int [ n ] [ m ] ; int [ ] [ ] b = new int [ n ] [ m ] ; int [ ] [ ] min = new int [ n ] [ m ] ; int [ ] [ ] max = new int [ n ] [ m ] ; in . readArray ( a ) ; in . readArray ( b ) ; for ( int i = 0 ; i < n ; ++ i ) { for ( int j = 0 ; j < m ; ++ j ) { min [ i ] [ j ] = Math . min ( a [ i ] [ j ] , b [ i ] [ j ] ) ; max [ i ] [ j ] = Math . max ( a [ i ] [ j ] , b [ i ] [ j ] ) ; } }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . * ;   public class Main {   public static boolean check ( String Number , String Divi ) { for ( int i = 0 ; i <= 9 ; i ++ ) { String ch = i + " " ; if ( Number . contains ( ch ) && Divi . contains ( ch ) ) { return true ; } } return false ; }   public static void main ( String [ ] args ) throws IOException { FastScanner input = new FastScanner ( ) ; int n = input . nextInt ( ) ; String a [ ] = new String [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = input . next ( ) ; } for ( int i = 0 ; i < a [ 0 ] . length ( ) ; i ++ ) { for ( int j = 0 ; j < n - 1 ; j ++ ) { if ( a [ j ] . charAt ( i ) != a [ j + 1 ] . charAt ( i ) ) { System . out . println ( i ) ; return ; } } }   }   static class FastScanner {   BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( " " ) ;   String next ( ) { while ( ! st . hasMoreTokens ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   int [ ] readArray ( int n ) { int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = nextInt ( ) ; } return a ; }   long nextLong ( ) {   return Long . parseLong ( next ( ) ) ; }   double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } }   }

n = int ( input ( ) ) s1 = input ( ) s2 = input ( ) mi = 0 for j in range ( len ( s1 ) ) : if s1 [ j ] != s2 [ j ] : mi = j breaktemp = s2for j in range ( n - 2 ) : s3 = input ( ) for i in range ( len ( temp ) ) : if temp [ i ] != s3 [ i ] : mi = min ( i , mi ) break temp = s3print ( mi ) NEW_LINE


num = int ( input ( ) ) arr , arr2 = ( [ ] , [ ] ) i = 0 for x in range ( num ) : nums = input ( ) while len ( arr ) < len ( nums ) : arr . append ( set ( ) ) for y in range ( len ( nums ) ) : arr [ y ] . add ( nums [ y ] ) y = 0 for z in range ( len ( arr ) ) : if len ( arr [ z ] ) == 1 and i == z : arr2 . append ( arr [ z ] ) i += 1 else : breakif len ( nums ) > 1 : print ( len ( arr2 ) ) else : print ( 0 ) NEW_LINE


n = int ( input ( ) )   str1 = str ( input ( ) ) ctr = len ( str1 ) for i in range ( 2 , n + 1 ) : strn = str ( input ( ) ) ans = 0 for j in range ( ctr ) : if str1 [ j ] != strn [ j ] : break else : ans += 1 ctr = ans     print ( ctr ) NEW_LINE


a = int ( input ( ) ) c = [ ]   cnt = 0 for i in range ( a ) : c . append ( input ( ) )   for i in range ( 0 , len ( c [ 0 ] ) ) : b = 0 for j in range ( 1 , a ) : if c [ j ] [ i ] == c [ 0 ] [ i ] : b += 1 else : break if b == a - 1 : cnt += 1 else : breakprint ( cnt )                                                           NEW_LINE


cases = int ( input ( ) )   numbers = [ ] while cases : cases -= 1 s = input ( ) numbers . append ( s )   numbers . sort ( )   ct = 0   for i , j in zip ( numbers [ 0 ] , numbers [ - 1 ] ) : if i == j : ct += 1 else : print ( ct ) break NEW_LINE


import java . util . * ; import java . lang . * ; import java . io . * ;   public class Main { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner sx = new Scanner ( System . in ) ; int n = sx . nextInt ( ) ; int i = 1 ; String s1 = sx . next ( ) ;


import java . util . * ; import java . io . * ; import java . lang . * ;   public class MainClass { private static BufferedReader br = null ; private static StringTokenizer st = null ; static { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } private static String str ( ) throws IOException { return br . readLine ( ) ; } private static int ints ( ) throws IOException { return Integer . parseInt ( br . readLine ( ) ) ; } private static int [ ] ints ( int N ) throws IOException { st = new StringTokenizer ( br . readLine ( ) ) ; int [ ] nums = new int [ N ] ; for ( int i = 0 ; i < N ; i += 1 ) { nums [ i ] = Integer . parseInt ( st . nextToken ( ) ) ; } return nums ; } public static void main ( String [ ] args ) throws IOException { int N = ints ( ) ; String [ ] nums = new String [ N ] ; for ( int i = 0 ; i < N ; i += 1 ) { nums [ i ] = str ( ) ; } Solution obj = new Solution ( ) ; System . out . println ( obj . longestcommonPrefix ( nums , N ) ) ; } }   class Solution { public int longestcommonPrefix ( String [ ] nums , int N ) { String first = nums [ 0 ] ; int length = first . length ( ) ; String prefix = " " ; for ( int i = 0 ; i < length ; i += 1 ) { boolean isFound = true ; String curr_pre = first . substring ( 0 , i + 1 ) ; for ( int j = 1 ; j < N && isFound ; j += 1 ) { if ( ! nums [ j ] . startsWith ( curr_pre ) ) isFound = false ; } if ( isFound ) prefix = curr_pre ; if ( ! isFound ) return prefix . length ( ) ; } return prefix . length ( ) ; } }


import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; String [ ] array = new String [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { array [ i ] = scan . next ( ) ; } int count = 0 ; for ( int i = 0 ; i < array [ 0 ] . length ( ) ; i ++ ) { for ( int j = 0 ; j < array . length ; j ++ ) { if ( array [ 0 ] . charAt ( i ) != array [ j ] . charAt ( i ) ) { System . out . println ( count ) ; return ; } } count ++ ; } } }


import java . util . * ; public class P2 {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String s [ ] = new String [ n ] ; boolean flag = true ; int c = 0 ; for ( int i = 0 ; i < n ; i ++ ) s [ i ] = sc . next ( ) ; for ( int i = 0 ; i < s [ 0 ] . length ( ) ; i ++ ) { for ( int j = 0 ; j < n - 1 ; j ++ ) { if ( s [ j ] . charAt ( i ) == s [ j + 1 ] . charAt ( i ) ) { continue ; } else { flag = false ; break ; } } if ( flag ) { c ++ ; } else { break ; } } System . out . println ( c ) ; } }


import java . util . Scanner ;   public class NewYearandDays {   public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; String s = scan . nextLine ( ) ; String [ ] a = s . split ( " ▁ " , - 1 ) ;   int n = Integer . valueOf ( a [ 0 ] ) ; if ( a [ 2 ] . equals ( " month " ) ) { if ( n == 31 ) { System . out . println ( "7" ) ; } else if ( n > 29 ) { System . out . println ( "11" ) ; } else { System . out . println ( "12" ) ; } } else { int p = 366 / 7 ; if ( n == 5 || n == 6 ) { ++ p ; } System . out . println ( p ) ;   } }   }

s = list ( input ( ) . split ( ) )   if s [ - 1 ] == " week " : if s [ 0 ] in "56" : print ( 53 ) else : print ( 52 ) else : if int ( s [ 0 ] ) == 31 : print ( 7 ) elif int ( s [ 0 ] ) == 30 : print ( 11 ) else : print ( 12 ) NEW_LINE


M = [ 31 ] * 7 + [ 30 ] * 4 + [ 29 ] ; n , _ , s = input ( ) . split ( ) ; print ( 52 + ( n in '56' ) if s > ' n ' else sum ( i >= int ( n ) for i in M ) ) NEW_LINE


s = input ( ) . split ( ) x = int ( s [ 0 ] ) if s [ - 1 ] == ' month ' : if x == 31 : print ( 7 ) elif x == 30 : print ( 11 ) else : print ( 12 ) else : print ( 52 if ( x < 5 or x > 6 ) else 53 ) NEW_LINE


s = input ( ) . split ( ) days = 366   if s [ 2 ] == ' week ' : ans = 52 if int ( s [ 0 ] ) == 5 or int ( s [ 0 ] ) == 6 : ans += 1 print ( ans )   else : if int ( s [ 0 ] ) == 31 : print ( 7 ) elif int ( s [ 0 ] ) == 30 : print ( 11 )   else : print ( 12 ) NEW_LINE


import java . util . Scanner ;     public class JavaApplication173 {      public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ;   int n = sc . nextInt ( ) ; String s1 = sc . next ( ) ; String s2 = sc . next ( ) ;   if ( s2 . charAt ( 0 ) == ' w ' ) { int x = 0 ; int current = 5 ; for ( int i = 0 ; i < 366 ; i ++ ) { if ( current == n ) { x ++ ; } current ++ ; if ( current > 7 ) { current = 1 ; } } System . out . println ( x ) ; return ; } else { switch ( n ) { case 30 : System . out . println ( 11 ) ; break ; case 31 : System . out . println ( 7 ) ; break ; default : System . out . println ( 12 ) ; break ; } }   } }


import java . util . Scanner ;   public class Candy { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; sc . next ( ) ; String s = sc . next ( ) ; sc . close ( ) ;   if ( s . equals ( " week " ) ) { if ( n == 5 || n == 6 ) System . out . println ( 53 ) ; else System . out . println ( 52 ) ; } else { if ( n <= 29 ) System . out . println ( 12 ) ; else if ( n == 30 ) System . out . println ( 11 ) ; else System . out . println ( 7 ) ; }   } }


import java . util . Scanner ;   public class NewYearAndDays { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; String str = input . nextLine ( ) ;   input . close ( ) ;   StringBuffer num = new StringBuffer ( ) ;   if ( Character . isDigit ( str . charAt ( 0 ) ) && Character . isDigit ( str . charAt ( 1 ) ) ) num . append ( str . charAt ( 0 ) ) . append ( str . charAt ( 1 ) ) ; else num . append ( str . charAt ( 0 ) ) ; int number = Integer . parseInt ( num . toString ( ) ) ;   if ( str . contains ( " month " ) ) { if ( number <= 29 ) System . out . println ( 12 ) ; else if ( number == 30 ) System . out . println ( 11 ) ; else System . out . println ( 7 ) ; } else { if ( number == 5 || number == 6 ) System . out . println ( 53 ) ; else System . out . println ( 52 ) ; } } }


import java . util . Scanner ;   public class NYDays { public static void main ( String [ ] args ) {   Scanner in = new Scanner ( System . in ) ; int x = in . nextInt ( ) ; String s = in . nextLine ( ) ;   in . close ( ) ; System . out . println ( s . charAt ( s . length ( ) - 1 ) == ' k ' ? x == 5 || x == 6 ? 53 : 52 : x < 30 ? 12 : x < 31 ? 11 : 7 ) ; } }


import java . util . * ; public class square { public static void main ( String ar [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String d = sc . next ( ) ; char [ ] dir = d . toCharArray ( ) ; int [ ] jumps = new int [ n ] ; for ( int j = 0 ; j < n ; j ++ ) jumps [ j ] = sc . nextInt ( ) ; HashSet < Integer > visited = new HashSet ( ) ; visited . add ( 0 ) ; int curr = 0 ; while ( true ) { if ( dir [ curr ] == ' < ' ) curr = curr - jumps [ curr ] ; else if ( dir [ curr ] == ' > ' ) curr = curr + jumps [ curr ] ; if ( curr < 0 || curr >= n ) { System . out . println ( " FINITE " ) ; return ; } else if ( visited . contains ( curr ) ) { System . out . println ( " INFINITE " ) ; return ; } visited . add ( curr ) ; } } }

n = int ( input ( ) ) s = input ( ) r = lambda : list ( map ( int , input ( ) . split ( ) ) ) arr = r ( )     f = Truevisited = set ( ) pos = 0 while 1 : if pos < 0 or pos >= n : break   if pos in visited : f = False break   visited . add ( pos ) if s [ pos ] == ' > ' : pos += arr [ pos ] else : pos -= arr [ pos ]     print ( " FINITE " if f else " INFINITE " )     NEW_LINE


if __name__ == ' _ _ main _ _ ' : Y = lambda : list ( map ( int , input ( ) . split ( ) ) ) N = lambda : int ( input ( ) )   n = N ( ) s = input ( ) a = Y ( ) nxt , ans = 0 , 0   for i in range ( n ) : nxt += [ a [ nxt ] , - a [ nxt ] ] [ s [ nxt ] == ' < ' ] if nxt >= n or nxt < 0 : ans = 2 break print ( " INFINITE " [ ans : ] ) NEW_LINE


if __name__ == ' _ _ main _ _ ' : Y = lambda : list ( map ( int , input ( ) . split ( ) ) ) N = lambda : int ( input ( ) )   n = N ( ) s = input ( ) a = Y ( ) nxt , ans = 0 , 0   for i in range ( n ) : nxt += a [ nxt ] if s [ nxt ] == ' > ' else - a [ nxt ] if nxt >= n or nxt < 0 : ans = 2 break print ( " INFINITE " [ ans : ] ) NEW_LINE


n = int ( input ( ) ) s = input ( ) d = { } a = list ( map ( int , input ( ) . split ( ) ) ) for i in range ( n ) : d [ i + 1 ] = 1 * a [ i ] if s [ i ] == ' > ' else - 1 * a [ i ] cell = 1 for i in range ( n ) : cell += ( d [ cell ] ) if cell < 1 or cell > n : print ( " FINITE " ) breakelse : print ( " INFINITE " ) NEW_LINE


n = int ( input ( ) ) s = input ( ) a = list ( map ( int , input ( ) . split ( ) ) ) k = 0 i = 0 while k < n * 4 : if s [ i ] == ' > ' : k += a [ i ] i += a [ i ] else : k += a [ i ] i -= a [ i ] if i < 0 or i >= n : exit ( print ( " FINITE " ) )   print ( " INFINITE " ) NEW_LINE


import com . sun . org . apache . bcel . internal . generic . AALOAD ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . math . BigInteger ; import java . util . * ; import java . util . stream . IntStream ; import javafx . util . Pair ;   public class Main {   static void sort ( int a [ ] ) { Random ran = new Random ( ) ; for ( int i = 0 ; i < a . length ; i ++ ) { int r = ran . nextInt ( a . length ) ; int temp = a [ r ] ; a [ r ] = a [ i ] ; a [ i ] = temp ; }   Arrays . sort ( a ) ; }   public static void main ( String [ ] args ) throws IOException {   Scanner input = new Scanner ( System . in ) ;   int n = input . nextInt ( ) ; String s = input . next ( ) ; int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = input . nextInt ( ) ; } int count = 0 ; for ( int i = 0 ; i < n ; ) { if ( count > n ) { System . out . println ( " INFINITE " ) ; return ; } count ++ ; if ( s . charAt ( i ) == ' > ' ) { if ( ( i + 1 + a [ i ] ) > n ) { System . out . println ( " FINITE " ) ; return ; } else { i = ( i + a [ i ] ) ; } } else if ( s . charAt ( i ) == ' < ' ) { if ( ( ( i + 1 ) - a [ i ] ) <= 0 ) { System . out . println ( " FINITE " ) ; return ; } else { i = i - a [ i ] ; } } } System . out . println ( " INFINITE " ) ; }   }


import java . util . * ; public class BeforeAnExam { public static void main ( String arg [ ] ) { Scanner sc = new Scanner ( System . in ) ; int d = sc . nextInt ( ) ; int sumhours = sc . nextInt ( ) ; int [ ] [ ] ar = new int [ d ] [ 2 ] ; int maxSum = 0 , minSum = 0 ; for ( int i = 0 ; i < d ; i ++ ) { ar [ i ] [ 0 ] = sc . nextInt ( ) ; ar [ i ] [ 1 ] = sc . nextInt ( ) ; maxSum += ar [ i ] [ 1 ] ; minSum += ar [ i ] [ 0 ] ; }    if ( sumhours > maxSum || sumhours < minSum ) { System . out . println ( " NO " ) ; System . exit ( 0 ) ; }   int [ ] dayHours = new int [ d ] ; for ( int i = 0 ; i < d ; i ++ ) { dayHours [ i ] = ar [ i ] [ 1 ] - ar [ i ] [ 0 ] ; }   int [ ] res = new int [ d ] ; int temp = 0 ; for ( int i = 0 ; i < d ; i ++ ) { temp += ar [ i ] [ 0 ] ; res [ i ] = ar [ i ] [ 0 ] ; }    System . out . println ( " YES " ) ; if ( ( temp == sumhours ) ) { for ( int i = 0 ; i < d ; i ++ ) { System . out . print ( res [ i ] + " ▁ " ) ; } } else { int req = sumhours - temp ; for ( int i = 0 ; i < d ; i ++ ) { if ( dayHours [ i ] - req >= 0 ) { res [ i ] += req ; break ; } else { req = req - dayHours [ i ] ; res [ i ] += dayHours [ i ] ;   }   }     for ( int i = 0 ; i < d ; i ++ ) System . out . print ( res [ i ] + " ▁ " ) ; }         } }

d , sum_time = map ( int , input ( ) . split ( ) )   min_tim = [ ] max_tim = [ ] for i in range ( d ) : min_time , max_time = map ( int , input ( ) . split ( ) ) min_tim . append ( min_time ) max_tim . append ( max_time ) alloted_sum_time = sum ( min_tim ) for j in range ( len ( min_tim ) ) : if alloted_sum_time < sum_time : x = min ( max_tim [ j ] - min_tim [ j ] , sum_time - alloted_sum_time ) alloted_sum_time += x NEW_LINE


a = [ ] b = [ ] result = [ ] n , s = map ( int , input ( ) . split ( ) ) for i in range ( n ) : c , d = map ( int , input ( ) . split ( ) ) a . append ( c ) result . append ( c ) b . append ( d ) if sum ( a ) <= s <= sum ( b ) : print ( ' YES ' ) remain = s - sum ( a ) for i in range ( n ) : if b [ i ] - a [ i ] <= remain : result [ i ] = b [ i ] remain -= b [ i ] - a [ i ] else : result [ i ] = a [ i ] + remain break for i in result : print ( i , end = ' ▁ ' ) else : print ( ' NO ' ) NEW_LINE


d , sumTime = map ( int , input ( ) . split ( ) ) min_Time = [ ] max_Time = [ ] for i in range ( 0 , d ) : tmp , tmp1 = map ( int , input ( ) . split ( ) ) min_Time . append ( tmp ) max_Time . append ( tmp1 ) res = [ ] if ( sum ( min_Time ) <= sumTime and sum ( max_Time ) >= sumTime ) : remaining_Time = sumTime - sum ( min_Time ) for i in range ( 0 , d ) : res . append ( min_Time [ i ] ) for i in range ( 0 , d ) : if ( remaining_Time == 0 ) : break else : res [ i ] = min ( remaining_Time + min_Time [ i ] , max_Time [ i ] ) remaining_Time -= res [ i ] - min_Time [ i ] print ( " YES " ) for i in range ( 0 , d ) : print ( res [ i ] ) else : print ( " NO " ) NEW_LINE


study_days , sum_of_times = map ( int , input ( ) . split ( ) ) minimals , maximals = [ ] , [ ] for _ in range ( study_days ) : least , most = map ( int , input ( ) . split ( ) ) minimals . append ( least ) maximals . append ( most ) lowest_sum , highest_sum = sum ( minimals ) , sum ( maximals ) if lowest_sum <= sum_of_times <= highest_sum : print ( " YES " ) difference_from_minimum = sum_of_times - lowest_sum index = 0 while difference_from_minimum : if minimals [ index ] < maximals [ index ] : minimals [ index ] += 1 difference_from_minimum -= 1 else : index += 1 print ( " ▁ " . join ( str ( x ) for x in minimals ) ) else : print ( " NO " ) NEW_LINE


def proB ( arr , k ) : sumi = 0 for i in arr : sumi += i [ 0 ] if ( sumi > k ) : print ( ' NO ' ) else : k -= sumi ans = [ ] for i in arr : ans . append ( i [ 0 ] ) if ( i [ 1 ] - i [ 0 ] >= k ) : ans [ - 1 ] += k k = 0 else : ans [ - 1 ] += i [ 1 ] - i [ 0 ] k -= i [ 1 ] - i [ 0 ] if ( k > 0 ) : print ( ' NO ' ) else : print ( ' YES ' ) print ( * ans ) t , k = list ( map ( int , input ( ) . split ( ) ) ) arr = [ ] for i in range ( t ) : arr1 = list ( map ( int , input ( ) . split ( ) ) ) arr . append ( arr1 ) proB ( arr , k ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . StringTokenizer ;   public class BeforeAnExam { public static void main ( String [ ] args ) { FastReader ( ) ; int t = 1 ; while ( t > 0 ) { solve ( ) ; -- t ; } write . flush ( ) ; write . close ( ) ; } static void solve ( ) { int d = ni ( ) , st = ni ( ) ; int mins = 0 ; int maxs = 0 ; int [ ] min = new int [ d ] ; int [ ] max = new int [ d ] ; for ( int i = 0 ; i < d ; ++ i ) { min [ i ] = ni ( ) ; max [ i ] = ni ( ) ; mins = mins + min [ i ] ; maxs = maxs + max [ i ] ; } if ( st < mins || st > maxs ) { out ( " NO " ) ; } else { out ( " YES " ) ; if ( st == mins ) { for ( int e : min ) { ou ( e + " ▁ " ) ; } } else { int rem = st - mins ; for ( int i = 0 ; i < d ; ++ i ) { if ( rem <= ( max [ i ] - min [ i ] ) ) { min [ i ] = min [ i ] + rem ; rem = 0 ; break ; } else {   rem = rem - ( max [ i ] - min [ i ] ) ; min [ i ] = max [ i ] ; } } for ( int e : min ) { ou ( e + " ▁ " ) ; } } } }


import java . util . * ;   public class BeforeAnExam_B {   public static void main ( String [ ] args ) {


import java . util . HashSet ; import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { int d , sum_time ; int min [ ] = new int [ 100 ] ; int max [ ] = new int [ 100 ] ; int total_max = 0 ; int total_min = 0 ; int [ ] ans = new int [ 100 ] ; int sum = 0 ; int sum_min = 0 ; Scanner in = new Scanner ( System . in ) ; d = in . nextInt ( ) ; sum_time = in . nextInt ( ) ; for ( int i = 1 ; i <= d ; i ++ ) { min [ i ] = in . nextInt ( ) ; max [ i ] = in . nextInt ( ) ; total_max += max [ i ] ; total_min += min [ i ] ; } if ( total_max < sum_time || total_min > sum_time ) { System . out . println ( " NO " ) ; } else { System . out . println ( " YES " ) ; sum_time -= total_min ; int total = 0 ; for ( int i = 1 ; i <= d ; i ++ ) { max [ i ] -= min [ i ] ; total += max [ i ] ; } total -= max [ 1 ] ; for ( int i = 1 ; i <= d ; i ++ ) {


import java . util . * ;   public class solucion2 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int d = scan . nextInt ( ) ; int hs = scan . nextInt ( ) ; int hmin = 0 ; int hmax = 0 ; int [ ] hminarray = new int [ d ] ; int [ ] hmaxarray = new int [ d ] ; for ( int i = 0 ; i < d ; i ++ ) { hminarray [ i ] = scan . nextInt ( ) ; hmin += hminarray [ i ] ; hmaxarray [ i ] = scan . nextInt ( ) ; hmax += hmaxarray [ i ] ; } if ( hs >= hmin && hs <= hmax ) { System . out . println ( " YES " ) ; int reparto = hs - hmin ; for ( int i = 0 ; i < d ; i ++ ) { if ( reparto > hmaxarray [ i ] - hminarray [ i ] ) { reparto -= ( hmaxarray [ i ] - hminarray [ i ] ) ; hminarray [ i ] = hmaxarray [ i ] ; } else { hminarray [ i ] += reparto ; reparto = 0 ; } } for ( int i = 0 ; i < d ; i ++ ) { System . out . print ( hminarray [ i ] + " ▁ " ) ; } } else System . out . println ( " NO " ) ; } }


import java . io . IOException ; import java . util . * ; public class VitayAgain { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int arr [ ] = new int [ n ] ; for ( int i = 0 ; i < arr . length ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; } if ( arr [ n - 1 ] == 15 ) { System . out . println ( " DOWN " ) ; return ; } else if ( arr [ n - 1 ] == 0 ) { System . out . println ( " UP " ) ; return ; } if ( n == 1 ) { System . out . println ( - 1 ) ; return ; } System . out . println ( arr [ arr . length - 1 ] > arr [ arr . length - 2 ] ? " UP " : " DOWN " ) ; } }

n = int ( input ( ) )   days = [ int ( bruh ) for bruh in input ( ) . split ( ) ]   if days [ - 1 ] == 15 : print ( " DOWN " ) exit ( )   if days [ - 1 ] == 0 : print ( " UP " ) exit ( )   if len ( days ) == 1 : print ( - 1 ) exit ( )   if days [ - 1 ] < days [ - 2 ] : print ( " DOWN " ) exit ( )   if days [ - 1 ] > days [ - 2 ] : print ( " UP " ) exit ( )     NEW_LINE


n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) if n == 1 : if a [ - 1 ] == 15 : print ( ' DOWN ' ) elif a [ - 1 ] == 0 : print ( ' UP ' ) else : print ( - 1 ) elif a [ - 1 ] > a [ - 2 ] : if a [ - 1 ] != 15 : print ( ' UP ' ) else : print ( ' DOWN ' ) else : if a [ - 1 ] != 0 : print ( ' DOWN ' ) else : print ( ' UP ' ) NEW_LINE


t = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) )   if len ( a ) == 1 : if a [ 0 ] == 0 : print ( ' UP ' ) elif a [ 0 ] == 15 : print ( ' DOWN ' ) else : print ( - 1 ) quit ( )   last = a [ - 1 ] prev = a [ - 2 ]   if last == 0 or ( last > prev and last != 15 ) : print ( ' UP ' ) else : print ( ' DOWN ' ) NEW_LINE


n = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) if arr [ n - 1 ] == 15 : print ( " DOWN " ) elif arr [ n - 1 ] == 0 : print ( ' UP ' ) elif n == 1 : print ( - 1 ) else : if arr [ n - 2 ] > arr [ n - 1 ] : print ( ' DOWN ' ) else : print ( " UP " ) NEW_LINE


n = int ( input ( ) ) l = [ int ( x ) for x in input ( ) . split ( ) ]   ans = - 1 if l [ - 1 ] == 15 : ans = ' DOWN ' elif l [ - 1 ] == 0 : ans = ' UP ' elif n == 1 : passelif n > 1 : if l [ - 2 ] > l [ - 1 ] : ans = ' DOWN ' else : ans = ' UP '     print ( ans ) NEW_LINE


import java . util . * ;   public class Main {   public static void main ( String [ ] args ) { int n ; int [ ] num = new int [ 100 ] ; Scanner input = new Scanner ( System . in ) ; n = input . nextInt ( ) ; for ( int i = 1 ; i <= n ; i ++ ) { num [ i ] = input . nextInt ( ) ; } if ( num [ n ] == 15 ) { System . out . println ( " DOWN " ) ; } else if ( num [ n ] == 0 ) { System . out . println ( " UP " ) ; } else if ( n == 1 && num [ n ] != 15 && num [ n ] != 0 ) { System . out . println ( - 1 ) ; } else if ( num [ n ] > num [ n - 1 ] ) { System . out . println ( " UP " ) ; } else if ( num [ n ] < num [ n - 1 ] ) { System . out . println ( " DOWN " ) ; } } }


import java . util . Scanner ;   public class B1409 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int T = in . nextInt ( ) ; for ( int t = 0 ; t < T ; t ++ ) { int A = in . nextInt ( ) ; int B = in . nextInt ( ) ; int X = in . nextInt ( ) ; int Y = in . nextInt ( ) ; int N = in . nextInt ( ) ; long answer = Math . min ( solve ( A , B , X , Y , N ) , solve ( B , A , Y , X , N ) ) ; System . out . println ( answer ) ; } }   static long solve ( int A , int B , int X , int Y , int N ) { int delta = Math . min ( A - X , N ) ; A -= delta ; N -= delta ; delta = Math . min ( B - Y , N ) ; B -= delta ; return A * ( long ) B ; }   }

for _ in range ( int ( input ( ) ) ) : a , b , x , y , n = map ( int , input ( ) . split ( ) ) NEW_LINE z = max ( ( a - n ) , x ) NEW_LINE t = max ( ( b - ( n - a + z ) ) , y ) NEW_LINE l = max ( ( b - n ) , y ) NEW_LINE q = max ( a - ( n - b + l ) , x ) NEW_LINE print ( min ( z * t , l * q ) ) NEW_LINE


t = int ( input ( ) )   for tc in range ( t ) : a , b , x , y , n = map ( int , input ( ) . split ( ) ) NEW_LINE a1 , b1 , n1 = a , b , n NEW_LINE a2 , b2 , n2 = a , b , n   if n1 > ( a1 - x ) : n1 -= ( a1 - x ) NEW_LINE a1 -= ( a1 - x ) NEW_LINE if n1 > ( b1 - y ) : b1 -= ( b1 - y ) NEW_LINE n1 -= ( b1 - y ) else : b1 -= n1 else : a1 -= n1 NEW_LINE n1 = 0   if n2 > ( b2 - y ) : n2 -= ( b2 - y ) NEW_LINE b2 -= ( b2 - y ) NEW_LINE if n2 > ( a2 - x ) : a2 -= ( a2 - x ) NEW_LINE n2 -= ( a2 - x ) else : a2 -= n2 else : b2 -= n2 NEW_LINE n2 = 0   print ( min ( a1 * b1 , a2 * b2 ) )   NEW_LINE


for _ in range ( int ( input ( ) ) ) : a , b , x , y , n = map ( int , input ( ) . split ( ) ) NEW_LINE a1 = max ( x , a - n ) NEW_LINE b1 = max ( y , b - ( n - ( a - a1 ) ) ) NEW_LINE b2 = max ( y , b - n ) NEW_LINE a2 = max ( x , a - ( n - ( b - b2 ) ) ) NEW_LINE print ( min ( a1 * b1 , a2 * b2 ) ) NEW_LINE


for _ in range ( int ( input ( ) ) ) : a , b , x , y , n = map ( int , input ( ) . split ( ) ) NEW_LINE n1 = min ( a - x , n ) NEW_LINE n2 = min ( b - y , n - n1 ) NEW_LINE res1 = ( a - n1 ) * ( b - n2 ) NEW_LINE n1 = min ( b - y , n ) NEW_LINE n2 = min ( a - x , n - n1 ) NEW_LINE res2 = ( a - n2 ) * ( b - n1 ) NEW_LINE print ( min ( res1 , res2 ) ) NEW_LINE


import java . util . Scanner ;   public class _0841MinimumProduct {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t > 0 ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; int temp1a = a ; int temp1b = b ; int diff = 0 ; int tempn = n ; diff = Math . min ( tempn , ( a - x ) ) ; temp1a -= diff ; tempn -= diff ; diff = Math . min ( tempn , ( b - y ) ) ; temp1b -= diff ; tempn -= diff ; tempn = n ; int temp2a = a ; int temp2b = b ; diff = 0 ; diff = Math . min ( tempn , ( b - y ) ) ; temp2b -= diff ; tempn -= diff ; diff = Math . min ( tempn , ( a - x ) ) ; temp2a -= diff ; tempn -= diff ; System . out . println ( Math . min ( 1L * temp2a * temp2b * 1L , 1L * temp1b * temp1a * 1L ) ) ; t -- ; } }   }


import java . util . * ; public class _1409B { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; long res1 = 0 , res2 = 0 , a1 , b1 , a2 , b2 ; a1 = Math . max ( a - n , x ) ; b1 = Math . max ( b - Math . max ( n - ( a - x ) , 0 ) , y ) ; a2 = Math . max ( b - n , y ) ; b2 = Math . max ( a - Math . max ( n - ( b - y ) , 0 ) , x ) ; System . out . println ( Math . min ( a1 * b1 , a2 * b2 ) ) ; } } }


import java . io . * ; import java . math . * ; import java . util . * ;        public class Main {   private static int dx [ ] = { 1 , 0 , - 1 , 0 } ; private static int dy [ ] = { 0 , - 1 , 0 , 1 } ; private static int dx1 [ ] = { 1 , 1 , 0 , - 1 , - 1 , - 1 , 0 , 1 } ; private static int dy1 [ ] = { 0 , - 1 , - 1 , - 1 , 0 , 1 , 1 , 1 } ;   private static final long INF = ( long ) Math . pow ( 10 , 16 ) ; private static final int INT_INF = Integer . MAX_VALUE ; private static final long NEG_INF = Long . MIN_VALUE ; private static final int NEG_INT_INF = Integer . MIN_VALUE ; private static final double EPSILON = 1e-10 ;   private static final long MAX = ( long ) 1e12 ; private static final long MOD = 1000000007 ;   private static final int MAXN = 200001 ; private static final int MAXA = 1000004 ; private static final int MAXLOG = 22 ; private static final double PI = Math . acos ( - 1 ) ; public static void main ( String [ ] args ) throws IOException {   InputReader in = new InputReader ( System . in ) ;


import java . io . * ; import java . util . * ;   public class B {   public static void main ( String [ ] args ) throws FileNotFoundException { FastScanner fs = new FastScanner ( ) ; FastOutput fo = new FastOutput ( ) ; long initial_time = System . currentTimeMillis ( ) ; int testcases = fs . nextInt ( ) ; for ( int tt = 0 ; tt < testcases ; tt ++ ) {


import java . util . * ;   public class CodeForces710A { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; String s = input . next ( ) ; int x = s . charAt ( 0 ) - ' a ' ; int y = Integer . parseInt ( s . charAt ( 1 ) + " " ) ; boolean bool = false ; boolean bool2 = false ;   if ( x == 0 || x == 7 ) { bool = true ; } if ( y == 1 || y == 8 ) { bool2 = true ; }   if ( bool && bool2 ) { System . out . println ( 3 ) ; } else if ( bool || bool2 ) { System . out . println ( 5 ) ; } else { System . out . println ( 8 ) ; } } }

import sys   def main ( ) : s = sys . stdin . read ( ) . strip ( ) if s in { ' a1' , ' a8' , ' h1' , ' h8' } : return 3 if any ( i in s for i in '18ah ' ) : return 5 return 8   print ( main ( ) ) NEW_LINE


z = ' abcdefgh ' a = input ( ) b = z . find ( a [ 0 ] ) + 1 c = int ( a [ 1 ] ) if b == 1 or b == 8 : if c == 1 or c == 8 : print ( 3 ) else : print ( 5 ) else : if c == 1 or c == 8 : print ( 5 ) else : print ( 8 ) NEW_LINE


import sysinput = sys . stdin . readline   pozicia = input ( ) if pozicia [ 0 ] == " a " or pozicia [ 0 ] == " h " : if pozicia [ 1 ] == "1" or pozicia [ 1 ] == "8" : print ( 3 ) else : print ( 5 ) elif pozicia [ 1 ] == "1" or pozicia [ 1 ] == "8" : print ( 5 ) else : print ( 8 ) NEW_LINE


from sys import stdin , stdout   def main ( ) : s = stdin . readline ( ) [ : - 1 ] x = int ( s [ 1 ] ) if ord ( s [ 0 ] ) > ord ( ' a ' ) and ord ( s [ 0 ] ) < ord ( ' h ' ) : if x > 1 and x < 8 : stdout . write ( '8 \n ' ) else : stdout . write ( '5 \n ' ) else : if x > 1 and x < 8 : stdout . write ( '5 \n ' ) else : stdout . write ( '3 \n ' )   if __name__ == " _ _ main _ _ " : main ( ) NEW_LINE


import java . util . * ; public class P2 {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; int c = s . charAt ( 0 ) - 96 ; int r = s . charAt ( 1 ) - 48 ;


import java . lang . * ; import java . util . * ;   public class Main {   public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; StringBuilder t = new StringBuilder ( sc . nextLine ( ) ) ; char i = t . charAt ( 0 ) ; int n = Integer . parseInt ( String . valueOf ( t . charAt ( 1 ) ) ) ; int m = 8 ; if ( ( n == 1 || n == 8 ) && ( i == ' a ' || i == ' h ' ) ) { System . out . println ( 3 ) ; } else if ( n == 1 || n == 8 ) { System . out . println ( 5 ) ; } else if ( i == ' a ' || i == ' h ' ) { System . out . println ( 5 ) ; } else { System . out . println ( 8 ) ; }   } }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ;   public class CF710A {   public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String in = br . readLine ( ) ; char first = in . charAt ( 0 ) ; int second = in . charAt ( 1 ) - '0' ; if ( ( first == ' a ' || first == ' h ' ) && ( second == 1 || second == 8 ) ) { System . out . println ( 3 ) ; } else if ( ( ( first == ' a ' || first == ' h ' ) ) || ( ( second == 8 || second == 1 ) ) ) { System . out . println ( 5 ) ; } else { System . out . println ( 8 ) ; } }   }


import java . io . * ; import java . util . * ;   public class Codeforces { public static void main ( String [ ] args ) throws IOException { Scanner in = new Scanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ;   int n = in . nextInt ( ) ; StringBuilder st = new StringBuilder ( ) ; st . append ( " < 3" ) ; for ( int i = 0 ; i < n ; i ++ ) { st . append ( in . next ( ) ) ; st . append ( " < 3" ) ; } String all = st . toString ( ) ; String s = in . next ( ) ; int i = 0 ; for ( Character c : s . toCharArray ( ) ) { if ( i < all . length ( ) && c . equals ( all . charAt ( i ) ) ) { i ++ ; } } if ( i == all . length ( ) ) { out . println ( " yes " ) ; } else { out . println ( " no " ) ; } out . flush ( ) ; }   static class Pair { int x , y ;   Pair ( int a , int b ) { x = a ; y = b ; } }   static class Scanner { StringTokenizer st ; BufferedReader br ;   public Scanner ( InputStream s ) { br = new BufferedReader ( new InputStreamReader ( s ) ) ; }   public String next ( ) throws IOException { while ( st == null || ! st . hasMoreTokens ( ) ) st = new StringTokenizer ( br . readLine ( ) ) ; return st . nextToken ( ) ; }   public int nextInt ( ) throws IOException { return Integer . parseInt ( next ( ) ) ; }   public long nextLong ( ) throws IOException { return Long . parseLong ( next ( ) ) ; }   public String nextLine ( ) throws IOException { return br . readLine ( ) ; }   public boolean ready ( ) throws IOException { return br . ready ( ) ; } } }

n = int ( input ( ) ) ts = [ input ( ) for i in range ( n ) ] t = ' < 3' + ' < 3' . join ( ts ) + ' < 3' s = input ( ) i = 0j = 0 while i < len ( t ) and j < len ( s ) : if t [ i ] == s [ j ] : i += 1 j += 1 print ( i == len ( t ) and ' yes ' or ' no ' ) NEW_LINE


n = int ( input ( ) ) s = ' < 3' + ' < 3' . join ( [ input ( ) for i in range ( n ) ] ) + ' < 3' idx = 0 for i in input ( ) : if len ( s ) > idx and s [ idx ] == i : idx += 1 if len ( s ) > idx : print ( " no " ) else : print ( " yes " ) NEW_LINE


n = int ( input ( ) ) l = [ ] for i in range ( n ) : l . append ( input ( ) ) s = input ( ) stage = 0 cur = 0 curpos = 0 f = 0 for j in range ( len ( s ) ) : i = s [ j ] curword = l [ cur ] if stage == 0 and i == " < " : stage = 1 elif stage == 1 and i == "3" : stage = 2 if stage == 2 : if i == curword [ curpos ] : curpos += 1 if curpos == len ( curword ) : cur += 1 curpos = 0 stage = 0 if cur == len ( l ) : for k in range ( j + 1 , len ( s ) ) : if s [ k ] == " < " and f == 0 : f = 1 if s [ k ] == "3" and f == 1 : f = 2 break   if cur == len ( l ) and f == 2 : print ( " yes " ) else : print ( " no " ) NEW_LINE


length = int ( input ( ) )   message = [ ]   for i in range ( 0 , length ) : message . append ( input ( ) )   nmessage = " < 3"   for i in range ( 0 , length ) : nmessage += message [ i ] nmessage += " < 3"   encoded_message = input ( )   for i in encoded_message : if len ( nmessage ) != 0 : if i == nmessage [ 0 ] : nmessage = nmessage [ 1 : ]   if len ( nmessage ) == 0 : print ( " yes " ) else : print ( " no " ) NEW_LINE


t = ' < 3' + ' < 3' . join ( input ( ) for i in range ( int ( input ( ) ) ) ) + ' < 3' p = input ( ) s = " yes " j = 0 for c in t : j = p . find ( c , j ) + 1 if j == 0 : s = ' no ' breakprint ( s ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . Comparator ; import java . util . HashMap ; import java . util . HashSet ; import java . util . LinkedList ; import java . util . List ; import java . util . Map ; import java . util . Map . Entry ; import java . util . PriorityQueue ; import java . util . Queue ; import java . util . Scanner ; import java . util . Set ; import java . util . Stack ; import java . util . StringTokenizer ; import java . util . TreeMap ; import java . util . TreeSet ; import java . util . Vector ;     public class Codeforces { 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 ; } }

t = int ( input ( ) ) NEW_LINE d = dict ( ) NEW_LINE ans = ' ' NEW_LINE for i in range ( t ) : n , m = map ( int , input ( ) . split ( ) ) NEW_LINE d . clear ( ) NEW_LINE a = [ ] NEW_LINE for i in range ( n ) : x = input ( ) . split ( ) NEW_LINE a . append ( x ) NEW_LINE d [ x [ 0 ] ] = i NEW_LINE


import sys NEW_LINE input = sys . stdin . readlinefor NEW_LINE _ in ' A ' * int ( input ( ) ) : n , m = map ( int , input ( ) . split ( ) ) NEW_LINE c = [ 0 ] * ( n * m + 1 ) NEW_LINE r = [ 0 ] * ( n * m + 1 ) NEW_LINE matrix = [ [ 0 ] * m for i in range ( n ) ] NEW_LINE for i in range ( n ) : row = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE for j in range ( m ) : c [ row [ j ] ] = j NEW_LINE for j in range ( m ) : column = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE for i in range ( n ) : r [ column [ i ] ] = i NEW_LINE for i in range ( 1 , n * m + 1 ) : matrix [ r [ i ] ] [ c [ i ] ] = i NEW_LINE for i in range ( n ) : print ( * matrix [ i ] ) NEW_LINE


input = __import__ ( ' sys ' ) . stdin . readlinefor NEW_LINE _ in range ( int ( input ( ) ) ) : n , m = map ( int , input ( ) . split ( ) ) NEW_LINE rows = [ ] NEW_LINE g = { } NEW_LINE for i in range ( n ) : row = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE rows . append ( row ) NEW_LINE for j in range ( m ) : g [ row [ j ] ] = i NEW_LINE res = [ ] NEW_LINE ans = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE for i in range ( n ) : res . append ( g [ ans [ i ] ] ) NEW_LINE for _ in range ( m - 1 ) : input ( ) NEW_LINE for i in res : print ( * rows [ i ] ) NEW_LINE


from sys import stdininput = stdin . readline   t = int ( input ( ) ) NEW_LINE for _ in range ( t ) : n , m = [ int ( x ) for x in input ( ) . split ( ) ] NEW_LINE a = [ [ int ( x ) for x in input ( ) . split ( ) ] for _ in range ( n ) ] NEW_LINE b = [ [ int ( x ) for x in input ( ) . split ( ) ] for _ in range ( m ) ] NEW_LINE d = [ 0 ] * ( n * m ) NEW_LINE for y in range ( n ) : for NEW_LINE x in range ( m ) : d [ a [ y ] [ x ] - 1 ] = y NEW_LINE ans = [ ] NEW_LINE for i in b [ 0 ] : ans . append ( a [ d [ i - 1 ] ] ) NEW_LINE for i in ans : print ( * i ) NEW_LINE


import sysinput = sys . stdin . readlinet = int ( input ( ) ) NEW_LINE for _ in range ( t ) : n , m = map ( int , input ( ) . split ( ) ) NEW_LINE row = [ ] NEW_LINE col = [ ] NEW_LINE for i in range ( n ) : row . append ( list ( map ( int , input ( ) . split ( ) ) ) ) NEW_LINE for i in range ( m ) : col . append ( list ( map ( int , input ( ) . split ( ) ) ) ) NEW_LINE for i in col [ 0 ] : for NEW_LINE j in row : NEW_LINE if i in j : print ( * j ) NEW_LINE


import java . io . * ; import java . util . * ; import java . math . * ;      public class Test {   public static void process ( ) throws IOException { int n = ni ( ) ; int m = ni ( ) ; HashMap < Integer , ArrayList < Integer > > map = new HashMap < Integer , ArrayList < Integer > > ( ) ; HashSet < Integer > set = new HashSet < Integer > ( ) ; for ( int i = 1 ; i <= n ; i ++ ) { ArrayList < Integer > list = new ArrayList < Integer > ( ) ; for ( int j = 1 ; j <= m ; j ++ ) { list . add ( ni ( ) ) ; } map . put ( list . get ( 0 ) , list ) ; set . add ( list . get ( 0 ) ) ; } ArrayList < ArrayList < Integer > > cols = new ArrayList < ArrayList < Integer > > ( ) ; for ( int i = 1 ; i <= m ; i ++ ) { ArrayList < Integer > list = new ArrayList < Integer > ( ) ; for ( int j = 1 ; j <= n ; j ++ ) { list . add ( ni ( ) ) ; } cols . add ( list ) ; } int i = 0 ; for ( i = 0 ; i < cols . size ( ) ; i ++ ) { if ( set . containsAll ( cols . get ( i ) ) ) { break ; } } for ( Integer x : cols . get ( i ) ) { ArrayList < Integer > list = map . get ( x ) ; for ( Integer z : list ) { p ( z + " ▁ " ) ; } pn ( " " ) ;   } }    static AnotherReader sc ; static PrintWriter out ; public static void main ( String [ ] args ) throws IOException { out = new PrintWriter ( System . out ) ; sc = new AnotherReader ( ) ; boolean oj = true ;


import java . io . * ; import java . lang . * ; import java . util . * ;   public class b { static BufferedReader f ; static StringTokenizer st ; static StringBuilder ans = new StringBuilder ( ) ; public static void tc ( ) throws IOException { st = new StringTokenizer ( f . readLine ( ) ) ; int n = Integer . parseInt ( st . nextToken ( ) ) ; int m = Integer . parseInt ( st . nextToken ( ) ) ; int [ ] arr = new int [ n * m ] ; int [ ] [ ] grid = new int [ n ] [ m ] ;


import java . util . Scanner ;   public class B1413 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int T = in . nextInt ( ) ; StringBuilder output = new StringBuilder ( ) ; for ( int t = 0 ; t < T ; t ++ ) { int R = in . nextInt ( ) ; int C = in . nextInt ( ) ; int [ ] [ ] rows = new int [ R ] [ ] ; int [ ] rowIndex = new int [ R * C + 1 ] ; for ( int r = 0 ; r < R ; r ++ ) { int [ ] row = new int [ C ] ; for ( int c = 0 ; c < C ; c ++ ) { int a = in . nextInt ( ) ; row [ c ] = a ; rowIndex [ a ] = r ; } rows [ r ] = row ; } for ( int c = 0 ; c < C ; c ++ ) { for ( int r = 0 ; r < R ; r ++ ) { int a = in . nextInt ( ) ; if ( c == 0 ) { for ( int elem : rows [ rowIndex [ a ] ] ) { output . append ( elem ) . append ( ' ▁ ' ) ; } output . append ( ' \n ' ) ; } } } } System . out . print ( output ) ; }   }


import java . util . * ; import java . io . * ; import java . math . * ;

n , k = map ( int , input ( ) . split ( ) ) s = input ( ) if k == 1 and n > 1 : print ( ' NO ' ) exit ( 0 ) if k <= 2 : if n > 2 : print ( ' NO ' ) exit ( 0 )     arr = [ ] for ch in s : arr . append ( ord ( ch ) - 96 )   i = n - 1 last = - 1   while i >= 0 : for num in range ( arr [ i ] + 1 , k + 1 ) : if i - 2 >= 0 and num != arr [ i - 1 ] and num != arr [ i - 2 ] : arr [ i ] = num last = i break   elif i - 2 < 0 and i - 1 == 0 and arr [ i - 1 ] != num : arr [ i ] = num last = i break   elif i == 0 : arr [ i ] = num last = i break if last != - 1 : break i -= 1   if i < 0 : print ( ' NO ' ) exit ( 0 )   for i in range ( i + 1 , n ) : for num in range ( 1 , k + 1 ) : if i - 2 >= 0 and num != arr [ i - 1 ] and num != arr [ i - 2 ] :   arr [ i ] = num break elif i - 2 < 0 and i - 1 == 0 and arr [ i - 1 ] != num :   arr [ i ] = num breakans = " " for num in arr : ans += chr ( num + 96 )   print ( ans ) NEW_LINE


def trans ( c ) : return chr ( ord ( c ) + 1 )   n , p = list ( map ( int , input ( ) . split ( ) ) ) s = list ( input ( ) ) s [ n - 1 ] = trans ( s [ n - 1 ] )   i = n - 1 while i >= 0 and i < n : if ord ( s [ i ] ) >= ord ( ' a ' ) + p : s [ i ] = ' a ' i -= 1 s [ i ] = trans ( s [ i ] ) elif i > 0 and s [ i ] == s [ i - 1 ] or i > 1 and s [ i ] == s [ i - 2 ] : s [ i ] = trans ( s [ i ] ) else : i += 1 else : print ( " NO " if i < 0 else " " . join ( s ) ) NEW_LINE


n , p = list ( map ( int , input ( ) . split ( ) ) ) s = list ( input ( ) ) s [ n - 1 ] = chr ( ord ( s [ n - 1 ] ) + 1 ) i = n - 1 while i >= 0 and i < n : if ord ( s [ i ] ) >= ord ( ' a ' ) + p : s [ i ] = ' a ' i -= 1 s [ i ] = chr ( ord ( s [ i ] ) + 1 ) elif i > 0 and s [ i ] == s [ i - 1 ] or i > 1 and s [ i ] == s [ i - 2 ] : s [ i ] = chr ( ord ( s [ i ] ) + 1 ) else : i += 1 print ( " NO " if i < 0 else " " . join ( s ) ) NEW_LINE


def trans ( c ) : return chr ( ord ( c ) + 1 ) n , p = list ( map ( int , input ( ) . split ( ) ) ) s = list ( input ( ) ) s [ n - 1 ] = trans ( s [ n - 1 ] ) i = n - 1 while i >= 0 and i < n : if ord ( s [ i ] ) >= ord ( ' a ' ) + p : s [ i ] = ' a ' i -= 1 s [ i ] = trans ( s [ i ] ) elif i > 0 and s [ i ] == s [ i - 1 ] or i > 1 and s [ i ] == s [ i - 2 ] : s [ i ] = trans ( s [ i ] ) else : i += 1 print ( " NO " if i < 0 else " " . join ( s ) ) NEW_LINE


import java . util . * ; import java . io . * ;   public class Main { public static void main ( String [ ] args ) throws IOException { FastScanner in = new FastScanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; new Main ( ) . run ( in , out ) ; out . close ( ) ; }   public static long mod = 17352642619633L ;   void run ( FastScanner in , PrintWriter out ) {   int N = in . nextInt ( ) ; int P = in . nextInt ( ) ; String s = in . next ( ) ; char [ ] ca = s . toCharArray ( ) ;   boolean found = false ;   for ( int i = N - 1 ; i >= 0 ; i -- ) {   for ( char c = ( char ) ( ca [ i ] + 1 ) ; c < ' a ' + P ; c ++ ) {   if ( i - 1 >= 0 && ca [ i - 1 ] == c ) continue ; if ( i - 2 >= 0 && ca [ i - 2 ] == c ) continue ;


import java . util . * ;   import java . io . * ;   public class Main { public static void main ( String [ ] args ) throws IOException { FastScanner in = new FastScanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; new Main ( ) . run ( in , out ) ; out . close ( ) ; }

entrada = int ( input ( ) ) temporario = [ - 1 ] * 100005 i = 1 while ( i <= entrada ) : resposta = 0 x , y = input ( ) . split ( ) x = int ( x ) y = int ( y ) j = 1 while ( j * j <= x ) : if ( x % j == 0 ) : if ( i - temporario [ j ] > y ) : resposta += 1 if ( x - j * j and i - temporario [ int ( x / j ) ] > y ) : resposta += 1 temporario [ j ] = temporario [ int ( x / j ) ] = i j += 1 print ( resposta ) i += 1 NEW_LINE


import sysimport collections as ccinput = sys . stdin . buffer . readlineI = lambda : list ( map ( int , input ( ) . split ( ) ) ) prev = cc . defaultdict ( int ) for tc in range ( int ( input ( ) ) ) : x , y = I ( ) div = set ( ) for i in range ( 1 , int ( x ** 0.5 ) + 1 ) : if x % i == 0 : div . add ( i ) div . add ( x // i ) ans = 0 now = tc + 1 for i in div : if now - prev [ i ] > y : ans += 1 prev [ i ] = now print ( ans ) NEW_LINE


import java . util . * ; import java . io . * ; public class helloworld { static long fact [ ] ; static long max ; static int ans ; static class Reader { final private int BUFFER_SIZE = 1 << 16 ; private DataInputStream din ; private byte [ ] buffer ; private int bufferPointer , bytesRead ; public Reader ( ) { din = new DataInputStream ( System . in ) ; buffer = new byte [ BUFFER_SIZE ] ; bufferPointer = bytesRead = 0 ; } public Reader ( String file_name ) throws IOException { din = new DataInputStream ( new FileInputStream ( file_name ) ) ; buffer = new byte [ BUFFER_SIZE ] ; bufferPointer = bytesRead = 0 ; } public String readLine ( ) throws IOException { byte [ ] buf = new byte [ 64 ] ;


import java . lang . * ; import java . util . * ;   public class Solution { static int n = 100001 ; static ArrayList < Integer > arr [ ] = new ArrayList [ n ] ; public static void divisors ( ) { for ( int j = 0 ; j < n ; j ++ ) { arr [ j ] = new ArrayList < Integer > ( ) ; } for ( int i = 1 ; i < n ; i ++ ) { for ( int j = 1 ; j * j <= i ; j ++ ) { if ( i % j == 0 ) { if ( i / j == j ) { arr [ i ] . add ( j ) ; } else { arr [ i ] . add ( j ) ; arr [ i ] . add ( i / j ) ; } } } } } public static void main ( String [ ] args ) { divisors ( ) ; Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int x , y ; Map < Integer , Integer > map = new HashMap < Integer , Integer > ( ) ; for ( int i = 1 ; i <= n ; i ++ ) { x = sc . nextInt ( ) ; y = sc . nextInt ( ) ; int count = 0 ; for ( int j = 1 ; j < arr [ x ] . size ( ) ; j ++ ) { if ( map . get ( arr [ x ] . get ( j ) ) != null && map . get ( arr [ x ] . get ( j ) ) >= i - y && map . get ( arr [ x ] . get ( j ) ) < i ) { count ++ ; } } for ( int j = 1 ; j < arr [ x ] . size ( ) ; j ++ ) { map . put ( arr [ x ] . get ( j ) , i ) ; } if ( y == 0 ) System . out . println ( arr [ x ] . size ( ) ) ; else System . out . println ( arr [ x ] . size ( ) - 1 - count ) ; } } }


import java . io . BufferedReader ; import java . io . FileInputStream ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintStream ; import java . io . PrintWriter ; import java . util . ArrayDeque ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . Comparator ; import java . util . HashMap ; import java . util . HashSet ; import java . util . PriorityQueue ; import java . util . Random ; import java . util . StringTokenizer ;   public class Solution { static final int N = ( int ) 1e5 + 5 ; static ArrayList < Integer > [ ] fact ; static int [ ] last ; public static void main ( String [ ] args ) throws IOException { FastScanner fs = new FastScanner ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; int tt = 1 ; while ( tt -- > 0 ) { int n = fs . nextInt ( ) ; fact = new ArrayList [ N ] ; for ( int i = 0 ; i < N ; i ++ ) fact [ i ] = new ArrayList < Integer > ( ) ; generate ( ) ; last = new int [ N ] ; for ( int i = 1 ; i <= n ; i ++ ) { int x = fs . nextInt ( ) , y = fs . nextInt ( ) ; int ans = 0 ; for ( int f : fact [ x ] ) { if ( i - last [ f ] > y ) ans ++ ; } out . println ( ans ) ; for ( int f : fact [ x ] ) last [ f ] = i ; } } out . close ( ) ; } static void generate ( ) { for ( int i = 1 ; i < N ; i ++ ) { for ( int j = 1 ; i * j < N ; j ++ ) { fact [ i * j ] . add ( i ) ; } } } static final Random random = new Random ( ) ; static void ruffleSort ( int [ ] a ) { int n = a . length ;


import java . io . * ; import java . util . * ;   public class D {   public static void main ( String [ ] args ) { FastScanner in = new FastScanner ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; int t = in . nextInt ( ) ; while ( t -- > 0 ) { long a = in . nextLong ( ) , k = in . nextLong ( ) ; int cnt = 1 ; int min = minDig ( a ) ; int max = maxDig ( a ) ; while ( min != 0 && cnt < k ) { a += min * max ; min = minDig ( a ) ; max = maxDig ( a ) ; cnt ++ ; } out . println ( a ) ; } out . flush ( ) ; }   static int minDig ( long a ) { int min = 9 ; while ( a > 0 ) { min = Math . min ( min , ( int ) ( a % 10 ) ) ; a /= 10 ; } return min ; }   static int maxDig ( long a ) { int max = 0 ; while ( a > 0 ) { max = Math . max ( max , ( int ) ( a % 10 ) ) ; a /= 10 ; } return max ; }   static class FastScanner { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( " " ) ; String next ( ) { while ( ! st . hasMoreTokens ( ) ) try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { } return st . nextToken ( ) ; } String nextLine ( ) { try { return br . readLine ( ) ; } catch ( IOException e ) { } return " " ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } int [ ] readArray ( int n ) { int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextInt ( ) ; return a ; } } }

if __name__ == " _ _ main _ _ " : for _ in range ( int ( input ( ) ) ) : a1 , k = map ( int , input ( ) . split ( ) ) i = 1 a = a1 while i < k and '0' not in str ( a ) : p = a s = str ( a ) li = list ( s ) a = p + ( int ( min ( li ) ) * int ( max ( li ) ) ) i = i + 1 print ( a )   NEW_LINE


for _ in range ( int ( input ( ) ) ) : a , k = map ( int , input ( ) . split ( ) ) n = a prev = a cnt = 0 while cnt != k - 1 : n = a max = 0 min = 9 while n : if n % 10 > max : max = n % 10 if n % 10 < min : min = n % 10 n //= 10 a = a + min * max if a == prev : break else : prev = a cnt += 1 print ( a ) NEW_LINE


def min_max_digs ( n ) : digits = set ( ) while n > 0 : digits . add ( n % 10 ) n //= 10 return list ( digits )   for _ in range ( int ( input ( ) ) ) : a , k = map ( int , input ( ) . split ( ) ) for _ in range ( k - 1 ) : if a % 10 == 0 : break digits = min_max_digs ( a ) mn = min ( digits ) mx = max ( digits ) if mn == 0 : break a += min ( digits ) * max ( digits ) print ( a ) NEW_LINE


def ContainsZero ( c ) : t = list ( set ( str ( c ) ) ) for j in range ( len ( t ) ) : m = int ( t [ j ] ) if m == 0 : return True return False   def MinMaxDigit ( c ) : t = list ( set ( str ( c ) ) ) minimum = 11 maximum = - 1 for j in range ( len ( t ) ) : m = int ( t [ j ] ) if m < minimum : minimum = m if m > maximum : maximum = m return minimum * maximum   N = int ( input ( ) )   for _ in range ( N ) : data = input ( ) . split ( ) a = int ( data [ 0 ] ) k = int ( data [ 1 ] ) for i in range ( 1 , k ) : if ContainsZero ( a ) : break else : a = a + MinMaxDigit ( a ) print ( a ) NEW_LINE


if __name__ == ' _ _ main _ _ ' : for _ in range ( int ( input ( ) ) ) : n , k = map ( int , input ( ) . split ( ) ) i = 1 ans = str ( n ) while i < k and '0' not in ans : ans = str ( int ( ans ) + int ( max ( ans ) ) * int ( min ( ans ) ) ) i += 1 print ( ans ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class Seq_Digits { 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 ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } } public static void main ( String [ ] args ) { FastReader in = new FastReader ( ) ; int t = in . nextInt ( ) ; StringBuilder sb = new StringBuilder ( ) ; while ( t -- > 0 ) { long n = in . nextLong ( ) ; long k = in . nextLong ( ) ; k -- ; while ( k -- > 0 ) { long a = To_Add ( n ) ; if ( a == 0 ) { break ; } n += a ; } sb . append ( n + " \n " ) ; } System . out . println ( sb ) ;   } static long To_Add ( long n ) { long min = Long . MAX_VALUE ; long max = Long . MIN_VALUE ;   while ( n > 0 ) { min = Math . min ( min , n % 10 ) ; max = Math . max ( max , n % 10 ) ; n /= 10 ; } return ( min * max ) ; } }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ;   public class Codeforces {   private static final Scanner sc = new Scanner ( System . in ) ; private static final BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; private static final long MOD = ( long ) ( 1e9 + 7 ) ;   public static int [ ] LPS ( String p ) { int [ ] lps = new int [ p . length ( ) ] ;   int i = 1 ; int j = 0 ; while ( i < p . length ( ) ) { if ( p . charAt ( i ) == p . charAt ( j ) ) { lps [ i ] = j + 1 ; i ++ ; j ++ ; } else { if ( j == 0 ) { lps [ i ] = 0 ; i ++ ; } else { j = lps [ j - 1 ] ; } } } return lps ; }   public static void KMP ( String text , String pattern ) { int [ ] lps = LPS ( pattern ) ; int i = 0 ; int j = 0 ; ArrayList < Integer > matches = new ArrayList < > ( ) ; while ( i < text . length ( ) ) { if ( text . charAt ( i ) == pattern . charAt ( j ) ) { i ++ ; j ++ ; } else { if ( j != 0 ) { j = lps [ j - 1 ] ; } else { i ++ ; } } if ( j == pattern . length ( ) ) { matches . add ( i - j ) ; j = lps [ j - 1 ] ; } } for ( int x : matches ) { System . out . println ( " Match ▁ at ▁ : ▁ " + x ) ; } }   private static class SegmentTree { private long [ ] st ; private int size ; private int n ; private long [ ] a ; SegmentTree ( long [ ] a , int n ) { this . size = 4 * n ; this . n = n ; this . a = a ; st = new long [ size ] ;


import java . util . * ;   public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; double k = s . nextDouble ( ) ; double [ ] a = new double [ n ] ; double max = Double . MIN_VALUE ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = s . nextDouble ( ) ; if ( a [ i ] > max ) { max = a [ i ] ; } } solve ( a , k , max ) ; } static void solve ( double [ ] a , double k , double max ) { double minreq = 0 ; for ( int i = 0 ; i < a . length ; i ++ ) { minreq += max - a [ i ] ; } if ( minreq > k ) { System . out . println ( - 1 ) ; } else { double n = ( k - minreq ) / a . length ; for ( double val : a ) { System . out . println ( ( max - val + n ) ) ; } } } }

n , t = map ( int , input ( ) . split ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) X = float ( ( sum ( l ) + t ) / n ) NEW_LINE


n , b = map ( int , input ( ) . split ( ) ) s = list ( map ( int , input ( ) . split ( ) ) ) sb = sum ( s ) + bsb /= nif sb - max ( s ) >= 0 : for x in s : print ( sb - x ) else : print ( ' - 1' )     NEW_LINE


n , k = map ( int , input ( ) . strip ( ) . split ( ' ▁ ' ) ) lst = list ( map ( int , input ( ) . strip ( ) . split ( ' ▁ ' ) ) ) m = max ( lst ) lst2 = [ ] s = 0 for i in range ( n ) : lst2 . append ( m - lst [ i ] ) s += m - lst [ i ] if s > k : print ( - 1 ) else : k -= s k = k / n for i in range ( n ) : print ( " { 0 : . 6f } " . format ( k + lst2 [ i ] ) ) NEW_LINE


n , b = map ( int , input ( ) . split ( ) ) a = list ( float ( x ) for x in input ( ) . split ( ) ) s = max ( a ) c = [ 0 ] * nfor i in range ( n ) : m = s - a [ i ] b = b - m c [ i ] = c [ i ] + mif b >= 0 : for i in range ( n ) : c [ i ] = c [ i ] + b / n for i in range ( n ) : print ( " % .6f " % c [ i ] ) else : print ( " - 1" ) NEW_LINE


def f ( l1 , al ) : n , b = l1 c = ( sum ( al ) + b ) / n if max ( al ) > c : return [ - 1 ] return [ c - a for a in al ] l1 = list ( map ( int , input ( ) . split ( ) ) ) l2 = list ( map ( int , input ( ) . split ( ) ) ) [ print ( r ) for r in f ( l1 , l2 ) ] NEW_LINE


import java . util . Locale ; import java . util . Scanner ;   public class A174 {   public static void main ( String [ ] args ) { Locale . setDefault ( Locale . US ) ; Scanner in = new Scanner ( System . in ) ; int N = in . nextInt ( ) ; int B = in . nextInt ( ) ; int [ ] A = new int [ N ] ; int max = 0 ; int sum = 0 ; for ( int n = 0 ; n < N ; n ++ ) { int a = in . nextInt ( ) ; sum += a ; max = Math . max ( a , max ) ; A [ n ] = a ; } int minNeeded = N * max - sum ; if ( minNeeded > B ) { System . out . println ( " - 1" ) ; } else { double target = ( sum + B ) / ( double ) N ; for ( int a : A ) { System . out . println ( target - a ) ; } } }   }


import com . sun . security . jgss . GSSUtil ;   import java . io . * ; import java . lang . reflect . Array ; import java . nio . Buffer ; import java . util . * ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . IOException ;   public class Pair {   public static void main ( String [ ] args ) throws Exception { try { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) , b = sc . nextInt ( ) ;   double sum = 0 ; double [ ] arr = new double [ 100 ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = sc . nextDouble ( ) ; sum += arr [ i ] ; } sum += b ; sum /= n ; for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] > sum ) { System . out . println ( - 1 ) ; return ; } } for ( int i = 0 ; i < n ; i ++ ) { System . out . printf ( " % .6f \n " , sum - arr [ i ] ) ; } } catch ( Exception e ) { } } }