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


ans = 0   def is_sorted ( array , l , r ) : for i in range ( l , r ) : if array [ i ] > array [ i + 1 ] : return False return True   def check_array ( array , l , r ) : if is_sorted ( array , l , r ) : global ans ans = max ( ans , r - l + 1 ) return   mid = ( l + r ) // 2 check_array ( array , l , mid ) check_array ( array , mid + 1 , r )   n = int ( input ( ) ) array = list ( map ( ( int ) , input ( ) . strip ( ) . split ( ) ) ) size = len ( array ) check_array ( array , 0 , size - 1 ) print ( ans ) NEW_LINE


def sol ( a , i , j ) : if ( len ( a ) == 1 ) : return True for i in range ( i + 1 , j + 1 ) : if ( a [ i ] < a [ i - 1 ] ) : return False return Truedef solve ( a , i , j ) : if ( i > j ) : return 0 ; if ( sol ( a , i , j ) ) : return j - i + 1 mid = ( j + i ) // 2 return max ( solve ( a , i , mid ) , solve ( a , mid + 1 , j ) ) n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) print ( solve ( a , 0 , len ( a ) - 1 ) ) NEW_LINE


def check_thanossort ( arr , x , y ) : t = 0 for i in range ( x + 1 , y + 1 ) : if ( arr [ i ] >= arr [ i - 1 ] ) : t += 1 if ( t == y - x ) : p = 1 else : p = 0 return pa = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) j = awhile ( j >= 1 ) : k = 0 brk = False while ( k < a ) : if ( check_thanossort ( arr , k , k + j - 1 ) == 1 ) : ans = j ; brk = True ; break k += j if ( brk ) : break j //= 2 print ( ans ) NEW_LINE


import sysinput = sys . stdin . readline   def is_sorted ( a , n ) : if n == 1 : return 1 flag = 1 for i in range ( 1 , n ) : if a [ i - 1 ] > a [ i ] : flag = 0 return flag   def f ( a , n ) : if is_sorted ( a , n ) : return n return max ( f ( a [ : n // 2 ] , n // 2 ) , f ( a [ n // 2 : ] , n // 2 ) )   t = 1   for _ in range ( t ) : n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) ans = f ( a , n ) print ( ans ) NEW_LINE


import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . StringTokenizer ;   public class B { static PrintWriter out = new PrintWriter ( System . out ) ;   public static void main ( String [ ] args ) { FS in = new FS ( ) ; long R = in . nextLong ( ) ; long C = in . nextLong ( ) ; long res = solve ( Math . min ( R , C ) , Math . max ( R , C ) ) ; out . println ( res ) ; out . close ( ) ; } static long solve ( long r , long c ) { if ( r < 3 && c < 3 ) return 0 ; if ( r == 1 ) { long res = c ; long m = c % 6 ; if ( m != 0 ) { if ( m <= 3 ) res -= m ; if ( m == 4 ) res -= 2 ; if ( m == 5 ) res -= 1 ; } return res ; } if ( r == 2 ) { if ( c == 3 || c == 7 ) return r * ( c - 1 ) ; return r * c ; } long res = r * c ; if ( res % 2 == 0 ) return res ; return res - 1 ; }

def main ( ) : n , m = map ( int , input ( ) . split ( ) ) if m > n : n , m = m , n if n + m <= 4 : print ( 0 ) return if m == 1 : q = n // 6 ; r = n % 6 if r == 4 : print ( n - 2 ) elif r == 5 : print ( n - 1 ) else : print ( q * 6 ) return if ( n , m ) in [ ( 7 , 2 ) , ( 3 , 2 ) ] : print ( n * m - 2 ) return if n % 2 == 0 or m % 2 == 0 : print ( n * m ) return print ( n * m - 1 ) main ( ) NEW_LINE


import mathimport sysn , m = map ( int , input ( ) . split ( ) ) if n > m : n , m = m , nif n == 1 : print ( 6 * ( m // 6 ) + 2 * max ( 0 , ( m % 6 ) - 3 ) ) elif n == 2 : if m == 2 : print ( 0 ) elif m in ( 1 , 3 , 7 ) : print ( n * m - 2 ) else : print ( n * m ) else : print ( ( n * m // 2 ) * 2 ) NEW_LINE


import java . util . * ; import java . io . * ;   public class Main { public static void main ( String args [ ] ) { new Main ( ) . run ( ) ; }   FastReader in = new FastReader ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; void run ( ) { work ( ) ; out . flush ( ) ; } long mod = 1000000007 ; long gcd ( long a , long b ) { return b == 0 ? a : gcd ( b , a % b ) ; } void work ( ) { long n = in . nextInt ( ) ; long m = in . nextInt ( ) ; if ( n > m ) { long t = m ; m = n ; n = t ; } long v = 0 ; if ( n == 1 ) { v = m / 6 * 6 ; if ( m % 6 == 4 ) v += 2 ; if ( m % 6 == 5 ) v += 4 ; } else if ( n <= 2 && m <= 2 ) { v = 0 ; } else if ( n == 2 && m == 3 ) { v = 4 ; } else if ( n == 2 && m == 7 ) { v = 12 ; } else if ( n % 2 == 0 ) {


import java . util . * ; import java . math . * ;   public class Main { public static void main ( String ards [ ] ) { Scanner cin = new Scanner ( System . in ) ; while ( cin . hasNext ( ) ) { long n = cin . nextLong ( ) ; long m = cin . nextLong ( ) ; if ( n > m ) { long x = n ; n = m ; m = x ; } if ( n == 1 ) { if ( m % 6 == 0 ) System . out . println ( m ) ; else if ( m % 6 <= 3 ) System . out . println ( m - ( m % 6 ) ) ; else System . out . println ( m - ( 6 - m % 6 ) ) ; } else if ( n == 2 && m == 2 ) System . out . println ( 0 ) ; else if ( n == 2 && m == 3 ) System . out . println ( 4 ) ; else if ( n == 2 && m == 7 ) System . out . println ( 12 ) ; else { if ( n % 2 == 1 && m % 2 == 1 ) System . out . println ( n * m - 1 ) ; else System . out . println ( n * m ) ; } } } }


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

from collections import deque   intersections = int ( input ( ) ) shortcuts = [ 0 ] + list ( map ( int , input ( ) . split ( ) ) ) costs = [ float ( ' inf ' ) ] * ( intersections + 1 ) costs [ 1 ] = 0 queue = deque ( [ 1 ] )   while queue : t = queue . popleft ( )   if t + 1 <= intersections and costs [ t ] + 1 < costs [ t + 1 ] : costs [ t + 1 ] = costs [ t ] + 1 queue . append ( t + 1 )   if t - 1 >= 1 and costs [ t ] + 1 < costs [ t - 1 ] : costs [ t - 1 ] = costs [ t ] + 1 queue . append ( t - 1 )   if costs [ t ] + 1 < costs [ shortcuts [ t ] ] : costs [ shortcuts [ t ] ] = costs [ t ] + 1 queue . append ( shortcuts [ t ] )   print ( ' ▁ ' . join ( str ( i ) for i in costs [ 1 : ] ) ) NEW_LINE


n = int ( input ( ) ) A = list ( map ( int , input ( ) . split ( ) ) )   for i in range ( n ) : A [ i ] -= 1   dist = [ - 1 for i in range ( n ) ] dist [ 0 ] = 0   Q = [ 0 ]   while len ( Q ) != 0 : k = 0 u = Q . pop ( 0 ) if dist [ A [ u ] ] == - 1 : dist [ A [ u ] ] = dist [ u ] + 1 k += 1 if A [ u ] not in Q : Q . append ( A [ u ] ) elif dist [ A [ u ] ] > dist [ u ] + 1 : dist [ A [ u ] ] = dist [ u ] + 1 k += 1 if A [ u ] not in Q : Q . append ( A [ u ] ) for v in range ( u - 1 , u + 2 ) : if v < 0 or v >= n : continue if dist [ v ] == - 1 : dist [ v ] = dist [ u ] + abs ( u - v ) if v not in Q : Q . append ( v ) elif dist [ u ] + abs ( u - v ) < dist [ v ] : dist [ v ] = dist [ u ] + abs ( u - v ) k += 1 if v not in Q : Q . append ( v ) print ( ' ▁ ' . join ( map ( str , dist ) ) ) NEW_LINE


def solve ( N , nums ) : ans = [ float ( ' inf ' ) ] * N ans [ 0 ] = str ( 0 )   for i in range ( N ) : v = nums [ i ] nums [ i ] = set ( [ min ( N - 1 , i + 1 ) , max ( 0 , i - 1 ) , v - 1 , ] ) d = 0 q = set ( [ 0 ] ) while q : next_q = set ( ) d += 1 for node in q : for next_node in nums [ node ] : if ans [ next_node ] == float ( ' inf ' ) : ans [ next_node ] = str ( d ) next_q . add ( next_node ) q = next_q   return ans   N = int ( input ( ) ) nums = list ( map ( int , input ( ) . split ( ) ) ) ans = solve ( N , nums ) print ( ( " ▁ " ) . join ( ans ) ) NEW_LINE


import java . io . * ; import java . util . * ;   public class MikeandShortcuts {   public static void main ( String args [ ] ) throws Exception { Scanner cin = new Scanner ( System . in ) ; int N = cin . nextInt ( ) ; int a [ ] = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { a [ i ] = cin . nextInt ( ) ; } Queue < Integer > queue = new LinkedList < Integer > ( ) ; int [ ] dis = new int [ N ] ; boolean [ ] visited = new boolean [ N ] ;   for ( int i = 0 ; i < N ; i ++ ) { dis [ i ] = - 1 ; visited [ 0 ] = false ; } visited [ 0 ] = true ; dis [ 0 ] = 0 ; queue . add ( 0 ) ;   while ( ! queue . isEmpty ( ) ) { int e = queue . poll ( ) ; int ahead = e + 1 , back = e - 1 ; if ( ahead >= 0 && ahead < N && ! visited [ ahead ] ) { queue . add ( ahead ) ; visited [ ahead ] = true ; dis [ ahead ] = dis [ e ] + 1 ; } if ( back >= 0 && back < N && ! visited [ back ] ) { if ( back >= 0 && back < N && ! visited [ back ] ) { queue . add ( back ) ; visited [ back ] = true ; dis [ back ] = dis [ e ] + 1 ; } } int target = a [ e ] - 1 ; if ( ! visited [ target ] ) { if ( ! visited [ target ] ) { queue . add ( target ) ; visited [ target ] = true ; dis [ target ] = dis [ e ] + 1 ; } } }   for ( int i = 0 ; i < N ; i ++ ) { if ( i == N ) System . out . println ( dis [ i ] ) ; System . out . print ( dis [ i ] + " ▁ " ) ; }   }   }


import java . util . * ; import java . io . * ; public class Solution { 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 . util . * ; public class f {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long a = sc . nextInt ( ) ; long b = sc . nextInt ( ) ; long c = sc . nextInt ( ) ; if ( c == 0 ) System . out . println ( ( a == b ) ? " YES " : " NO " ) ; else System . out . println ( ( ( b - a ) % c == 0 && ( b - a ) / c >= 0 ) ? " YES " : " NO " ) ;   }   }

''' a = [ int ( i ) ▁ for ▁ i ▁ in ▁ input ( ) . split ( ) ] x = a [ 0 ] y = a [ 1 ] z = a [ 2 ] if ▁ y = = x ▁ and ▁ z = = 0 : ▁ ▁ ▁ ▁ print ( '0 ' ) elif ▁ x > y + z : ▁ ▁ ▁ ▁ print ( ' + ' ) elif ▁ y > x + z : ▁ ▁ ▁ ▁ print ( ' - ' ) else : ▁ ▁ ▁ ▁ print ( ' ? ' ) n = int ( input ( ) ) z = [ int ( i ) ▁ for ▁ i ▁ in ▁ input ( ) . split ( ) ] x = [ ] d = 0v = ' ' for ▁ i ▁ in ▁ range ( n ) : ▁ ▁ ▁ ▁ c = 0 ▁ ▁ ▁ ▁ e = 0 ▁ ▁ ▁ ▁ for ▁ f ▁ in ▁ range ( len ( z ) ) : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ if ▁ z [ f ] > c ▁ and ▁ f + 1 ▁ not ▁ in ▁ x : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ c = z [ f ] ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ e = f + 1 ▁ ▁ ▁ ▁ d + = ( i * c ) + 1 ▁ ▁ ▁ ▁ x . append ( e ) print ( d ) for ▁ i ▁ in ▁ x : ▁ ▁ ▁ ▁ v + = str ( i ) ▁ ▁ ▁ ▁ v + = ' ▁ ' print ( v )  f = int ( input ( ) ) g = [ int ( i ) ▁ for ▁ i ▁ in ▁ input ( ) . split ( ) ] for ▁ i ▁ in ▁ range ( len ( g ) -1 ) : ▁ ▁ ▁ ▁ for ▁ f ▁ in ▁ range ( len ( g ) -1 - i ) : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ if ▁ g [ f ] > g [ f + 1 ] : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ g [ f ] , g [ f + 1 ] = g [ f + 1 ] , g [ f ] if ▁ g [ 0 ] * g [ 1 ] > g [ -2 ] * g [ -3 ] ▁ and ▁ g [ -1 ] > 0 : ▁ ▁ ▁ ▁ print ( g [ -1 ] * g [ 0 ] * g [ 1 ] ) else : ▁ ▁ ▁ ▁ print ( g [ -1 ] * g [ -2 ] * g [ -3 ] ) for ▁ u ▁ in ▁ range ( int ( input ( ) ) ) : ▁ ▁ ▁ ▁ z = int ( input ( ) ) ▁ ▁ ▁ ▁ y = [ int ( f ) ▁ for ▁ f ▁ in ▁ input ( ) . split ( ) ] ▁ ▁ ▁ ▁ y . sort ( ) ▁ ▁ ▁ ▁ d = 0 ▁ ▁ ▁ ▁ for ▁ i ▁ in ▁ y : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ d + = i ▁ ▁ ▁ ▁ if ▁ d < 2048 : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( ' No ' ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ continue ▁ ▁ ▁ ▁ if ▁ 2048 ▁ in ▁ y : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( ' yes ' ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ continue ▁ ▁ ▁ ▁ for ▁ x ▁ in ▁ range ( z + 1 ) : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ if ▁ 2048 ▁ in ▁ y : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( ' yes ' ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ break ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ for ▁ i ▁ in ▁ range ( len ( y ) -1 ) : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ if ▁ y [ i ] = = y [ i + 1 ] : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ y [ i + 1 ] = y [ i ] *2 ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ y . pop ( i ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ if ▁ i > len ( y ) -3 : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ break ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ y . sort ( ) ▁ ▁ ▁ ▁ else : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( ' no ' ) n = int ( input ( ) ) x = [ ] for ▁ i ▁ in ▁ range ( 1 , ( ( n * *2 ) / /2 ) + 1 ) : ▁ ▁ ▁ ▁ x . append ( n * *2 + 1 - i ) ▁ ▁ ▁ ▁ x . append ( i ) ▁ ▁ ▁ ▁ if ▁ len ( x ) = = n : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( * x ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ x = [ ] for ▁ z ▁ in ▁ range ( int ( input ( ) ) ) : ▁ ▁ ▁ ▁ z = int ( input ( ) ) ▁ ▁ ▁ ▁ x = [ int ( i ) ▁ for ▁ i ▁ in ▁ input ( ) . split ( ) ] ▁ ▁ ▁ ▁ f = 0 ▁ ▁ ▁ ▁ o = 0 ▁ ▁ ▁ ▁ t = 0 ▁ ▁ ▁ ▁ for ▁ i ▁ in ▁ range ( z ) : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ if ▁ x [ i ] %3 = = 0 : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ f + = 1 ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ elif ▁ x [ i ] %3 = = 1 : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ o + = 1 ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ else : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ t + = 1 ▁ ▁ ▁ ▁ if ▁ o < t : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( f + o + ( t - o ) / / 3 ) ▁ ▁ ▁ ▁ else : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( f + t + ( o - t ) / / 3 ) n = int ( input ( ) ) if ▁ n % 2 = = 1 : ▁ ▁ ▁ ▁ print ( 0 ) elif ▁ n % 4 = = 0 : ▁ ▁ ▁ ▁ print ( ( n / /4 ) - 1 ) else : ▁ ▁ ▁ ▁ print ( n / /4 ) ''' n = [ int ( i ) for i in input ( ) . split ( ) ] if n [ 2 ] >= 0 and n [ 0 ] > n [ 1 ] : print ( ' NO ' ) elif n [ 2 ] <= 0 and n [ 0 ] < n [ 1 ] : print ( ' NO ' ) elif n [ 2 ] == 0 : if n [ 0 ] == n [ 1 ] : print ( ' YES ' ) else : print ( ' NO ' ) elif ( n [ 1 ] - n [ 0 ] ) % n [ 2 ] == 0 : print ( ' YES ' ) else : print ( ' NO ' ) NEW_LINE


a , b , d = map ( int , input ( ) . strip ( ) . split ( ' ▁ ' ) ) if d == 0 : if a == b : print ( ' yes ' ) else : print ( ' no ' ) elif a == b : print ( ' yes ' ) elif ( b - a ) % d == 0 and ( b - a ) * d > 0 : print ( ' yes ' ) else : print ( ' no ' ) NEW_LINE


a , b , c = map ( int , input ( ) . split ( ) ) ; s = 0 if c == 0 : if a == b : print ( " YES " ) else : print ( " NO " ) elif c < 0 : if a < b : print ( " NO " ) else : if abs ( a - b ) % c == 0 : print ( " YES " ) else : print ( " NO " ) else : if a > b : print ( " NO " ) else : if abs ( a - b ) % c == 0 : print ( " YES " ) else : print ( " NO " ) NEW_LINE


a , b , c = map ( int , input ( ) . split ( ) ) if ( a != b and c == 0 ) : print ( " NO " ) else : print ( " YES " ) if ( a == b or ( ( b - a ) % c == 0 and ( abs ( b - a ) / abs ( c ) ) == ( ( b - a ) / c ) ) ) else print ( " NO " ) NEW_LINE


a , b , c = map ( int , input ( ) . split ( ) )   if a == b : print ( ' YES ' ) elif c == 0 or b > a and c < 0 or b < a and c > 0 : print ( ' NO ' ) else : c = abs ( c )   if ( b - a ) % c == 0 : print ( ' YES ' ) else : print ( ' NO ' ) NEW_LINE


import java . io . * ; import java . util . * ;   public class practice675a { public static void main ( String [ ] args ) throws Exception {


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . Arrays ;    public class CF675AInfiniteSequence {   static BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; static PrintWriter out = new PrintWriter ( System . out ) ;   public static void main ( String [ ] args ) throws IOException { int [ ] p = readArray ( ) ; int a = p [ 0 ] ; int b = p [ 1 ] ; int c = p [ 2 ] ;   if ( c == 0 ) { out . print ( a == b ? " YES " : " NO " ) ; } else if ( c > 0 ) { if ( b < a ) { out . print ( " NO " ) ; } else { out . print ( ( b - a ) % c == 0 ? " YES " : " NO " ) ; } } else if ( c < 0 ) { if ( b > a ) { out . print ( " NO " ) ; } else { out . print ( ( b - a ) % c == 0 ? " YES " : " NO " ) ; } } out . close ( ) ; }   private static String read ( ) throws IOException { return in . readLine ( ) ; }   private static int readInt ( ) throws IOException { return Integer . parseInt ( in . readLine ( ) ) ; }   private static int [ ] readArray ( ) throws IOException { String [ ] line = in . readLine ( ) . split ( " \\ s " ) ; int [ ] a = Arrays . stream ( line ) . mapToInt ( Integer :: parseInt ) . toArray ( ) ; return a ; }   private static int [ ] readSortedArray ( ) throws IOException { String [ ] line = in . readLine ( ) . split ( " \\ s " ) ; int [ ] a = Arrays . stream ( line ) . mapToInt ( Integer :: parseInt ) . sorted ( ) . toArray ( ) ; return a ; } }


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 ] ;

n , m = map ( int , input ( ) . split ( ) ) S = [ input ( ) for i in range ( n ) ]   res = [ [ 0 ] * m for i in range ( n ) ] d = [ ( - 1 , - 1 ) , ( - 1 , 0 ) , ( - 1 , 1 ) , ( 0 , - 1 ) , ( 0 , 1 ) , ( 1 , - 1 ) , ( 1 , 0 ) , ( 1 , 1 ) ] for i in range ( n ) : for j in range ( m ) : if S [ i ] [ j ] == ' * ' : for di , dj in d : ni , nj = i + di , j + dj if 0 <= ni < n and 0 <= nj < m : if S [ ni ] [ nj ] != ' * ' : res [ ni ] [ nj ] += 1 NEW_LINE


from itertools import product   I = lambda : map ( int , input ( ) . split ( ) )   n , m = I ( ) A = [ input ( ) . replace ( ' . ' , '0' ) for _ in range ( n ) ]   for x , y in product ( range ( n ) , range ( m ) ) : if ( A [ x ] [ y ] != ' * ' and sum ( A [ x + dx ] [ y + dy ] == ' * ' for dx in range ( - 1 , 2 ) for dy in range ( - 1 , 2 ) if 0 <= x + dx < n and 0 <= y + dy < m ) != int ( A [ x ] [ y ] ) ) : print ( ' NO ' ) breakelse : print ( ' YES ' ) NEW_LINE


n , m = map ( int , input ( ) . split ( ) ) a = [ input ( ) . replace ( ' . ' , '0' ) for i in range ( n ) ] for i in range ( n ) : for j in range ( m ) : if a [ i ] [ j ] != ' * ' and int ( a [ i ] [ j ] ) != sum ( map ( lambda b : b [ max ( 0 , j - 1 ) : j + 2 ] . count ( ' * ' ) , a [ max ( 0 , i - 1 ) : i + 2 ] ) ) : print ( ' NO ' ) exit ( ) print ( ' YES ' ) NEW_LINE


import java . io . * ; import java . util . * ;   public class Solution { public static void main ( String [ ] args ) throws Exception { int nm [ ] = in . readA ( ) ; int n = nm [ 0 ] , m = nm [ 1 ] ; char [ ] [ ] board = new char [ n ] [ m ] ; for ( int i = 0 ; i < n ; i ++ ) { char [ ] line = in . readLine ( ) . toCharArray ( ) ; for ( int j = 0 ; j < m ; j ++ ) { board [ i ] [ j ] = line [ j ] ; } } boolean possible = true ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { possible = possible && check ( i , j , board [ i ] [ j ] , board ) ; } } if ( ! possible ) System . out . println ( " NO " ) ; else System . out . println ( " YES " ) ; } static int [ ] [ ] direction = { { - 1 , - 1 } , { - 1 , 0 } , { - 1 , 1 } , { 0 , - 1 } , { 0 , 1 } , { 1 , - 1 } , { 1 , 0 } , { 1 , 1 } } ; public static boolean check ( int x , int y , char val , char [ ] [ ] board ) { if ( board [ x ] [ y ] == ' * ' ) return true ; int mines = 0 ; for ( int [ ] dir : direction ) { int nx = x + dir [ 0 ] , ny = y + dir [ 1 ] ; if ( nx < 0 || nx >= board . length || ny < 0 || ny >= board [ 0 ] . length ) continue ; if ( board [ nx ] [ ny ] == ' * ' ) mines ++ ; }


import java . util . * ; public class Solution { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; int m = s . nextInt ( ) ; s . nextLine ( ) ; String [ ] s1 = new String [ n ] ; for ( int j1 = 0 ; j1 < n ; j1 ++ ) s1 [ j1 ] = s . nextLine ( ) ; int count = 0 , found = 0 , count1 = 0 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { count = 0 ; count1 = 0 ; if ( Character . isDigit ( s1 [ i ] . charAt ( j ) ) ) { int digit = Character . getNumericValue ( s1 [ i ] . charAt ( j ) ) ; if ( i > 0 && s1 [ i - 1 ] . charAt ( j ) == ' * ' ) count ++ ; if ( i < n - 1 && s1 [ i + 1 ] . charAt ( j ) == ' * ' ) count ++ ; if ( j > 0 && s1 [ i ] . charAt ( j - 1 ) == ' * ' ) count ++ ; if ( j < m - 1 && s1 [ i ] . charAt ( j + 1 ) == ' * ' ) count ++ ; if ( i > 0 && j > 0 && s1 [ i - 1 ] . charAt ( j - 1 ) == ' * ' ) count ++ ; if ( i > 0 && j < m - 1 && s1 [ i - 1 ] . charAt ( j + 1 ) == ' * ' ) count ++ ; if ( i < n - 1 && j > 0 && s1 [ i + 1 ] . charAt ( j - 1 ) == ' * ' ) count ++ ; if ( i < n - 1 && j < m - 1 && s1 [ i + 1 ] . charAt ( j + 1 ) == ' * ' ) count ++ ; if ( digit != count ) {


import java . util . Scanner ;   public class UltrafastMath { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String word1 = scanner . nextLine ( ) . trim ( ) ; String word2 = scanner . nextLine ( ) . trim ( ) ;   StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < word1 . length ( ) ; i ++ ) { sb . append ( word1 . charAt ( i ) == word2 . charAt ( i ) ? "0" : "1" ) ; }   System . out . println ( sb . toString ( ) ) ; } }

first = input ( ) NEW_LINE second = input ( )     res = " " NEW_LINE for u , v in zip ( first , second ) : if NEW_LINE u == v : res += "0" else : res += "1" NEW_LINE print ( res ) NEW_LINE


a = input ( ) NEW_LINE b = input ( ) NEW_LINE a = [ x for x in a ] NEW_LINE b = [ y for y in b ]   x = [ '0' if i1 == i2 else '1' for ( i1 , i2 ) in zip ( a , b ) ] NEW_LINE print ( ' ' . join ( x ) ) NEW_LINE


a , b = input ( ) , input ( ) NEW_LINE c = [ 0 ] * len ( a ) NEW_LINE for i in range ( len ( a ) ) : if NEW_LINE a [ i ] != b [ i ] : c [ i ] = 1 NEW_LINE print ( * c , sep = ' ' ) NEW_LINE


m = input ( ) NEW_LINE n = input ( ) NEW_LINE for i in range ( len ( m ) ) : if NEW_LINE INDENT ( m [ i ] == n [ i ] ) : print ( '0' , end = ' ' ) else : print ( '1' , end = ' ' ) NEW_LINE DEDENT


import java . util . Scanner ;   public class Ultra_Fast_Mathematician {   static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { String s1 = sc . next ( ) ; String s2 = sc . next ( ) ; StringBuilder sum = new StringBuilder ( ) ; for ( int i = 0 ; i < s1 . length ( ) ; i ++ ) { int n = s1 . charAt ( i ) - '0' ; int m = s2 . charAt ( i ) - '0' ; if ( ( n + m ) == 1 ) { sum . append ( "1" ) ; } else { sum . append ( "0" ) ; } } System . out . println ( sum . toString ( ) ) ; } }


import java . util . * ;   public class Main { public static void main ( String [ ] args ) {   Scanner scn = new Scanner ( System . in ) ; String num = scn . nextLine ( ) ; String num2 = scn . nextLine ( ) ; String str = " " ; for ( int i = 0 ; i < num . length ( ) ; i ++ ) { if ( num . charAt ( i ) == num2 . charAt ( i ) ) { str = str + 0 ; } else { str = str + 1 ; } } System . out . print ( str ) ;   } }


import java . util . Scanner ;    public class Main {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . nextLine ( ) ; String b = sc . nextLine ( ) ; char [ ] c = new char [ a . length ( ) ] ; for ( int i = 0 ; i < a . length ( ) ; i ++ ) { if ( a . charAt ( i ) == b . charAt ( i ) ) { c [ i ] = '0' ; } else { c [ i ] = '1' ; } } System . out . println ( c ) ; }   }


import java . io . * ; import java . util . * ; public class MyClass { public static void main ( String args [ ] ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String a = br . readLine ( ) ; String b = br . readLine ( ) ; String rs = " " ; for ( int i = 0 ; i < a . length ( ) ; i ++ ) { int ch1 = a . charAt ( i ) - '0' ; int ch2 = b . charAt ( i ) - '0' ; rs += ( ch1 ^ ch2 ) ; } System . out . println ( rs ) ; } }


import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . Scanner ; import java . lang . Math ; public class Account { public static int gcd ( int a , int b ) { if ( a == 0 ) return b ; return gcd ( b % a , a ) ; } public static int lcm ( int a , int b ) { return ( a / gcd ( a , b ) ) * b ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int A = a , B = b , C = c , D = d ; int num , p , q ; if ( c > d ) { num = lcm ( c , a ) ; b = b * ( num / a ) ; a = num ; d = d * ( num / c ) ; c = num ; p = ( b - d ) ; q = b ; if ( b < d ) { a = A ; b = B ; c = C ; d = D ; num = lcm ( d , b ) ; a = a * ( num / b ) ; b = num ; c = c * ( num / d ) ; d = num ; p = ( a - c ) ; q = a ; } } else { num = lcm ( d , b ) ; a = a * ( num / b ) ; b = num ; c = c * ( num / d ) ; d = num ; p = ( a - c ) ; q = a ; if ( a < c ) { a = A ; b = B ; c = C ; d = D ; num = lcm ( c , a ) ; b = b * ( num / a ) ; a = num ; d = d * ( num / c ) ; c = num ; p = ( b - d ) ; q = b ; } } if ( p == 0 ) { q = 1 ; }

from fractions import Fractiona , b , c , d = map ( int , input ( ) . split ( ) ) v = Fraction ( abs ( a * d - b * c ) , max ( a * d , b * c ) ) print ( v . numerator , ' / ' , v . denominator , sep = ' ' ) NEW_LINE


from fractions import Fractiona , b , c , d = map ( int , input ( ) . split ( ) ) if ( a / b == c / d ) : print ( '0/1' ) elif ( a / b < c / d ) : r1 = ( ( b * c ) - ( a * d ) ) / ( b * c ) print ( Fraction ( r1 ) . limit_denominator ( ) ) elif ( a / b > c / d ) : r = ( ( a * d ) - ( b * c ) ) / ( a * d ) print ( Fraction ( r ) . limit_denominator ( ) ) NEW_LINE


import mathn , k , l , m = map ( int , input ( ) . split ( ) ) k = k * lm = m * na = abs ( k - m ) b = max ( k , m ) x = math . gcd ( a , b ) a //= xb //= xprint ( str ( a ) + " / " + str ( b ) ) NEW_LINE


import sysimport mathdef gcd ( a , b ) : c = max ( a , b ) d = min ( a , b ) r = c % d if r == 0 : return d return gcd ( d , r ) def lcm ( a , b ) : def gcd_naive ( a , b ) : c = max ( a , b ) d = min ( a , b ) r = c % d if r == 0 : return d return gcd_naive ( d , r )   return int ( a * b / gcd_naive ( a , b ) )   def fn ( a , b , c , d ) : k1 = lcm ( a , c ) k2 = lcm ( b , d ) f = k1 // a b1 = b * f f2 = k1 // c d1 = d * f2 if b1 == d1 : print ( "0/1" ) return 0 elif b1 > d1 : nu = b1 - d1 de = b1 else : f1 = k2 // b a1 = f1 * a f3 = k2 // d c1 = f3 * c nu = a1 - c1 de = a1 g = gcd ( nu , de ) nu = int ( nu // g ) de = int ( de // g ) print ( str ( nu ) + " / " + str ( de ) ) if __name__ == ' _ _ main _ _ ' : input = sys . stdin . read ( ) data = list ( map ( float , input . split ( ) ) ) a = ( data [ 0 ] ) b = data [ 1 ] c = data [ 2 ] d = data [ 3 ] ( fn ( a , b , c , d ) ) NEW_LINE


def gcd ( a , b ) : while a % b != 0 : a , b = b , a % b return b   l = input ( ) . split ( ' ▁ ' ) a , b , c , d = int ( l [ 0 ] ) , int ( l [ 1 ] ) , int ( l [ 2 ] ) , int ( l [ 3 ] ) if a * d > b * c : p = a * d - b * c q = a * delse : p = b * c - a * d q = b * ce = gcd ( p , q ) p //= eq //= eprint ( str ( p ) + " / " + str ( q ) ) NEW_LINE


import java . util . * ;   public class RoutineProblem { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; long a = in . nextLong ( ) ; long b = in . nextLong ( ) ; long c = in . nextLong ( ) ; long d = in . nextLong ( ) ;   double A = ( double ) a , B = ( double ) b , C = ( double ) c , D = ( double ) d ;   if ( Math . abs ( A / B - C / D ) <= 1e-9 ) { System . out . println ( "0/1" ) ; } else if ( C / D > A / B ) { long ans1 = b * c - a * d ; long ans2 = b * c ; long cp = gcd ( ans1 , ans2 ) ; System . out . println ( ans1 / cp + " / " + ans2 / cp ) ; } else if ( C / D < A / B ) { long ans1 = a * d - b * c ; long ans2 = a * d ; long cp = gcd ( ans1 , ans2 ) ; System . out . println ( ans1 / cp + " / " + ans2 / cp ) ; } } public static long gcd ( long a , long b ) { if ( b == 0 ) { return a ; } return gcd ( b , a % b ) ; } }


import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . Scanner ; import java . lang . Math ; public class Account { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int A = a , B = b , C = c , D = d ; int num , p , q ; if ( c > d ) { num = c * a ; b = b * ( num / a ) ; a = num ; d = d * ( num / c ) ; c = num ; p = ( b - d ) ; q = b ; if ( b < d ) { a = A ; b = B ; c = C ; d = D ; num = b * d ; a = a * ( num / b ) ; b = num ; c = c * ( num / d ) ; d = num ; p = ( a - c ) ; q = a ; } } else { num = b * d ; a = a * ( num / b ) ; b = num ; c = c * ( num / d ) ; d = num ; p = ( a - c ) ; q = a ; if ( a < c ) { a = A ; b = B ; c = C ; d = D ; num = a * c ; b = b * ( num / a ) ; a = num ; d = d * ( num / c ) ; c = num ; p = ( b - d ) ; q = b ; } } if ( p == 0 ) { q = 1 ; }


import java . util . Scanner ; import java . util . ArrayList ; public class Main { public static void main ( String args [ ] ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; String str = s . next ( ) ; int b = 0 , w = 0 ; ArrayList < Integer > black = new ArrayList < > ( ) ; ArrayList < Integer > white = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( str . charAt ( i ) == ' B ' ) { b ++ ; black . add ( i + 1 ) ; } else { w ++ ; white . add ( i + 1 ) ; } } if ( b % 2 == 1 && w % 2 == 1 ) { System . out . println ( - 1 ) ; return ; } ArrayList < Integer > ans = new ArrayList < > ( ) ; if ( b % 2 == 1 ) { for ( int i = 1 ; i < white . size ( ) ; i = i + 2 ) { for ( int start = white . get ( i ) - 1 ; start >= white . get ( i - 1 ) ; start -- ) { ans . add ( start ) ; } } } else { for ( int i = 1 ; i < black . size ( ) ; i = i + 2 ) { for ( int start = black . get ( i ) - 1 ; start >= black . get ( i - 1 ) ; start -- ) { ans . add ( start ) ; } } } System . out . println ( ans . size ( ) ) ; for ( int num : ans ) { System . out . print ( num + " ▁ " ) ; } } }

n = int ( input ( ) ) s1 = list ( input ( ) ) s2 = s1ans1 = ans2 = [ ] for i in range ( n - 1 ) : if s1 [ i ] == ' B ' : s1 [ i ] = ' W ' if s1 [ i + 1 ] == ' B ' : s1 [ i + 1 ] = ' W ' else : s1 [ i + 1 ] = ' B ' ans1 . append ( i + 1 ) if s1 [ n - 1 ] == ' W ' : print ( len ( ans1 ) ) if len ( ans1 ) > 0 : print ( * ans1 ) else : for i in range ( n - 1 ) : if s2 [ i ] == ' W ' : s2 [ i ] = ' B ' if s2 [ i + 1 ] == ' W ' : s2 [ i + 1 ] = ' B ' else : s2 [ i + 1 ] = ' W ' ans2 . append ( i + 1 ) if s2 [ n - 1 ] != ' W ' : print ( len ( ans2 ) ) if len ( ans2 ) > 0 : print ( * ans2 ) else : print ( " - 1" )   NEW_LINE


import sysimport mathfrom collections import defaultdict , Counter , deque   NEW_LINE


import java . awt . Desktop ;    import java . io . BufferedReader ;    import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . net . URI ; import java . net . URISyntaxException ; import java . sql . Array ; 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 . Iterator ; import java . util . LinkedHashMap ; import java . util . LinkedHashSet ; import java . util . LinkedList ; import java . util . List ; import java . util . Map ; 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 . TreeSet ; import java . util . Vector ;     public class codechef3 { static class comp implements Comparator < Integer > {   @ Override public int compare ( Integer o1 , Integer o2 ) { if ( Math . abs ( o1 ) > Math . abs ( o2 ) ) return - 1 ; else return 1 ; } }


import java . util . * ; import java . math . BigInteger ; public class asd { static Scanner s = new Scanner ( System . in ) ; public static void main ( String args [ ] ) throws Exception { int t = 1 ; while ( t -- > 0 ) { solve ( ) ; } } public static void solve ( ) { int n = s . nextInt ( ) ; String str = s . next ( ) ; ArrayList < Integer > list = new ArrayList < > ( ) ; char [ ] ch = str . toCharArray ( ) ; int b = 0 ; int w = 0 ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) { if ( ch [ i ] == ' W ' ) w ++ ; else b ++ ; } if ( w % 2 == 1 && b % 2 == 1 ) { System . out . println ( " - 1" ) ; return ; } int col = 9 ; if ( w % 2 == 0 ) col = 2 ; else if ( b % 2 == 0 ) col = 3 ; if ( col == 2 ) {


import java . util . * ; import java . lang . * ; import java . io . * ; public class Main { PrintWriter out ; FastReader sc ; long mod = ( long ) ( 1e9 + 7 ) ; long maxlong = Long . MAX_VALUE ; long minlong = Long . MIN_VALUE ; public void sol ( ) { int n = ni ( ) ; StringBuilder sb = new StringBuilder ( ) ; char [ ] ar = rl ( ) ; int a = 0 , b = 0 ; for ( char ch : ar ) { if ( ch == ' W ' ) a ++ ; else b ++ ; } if ( a % 2 != 0 && b % 2 != 0 ) pl ( " - 1" ) ; else { int p = 0 ; if ( a % 2 == 0 ) { for ( int i = 0 ; i < n - 1 ; i ++ ) { if ( ar [ i ] == ' W ' && ar [ i + 1 ] == ' W ' ) { sb . append ( i + 1 + " ▁ " ) ; ar [ i + 1 ] = ' B ' ; p ++ ; } else if ( ar [ i ] == ' W ' ) { ar [ i + 1 ] = ' W ' ; sb . append ( i + 1 + " ▁ " ) ; p ++ ; } } } else { for ( int i = 0 ; i < n - 1 ; i ++ ) { if ( ar [ i ] == ' B ' && ar [ i + 1 ] == ' B ' ) { ar [ i + 1 ] = ' W ' ; sb . append ( i + 1 + " ▁ " ) ; p ++ ; } else if ( ar [ i ] == ' B ' ) { ar [ i + 1 ] = ' B ' ; sb . append ( i + 1 + " ▁ " ) ; p ++ ; } } } pl ( p ) ; pl ( sb ) ; } } public static void main ( String [ ] args ) { Main g = new Main ( ) ; g . out = new PrintWriter ( System . out ) ; g . sc = new FastReader ( ) ; int t = 1 ;


import java . util . * ; import java . io . * ; import static java . lang . Math . * ;   public class PracticeProblem { public static FastReader in = new FastReader ( ) ; public static PrintWriter out = new PrintWriter ( System . out ) ; public static Set < Integer > [ ] graph ; public static long [ ] written ;   public static void main ( String [ ] args ) { int n = in . nextInt ( ) ;   graph = new Set [ n ] ; for ( int i = 0 ; i < n ; i ++ ) graph [ i ] = new HashSet < > ( ) ;   for ( int i = 0 ; i < n - 1 ; i ++ ) { int a = in . nextInt ( ) - 1 ; int b = in . nextInt ( ) - 1 ;   graph [ a ] . add ( b ) ; graph [ b ] . add ( a ) ; }   written = new long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) written [ i ] = in . nextInt ( ) ;   long [ ] answer = dfs ( 0 , - 1 ) ;   out . println ( abs ( answer [ 0 ] ) + abs ( answer [ 1 ] ) ) ;   out . close ( ) ; }   public static long [ ] dfs ( int vertex , int parent )

n = int ( input ( ) ) r = [ [ ] for i in range ( n + 1 ) ] r [ 1 ] = [ 0 ] for i in range ( n - 1 ) : a , b = map ( int , input ( ) . split ( ) ) r [ a ] . append ( b ) r [ b ] . append ( a ) t = list ( map ( int , input ( ) . split ( ) ) ) u , v = [ 0 ] * ( n + 1 ) , [ 0 ] * ( n + 1 ) for i , j in enumerate ( t , 1 ) : if j < 0 : u [ i ] = - j else : v [ i ] = j NEW_LINE


from sys import stdin , stdout , setrecursionlimitfrom collections import defaultdict , deque , Counter , OrderedDictfrom heapq import heappop , heappushimport threading   n = int ( stdin . readline ( ) )   graph = [ set ( ) for x in range ( n ) ]   for x in range ( n - 1 ) : a , b = [ int ( x ) for x in stdin . readline ( ) . split ( ) ] a -= 1 b -= 1   graph [ a ] . add ( b ) graph [ b ] . add ( a )   vals = [ int ( x ) for x in stdin . readline ( ) . split ( ) ]   bruh = [ ( 0 , - 1 ) ]   for x in range ( n ) : num , p = bruh [ x ] for y in graph [ num ] : if y != p : bruh . append ( ( y , num ) )   result = [ - 1 for x in range ( n ) ]   for v , parent in bruh [ : : - 1 ] : nP = 0 nN = 0 for x in graph [ v ] : if x != parent : p , n = result [ x ] nP = max ( nP , p ) nN = max ( nN , n ) nN = max ( nN , nP + vals [ v ] ) nP = max ( nP , nN - vals [ v ] ) result [ v ] = ( nP , nN )   ng , ps = result [ 0 ]   vals [ 0 ] += ps - ng   stdout . write ( str ( ng + ps ) ) NEW_LINE


import java . io . BufferedReader ; import java . io . FileReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . StringTokenizer ; import java . util . * ; import java . io . * ; public class codeforces { static class Student { int x , y ;


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . StringTokenizer ;   public class Solveaproblem { private static long [ ] arr ; private static ArrayList < Integer > [ ] graph ; private static long [ ] dfs ( int item , int prev ) { long min = 0 , max = 0 ; for ( int elem : graph [ item ] ) { if ( elem == prev ) continue ; long [ ] next = dfs ( elem , item ) ; min = Math . min ( min , next [ 0 ] ) ; max = Math . max ( max , next [ 1 ] ) ; } long x = arr [ item ] + min + max ; if ( x > 0 ) min -= x ; else max -= x ; return new long [ ] { min , max } ; } public static void main ( String [ ] args ) throws IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( reader . readLine ( ) ) ; graph = new ArrayList [ n ] ; for ( int i = 0 ; i < n ; i ++ ) graph [ i ] = new ArrayList < > ( ) ; for ( int i = 1 ; i < n ; i ++ ) { StringTokenizer sToken = new StringTokenizer ( reader . readLine ( ) ) ; int x = Integer . parseInt ( sToken . nextToken ( ) ) - 1 ; int y = Integer . parseInt ( sToken . nextToken ( ) ) - 1 ; graph [ x ] . add ( y ) ; graph [ y ] . add ( x ) ; } arr = new long [ n ] ; StringTokenizer sToken = new StringTokenizer ( reader . readLine ( ) ) ; for ( int i = 0 ; i < n ; i ++ ) arr [ i ] = Integer . parseInt ( sToken . nextToken ( ) ) ; long [ ] res = dfs ( 0 , - 1 ) ; System . out . println ( ( res [ 0 ] * ( - 1 ) ) + res [ 1 ] ) ; } }


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

for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) NEW_LINE b = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE s = set ( b ) NEW_LINE if len ( s ) == len ( b ) : NEW_LINE INDENT print ( " No " ) else : NEW_LINE print ( " Yes " ) NEW_LINE DEDENT


import sysimport NEW_LINE mathfrom NEW_LINE collections NEW_LINE import deque NEW_LINE


def func ( ) : dic = dict ( ) NEW_LINE for i in lst : if NEW_LINE i in dic : print ( ' YES ' ) NEW_LINE return else : dic [ i ] = 0 NEW_LINE print ( ' NO ' )     for _ in range ( int ( input ( ) ) ) : num = int ( input ( ) ) NEW_LINE lst = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE func ( ) NEW_LINE


from collections import defaultdict   for t in range ( int ( input ( ) ) ) : n = int ( input ( ) ) NEW_LINE b = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE d = defaultdict ( int ) NEW_LINE for x in b : d [ x ] += 1 NEW_LINE ok = False NEW_LINE for v in d . values ( ) : if NEW_LINE v > 1 : ok = True NEW_LINE break NEW_LINE print ( " YES " if ok else " NO " ) NEW_LINE


for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) NEW_LINE a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE l1 = list ( set ( a ) ) NEW_LINE if len ( a ) == len ( l1 ) : NEW_LINE INDENT print ( " NO " ) else : NEW_LINE print ( " YES " )   NEW_LINE DEDENT


import java . util . * ;   public class Check2 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; for ( int i = 0 ; i < t ; i ++ ) { int n = sc . nextInt ( ) ; int [ ] ar = new int [ n ] ; Map < Integer , Integer > map = new HashMap < > ( ) ; for ( int j = 0 ; j < n ; j ++ ) { ar [ j ] = sc . nextInt ( ) ; map . putIfAbsent ( ar [ j ] , 0 ) ; map . put ( ar [ j ] , map . get ( ar [ j ] ) + 1 ) ; } boolean check = false ; for ( Integer integer : map . keySet ( ) ) { if ( map . get ( integer ) >= 2 ) { check = true ; break ; } } if ( check ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; }


import java . io . * ; import java . util . HashSet ; import java . util . StringTokenizer ;


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . StringTokenizer ; import java . util . * ; import java . math . * ; public class er10a {

def solve ( ) : n = int ( input ( ) ) a = [ int ( x ) for x in input ( ) . split ( ' ▁ ' ) ] d = [ float ( ' inf ' ) ] * n prev = - float ( ' inf ' ) for i in range ( n ) : if a [ i ] == 0 : prev = i d [ i ] = min ( d [ i ] , i - prev ) next = float ( ' inf ' ) for i in range ( n - 1 , - 1 , - 1 ) : if a [ i ] == 0 : next = i d [ i ] = min ( d [ i ] , next - i ) return d   print ( * solve ( ) )   NEW_LINE


from bisect import bisect_left as blt = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) q , l = [ ] , [ 0 ] * tfor i in range ( t ) : if a [ i ] == 0 : q . append ( i ) r = len ( q ) for i in range ( t ) : if a [ i ] != 0 : p = bl ( q , i ) if p == 0 : l [ i ] = q [ 0 ] - i elif p == r : l [ i ] = i - q [ - 1 ] else : l [ i ] = min ( i - q [ p - 1 ] , q [ p ] - i ) print ( * l ) NEW_LINE


from array import * n = int ( input ( ) ) ar = list ( map ( int , input ( ) . split ( ) ) ) dist1 = [ ] dist2 = [ ] for i in range ( n ) : dist1 . append ( 0 ) dist2 . append ( 0 )   st = nfor i in range ( n ) : if ar [ i ] != 0 : dist1 [ i ] = st else : st = 0 st += 1 st = nar . reverse ( ) for i in range ( n ) : if ar [ i ] != 0 : dist2 [ i ] = st else : st = 0 st += 1 dist2 . reverse ( ) for i in range ( n ) : m = min ( dist1 [ i ] , dist2 [ i ] ) print ( m , end = " ▁ " ) ; print ( " \n " )   NEW_LINE


import java . util . * ; import java . util . Scanner ; import java . io . * ; import javax . lang . model . util . ElementScanner6 ; import static java . lang . System . out ; import java . util . Stack ; import java . util . Queue ; import java . util . LinkedList ;   public class B803 {   public static void main ( String args [ ] ) {   FastReader in = new FastReader ( ) ; PrintWriter pr = new PrintWriter ( new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ) ; int tc = 1 ;


import java . io . * ; import java . math . * ; import java . security . * ; import java . text . * ; import java . util . * ;    public class CodeForce { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringBuilder sb = new StringBuilder ( ) ;


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 final long INF = Long . MAX_VALUE ; 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 = 100000007 ;   private static final int MAXN = 300005 ; private static final int MAXA = 2000007 ; 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 . util . * ; import java . math . * ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;

def main ( ) : n = int ( input ( ) ) print ( f ' { n } \n { " ▁ " . join ( [ " 1 " ▁ for ▁ _ ▁ in ▁ range ( n ) ] ) } ' )     if __name__ == ' _ _ main _ _ ' : main ( ) NEW_LINE


import sys   def main ( ) : n = int ( sys . stdin . read ( ) . strip ( ) ) for i in range ( 9 , 0 , - 1 ) : if not n % i : return n // i , ( n // i * f ' { i } ▁ ' ) . strip ( )   print ( * main ( ) , sep = ' \n ' ) NEW_LINE


a = int ( input ( ) ) print ( a ) print ( * ( [ 1 ] * a ) ) NEW_LINE


def rec ( n , z , l , x , y ) : if n > z : return l elif n == z : l . append ( n ) return l else : if n not in l : l . append ( n ) rec ( n * x , z , l , x , y ) rec ( n * y , z , l , x , y )     def gcd ( x , y ) : if x < y : x , y = y , x if y == 0 : return x return gcd ( y , x % y )     def lcm ( x , y ) : if x < y : x , y = y , x gcd_ = gcd ( x , y ) return x * y // gcd_     def main_func ( ) : output_list = [ ] t = int ( input ( ) ) return str ( t ) + " \n " + " ▁ " . join ( [ str ( 1 ) for i in range ( t ) ] )     print ( main_func ( ) )       NEW_LINE


import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskA solver = new TaskA ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }   static class TaskA { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int t = in . nextInt ( ) ; out . println ( t ) ; for ( int i = 0 ; i < t ; i ++ ) { out . print ( "1 ▁ " ) ; } }   } }


import java . util . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int s = 0 ; System . out . println ( n ) ; for ( int i = 1 ; i <= n ; i ++ ) { System . out . print ( 1 + " ▁ " ) ;    } System . out . println ( ) ; } }


import java . util . Scanner ;    public class num {   public static void main ( String [ ] args ) { Scanner Input = new Scanner ( System . in ) ; int n = 0 ; n = Input . nextInt ( ) ; System . out . println ( n ) ; for ( int i = 0 ; i < n ; i ++ ) { System . out . print ( "1 ▁ " ) ; }    } }


import java . util . * ; import java . io . * ; import java . io . BufferedReader ;   public class Z_A { public static long mod = 1000000007 ; public static Debug db ;   public static void main ( String [ ] args ) throws IOException { InputReader in = new InputReader ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; Autocompletion solver = new Autocompletion ( ) ; db = new Debug ( System . getSecurityManager ( ) == null ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class Autocompletion {   public void solve ( int testNumber , InputReader in , PrintWriter out ) { int n = in . nextInt ( ) ; int m = in . nextInt ( ) ; int w = in . nextInt ( ) ; int warr [ ] = in . nextIntArr ( n ) ; int b [ ] = in . nextIntArr ( n ) ; UnionFind uf = new UnionFind ( n ) ; for ( int i = 0 ; i < m ; i ++ ) { int x = in . nextInt ( ) - 1 ; int y = in . nextInt ( ) - 1 ; uf . combine ( x , y ) ;

import math , sys , bisect , heapq , osfrom collections import defaultdict , Counter , dequefrom itertools import groupby , accumulatefrom functools import lru_cache NEW_LINE


def ler ( ) : return [ int ( x ) for x in input ( ) . split ( ) ]     def dfs ( u , adj , visited , s , Pesos , Belezas ) : visited [ u ] = True total_p = Pesos [ u ] total_b = Belezas [ u ] s . append ( u ) for v in adj [ u ] : if not visited [ v ] : w , b = dfs ( v , adj , visited , s , Pesos , Belezas ) total_p += w total_b += b return total_p , total_b n , m , w = ler ( ) Pesos = ler ( ) Belezas = ler ( ) adj = [ [ ] for _ in range ( n ) ] for _ in range ( m ) : x , y = ler ( ) x -= 1 y -= 1 adj [ x ] . append ( y ) adj [ y ] . append ( x ) visited = [ False ] * nf = [ 0 ] * ( w + 1 ) for i in range ( n ) : if visited [ i ] : continue   s = [ ] total_p , total_b = dfs ( i , adj , visited , s , Pesos , Belezas ) for j in range ( w , - 1 , - 1 ) : jw = j + total_p if jw <= w : f [ jw ] = max ( f [ jw ] , f [ j ] + total_b ) for v in s : jw = j + Pesos [ v ] if jw <= w : f [ jw ] = max ( f [ jw ] , f [ j ] + Belezas [ v ] ) print ( f [ w ] )   NEW_LINE


n , m , k = map ( int , input ( ) . split ( ) ) a = map ( int , input ( ) . split ( ) ) b = map ( int , input ( ) . split ( ) ) ab = [ ( 0 , 0 ) ] + list ( zip ( a , b ) ) l = list ( range ( n + 1 ) )   def f ( x ) : if x == l [ x ] : return x l [ x ] = f ( l [ x ] ) return l [ x ] for i in range ( m ) : x , y = map ( int , input ( ) . split ( ) ) x , y = f ( x ) , f ( y ) if x != y : l [ y ] = x p = [ [ ] for j in range ( n + 1 ) ] for i in range ( 1 , n + 1 ) : p [ f ( i ) ] . append ( i ) r = ( k + 1 ) * [ 0 ] r [ 0 ] = 1 for i in p : if len ( i ) > 1 : l = [ ab [ x ] for x in i ] x0 = sum ( x [ 0 ] for x in l ) x1 = sum ( x [ 1 ] for x in l ) l . append ( ( x0 , x1 ) ) l . sort ( ) for j in range ( k , - 1 , - 1 ) : if r [ j ] : for w , b in l : if j + w > k : break r [ j + w ] = max ( r [ j + w ] , r [ j ] + b ) elif len ( i ) == 1 : w , b = ab [ i [ 0 ] ] for j in range ( k - w , - 1 , - 1 ) : if r [ j ] : r [ j + w ] = max ( r [ j + w ] , r [ j ] + b ) res = max ( r ) - 1 print ( res ) NEW_LINE


import java . io . BufferedReader ; import java . io . FileReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . StringTokenizer ; import java . util . * ; import java . io . * ; public class codeforces { static class Student { int x , y ; Student ( int x , int y ) { this . x = x ; this . y = y ;


import java . util . * ; import java . io . * ;   public class b { static int [ ] parent , rank , weight , beauty , wt , bt ; static List < Integer > [ ] al ;   static void merge ( int a , int b ) { int u = find ( a ) ; int v = find ( b ) ; if ( u == v ) return ;   if ( rank [ u ] >= rank [ v ] ) { parent [ v ] = u ; beauty [ u ] += beauty [ v ] ; weight [ u ] += weight [ v ] ; } else { parent [ u ] = v ; beauty [ v ] += beauty [ u ] ; weight [ v ] += weight [ u ] ; } }   static int find ( int k ) { if ( parent [ k ] != k ) parent [ k ] = find ( parent [ k ] ) ; return parent [ k ] ; }   static long f ( List < Integer > list , int n , int w , long [ ] [ ] dp ) { if ( w < 0 ) return Integer . MIN_VALUE ; if ( n == 0 ) return 0 ; if ( dp [ n ] [ w ] != - 1 ) return dp [ n ] [ w ] ;   long a = f ( list , n - 1 , w , dp ) ;


from collections import Counter     def has_beautiful_splits ( s ) : counter = Counter ( s ) if len ( counter ) == 4 : return True elif len ( counter ) == 3 : return max ( counter . values ( ) ) > 1 elif len ( counter ) == 2 : return min ( counter . values ( ) ) > 1 return False     s = input ( ) print ( " Yes " if has_beautiful_splits ( s ) else " No " ) NEW_LINE


from collections import Counters = input ( ) A = [ char for char in s ]   A . sort ( ) c = Counter ( A ) if len ( c . keys ( ) ) > 4 : print ( " No " ) elif len ( c . keys ( ) ) == 4 : print ( " Yes " ) elif len ( c . keys ( ) ) == 3 : z = list ( c . values ( ) ) if z == [ 1 , 1 , 1 ] : print ( " No " ) else : print ( " Yes " ) elif len ( c . keys ( ) ) == 2 : z = list ( c . values ( ) ) if 1 in z : print ( " No " ) else : print ( " Yes " ) else : print ( " No " ) NEW_LINE


def adorable ( text ) : counter = { } for i in text : if i not in counter : counter [ i ] = 1 else : counter [ i ] += 1 n = len ( counter . keys ( ) ) if n == 1 : return " No " elif n == 2 : if all ( counter [ i ] >= 2 for i in counter ) : return " Yes " else : return " No " elif n == 3 : if any ( counter [ i ] >= 2 for i in counter ) : return " Yes " else : return " No " elif n == 4 : return " Yes " else : return " No "   print ( adorable ( input ( ) ) ) NEW_LINE


from sys import stdin , stdoutnmbr = lambda : int ( stdin . readline ( ) ) from collections import Counterlst = lambda : list ( map ( int , stdin . readline ( ) . split ( ) ) ) for _ in range ( 1 ) : s = input ( ) n = len ( s ) d = Counter ( s ) f = 1 ; cnt = 0 for k , v in d . items ( ) : if v == 1 : cnt += 1 if ( len ( d ) == 2 and cnt == 0 ) : print ( ' YES ' ) elif ( 3 == len ( d ) and cnt <= 2 ) : print ( ' YES ' ) elif ( len ( d ) == 4 ) : print ( ' YES ' ) else : print ( ' NO ' ) NEW_LINE


import java . util . Arrays ; import java . util . HashMap ; import java . util . Map ; import java . util . Scanner ; public class Main { static int maxn = 110 ; static int cnt [ ] = new int [ maxn ] ; public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; String s = in . next ( ) ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) cnt [ s . charAt ( i ) - ' a ' ] ++ ; int flag = 0 , flag2 = 0 ; for ( int i = 0 ; i < 26 ; i ++ ) { if ( cnt [ i ] > 1 ) flag ++ ; if ( cnt [ i ] >= 1 ) flag2 ++ ; } if ( flag2 > 4 ) System . out . println ( " No " ) ; else if ( flag >= 2 || flag2 > 3 || ( flag == 1 && flag2 >= 3 ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } }


import java . io . IOException ; import java . util . Scanner ;   public class Main { static Scanner in = new Scanner ( System . in ) ; public static void main ( String [ ] args ) throws IOException { int a2 = query ( 1 , 2 ) ; int a3 = query ( 1 , 3 ) ; int a4 = query ( 1 , 4 ) ; int a5 = query ( 1 , 5 ) ; int a1 = gcd ( gcd ( a2 , a3 ) , gcd ( a4 , a5 ) ) ; if ( a1 == 15 * 2 || a1 == 23 * 2 ) { a1 /= 2 ; } a2 /= a1 ; a3 /= a1 ; a4 /= a1 ; a5 /= a1 ; int a6 = 4 + 8 + 15 + 16 + 23 + 42 - a1 - a2 - a3 - a4 - a5 ; System . out . println ( " ! ▁ " + a1 + " ▁ " + a2 + " ▁ " + a3 + " ▁ " + a4 + " ▁ " + a5 + " ▁ " + a6 ) ; } public static int query ( int i , int j ) { System . out . println ( " ? ▁ " + i + " ▁ " + j ) ; System . out . flush ( ) ; return in . nextInt ( ) ; } public static int gcd ( int a , int b ) { return b == 0 ? a : gcd ( b , a % b ) ; } }

from itertools import permutationsprint ( ' ? ▁ 1 ▁ 2' ) print ( ' ? ▁ 2 ▁ 3' ) print ( ' ? ▁ 3 ▁ 4' ) print ( ' ? ▁ 4 ▁ 5' ) ab = int ( input ( ) ) bc = int ( input ( ) ) cd = int ( input ( ) ) de = int ( input ( ) )   s = [ 4 , 8 , 15 , 16 , 23 , 42 ] for l in permutations ( s ) : if l [ 0 ] * l [ 1 ] == ab and l [ 1 ] * l [ 2 ] == bc and l [ 2 ] * l [ 3 ] == cd and l [ 3 ] * l [ 4 ] == de : print ( f ' ! ▁ { l [ 0 ] } ▁ { l [ 1 ] } ▁ { l [ 2 ] } ▁ { l [ 3 ] } ▁ { l [ 4 ] } ▁ { l [ 5 ] } ' ) NEW_LINE


''' bsdchodi ▁ ques better ▁ to ▁ take ▁ 1 ▁ element ▁ common ▁ in ▁ all ▁ and ▁ just ▁ find ▁ it   '''       l = [ 4 , 8 , 15 , 16 , 23 , 42 ] print ( ' ? ' , 1 , 5 ) a = int ( input ( ) ) print ( ' ? ' , 2 , 5 ) b = int ( input ( ) ) print ( ' ? ' , 3 , 5 ) c = int ( input ( ) ) print ( ' ? ' , 4 , 5 ) d = int ( input ( ) ) l = l [ : : - 1 ] v = 0 for i in range ( 0 , len ( l ) ) : if a // l [ i ] in l and b // l [ i ] in l and c // l [ i ] in l and d // l [ i ] in l : v = l [ i ] breakm = [ ] m . append ( a // v ) m . append ( b // v ) m . append ( c // v ) m . append ( d // v ) m . append ( v ) o = list ( set ( l ) - set ( m ) ) m = m + oprint ( ' ! ' , * m ) NEW_LINE


from math import gcdans = [ ] print ( ' ? ▁ 1 ▁ 2' , flush = True ) a = int ( input ( ) ) print ( ' ? ▁ 1 ▁ 3' , flush = True ) b = int ( input ( ) ) print ( ' ? ▁ 1 ▁ 4' , flush = True ) c = int ( input ( ) ) print ( ' ? ▁ 1 ▁ 5' , flush = True ) d = int ( input ( ) ) ans . append ( gcd ( gcd ( a , b ) , gcd ( c , d ) ) ) if ans [ 0 ] in [ 2 * 15 , 2 * 23 ] : ans [ 0 ] //= 2 ans . append ( a // ans [ 0 ] ) ans . append ( b // ans [ 0 ] ) ans . append ( c // ans [ 0 ] ) ans . append ( d // ans [ 0 ] ) ans . append ( [ x for x in [ 4 , 8 , 15 , 16 , 23 , 42 ] if x not in ans ] [ 0 ] ) print ( ' ! ' , * ans ) NEW_LINE


import sysimport mathimport itertools def ask ( l , r ) : print ( ' ? ' , l , r ) sys . stdout . flush ( ) n = int ( input ( ) ) return n def answer ( lst ) : print ( ' ! ' , * lst ) jury = [ 4 , 8 , 15 , 16 , 23 , 42 ] perm = list ( itertools . permutations ( jury ) ) ab = ask ( 1 , 2 ) bc = ask ( 2 , 3 ) cd = ask ( 3 , 4 ) de = ask ( 4 , 5 ) for a , b , c , d , e , f in perm : if a * b == ab and b * c == bc and c * d == cd and d * e == de : answer ( [ a , b , c , d , e , f ] ) NEW_LINE


import java . util . Arrays ; import java . util . Scanner ;   public class task1 { static Scanner scanner = new Scanner ( System . in ) ;   public static void main ( String [ ] args ) { int food [ ] = new int [ 3 ] ; int n = scanner . nextInt ( ) ; for ( int j = 0 ; j < n ; j ++ ) { for ( int i = 0 ; i < 3 ; i ++ ) { food [ i ] = scanner . nextInt ( ) ; } Arrays . sort ( food ) ; if ( food [ 0 ] == 0 ) { if ( food [ 1 ] == 0 && food [ 2 ] == 0 ) System . out . println ( 0 ) ; else if ( food [ 1 ] == 0 && food [ 2 ] >= 1 ) System . out . println ( 1 ) ; else if ( food [ 1 ] == 1 && food [ 2 ] >= 1 ) System . out . println ( 2 ) ; else if ( food [ 1 ] > 1 && food [ 2 ] > 1 ) System . out . println ( 3 ) ; } else if ( food [ 0 ] == 1 && food [ 1 ] == 1 && food [ 2 ] >= 1 ) System . out . println ( 3 ) ; else if ( ( food [ 0 ] == 1 && food [ 1 ] >= 2 && food [ 2 ] >= 2 ) || ( food [ 0 ] == 2 && food [ 1 ] == 2 && food [ 2 ] == 2 ) ) System . out . println ( 4 ) ; else if ( food [ 0 ] == 2 && food [ 1 ] >= 2 && food [ 2 ] > 2 ) System . out . println ( 5 ) ; else if ( food [ 0 ] == 3 && food [ 1 ] >= 3 && food [ 2 ] >= 3 ) System . out . println ( 6 ) ; else System . out . println ( 7 ) ;   } } }

def solve ( a , b , c ) : slist = [ a , b , c ] slist . sort ( ) a , b , c = slist mlist = [ ( 0 , 0 , 1 ) , ( 0 , 1 , 0 ) , ( 1 , 0 , 0 ) , ( 0 , 1 , 1 ) , ( 1 , 0 , 1 ) , ( 1 , 1 , 0 ) , ( 1 , 1 , 1 ) ] cnt = 0   for da , db , dc in mlist : if a >= da and b >= db and c >= dc : a -= da b -= db c -= dc cnt += 1   return cnt   if __name__ == ' _ _ main _ _ ' : T = int ( input ( ) ) for t in range ( T ) : a , b , c = tuple ( map ( int , input ( ) . split ( ) ) ) print ( solve ( a , b , c ) ) NEW_LINE


import mathimport operator   def lcm ( a , b ) : return ( a / math . gcd ( a , b ) ) * b def nCr ( n , r ) : return ( ( math . factorial ( n ) ) / ( ( math . factorial ( r ) ) * ( math . factorial ( n - r ) ) ) )       def isKthBitSet ( n , k ) : if ( n & ( 1 << ( k - 1 ) ) ) : return True else : return Falsedef maximalRectangle ( matrix ) : if not matrix or not matrix [ 0 ] : return 0 n = len ( matrix [ 0 ] ) height = [ 0 ] * ( n + 1 ) ans = 0 for row in matrix : for i in range ( n ) : height [ i ] = height [ i ] + 1 if row [ i ] == '0' else 0 stack = [ - 1 ] for i in range ( n + 1 ) : while height [ i ] < height [ stack [ - 1 ] ] : h = height [ stack . pop ( ) ] w = i - 1 - stack [ - 1 ] ans = max ( ans , h * w ) stack . append ( i ) return ans     def matched ( str ) : count = 0 for i in str : if i == " ( " : count += 1 elif i == " ) " : count -= 1 if count < 0 : return False return count == 0   def isValid ( h , m , nh , nm ) : l = [ 0 , 1 , 5 , - 1 , - 1 , 2 , - 1 , - 1 , 8 , - 1 ] if ( l [ h // 10 ] == - 1 or l [ h % 10 ] == - 1 or l [ m // 10 ] == - 1 or l [ m % 10 ] == - 1 ) : return False resh = l [ m % 10 ] * 10 + l [ m // 10 ] resm = l [ h % 10 ] * 10 + l [ h // 10 ]   return ( resh < nh and resm < nm )       def solve ( ) :   a , b , c = map ( int , input ( ) . split ( ) ) NEW_LINE


test_number = int ( input ( ) )   for i in range ( test_number ) : dishes = sorted ( list ( map ( int , input ( ) . split ( ) ) ) , reverse = True )   visitor = 0   for i in range ( len ( dishes ) ) : if dishes [ i ] > 0 : dishes [ i ] -= 1 visitor += 1   for j in range ( 2 ) : for i in range ( 1 , 3 ) : if dishes [ j ] > 0 and dishes [ i ] > 0 and i > j : dishes [ j ] -= 1 dishes [ i ] -= 1 visitor += 1                 if dishes [ 0 ] > 0 and dishes [ 1 ] > 0 and dishes [ 2 ] > 0 : visitor += 1   print ( visitor ) NEW_LINE


T_ON = 1 DEBUG_ON = 0 MOD = 998244353     def solve ( ) : A = read_ints ( ) A . sort ( ) a , b , c = A total = 0 NEW_LINE


cases = int ( input ( ) ) while cases : cases -= 1 a , b , c = sorted ( map ( int , input ( ) . split ( ) ) , reverse = True ) ans = 0   if a : a -= 1 ans += 1 if b : b -= 1 ans += 1 if c : c -= 1 ans += 1 if a and b : a -= 1 b -= 1 ans += 1 if a and c : a -= 1 c -= 1 ans += 1 if c and b : c -= 1 b -= 1 ans += 1 if a and b and c : ans += 1   print ( ans ) NEW_LINE


import java . util . Scanner ;   public class FastFoodRestaurant { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int testCase = scanner . nextInt ( ) ; while ( ( testCase -- ) != 0 ) { int a = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ; int c = scanner . nextInt ( ) ; if ( b > a ) { int tmp = a ; a = b ; b = tmp ; } if ( c > a ) { int tmp = a ; a = c ; c = tmp ; } if ( c > b ) { int tmp = c ; c = b ; b = tmp ; }   int cnt = 0 ; if ( a != 0 ) { -- a ; ++ cnt ; } if ( b != 0 ) { -- b ; ++ cnt ; } if ( c != 0 ) { -- c ; ++ cnt ; } if ( a != 0 && b != 0 ) { ++ cnt ; -- a ; -- b ; } if ( a != 0 && c != 0 ) { ++ cnt ; -- a ; -- c ; } if ( b != 0 && c != 0 ) { ++ cnt ; -- b ; -- c ; } if ( a != 0 && b != 0 && c != 0 ) { ++ cnt ; -- a ; -- b ; -- c ; }   System . out . println ( cnt ) ; }   }   }


import java . io . * ; import java . math . BigInteger ; import java . util . * ; public class Codeforces { public static void main ( String args [ ] ) throws FileNotFoundException , IOException { Scanner scan = new Scanner ( System . in ) ; int t = scan . nextInt ( ) ; while ( t -- > 0 ) { int arr [ ] = new int [ 3 ] ; arr [ 0 ] = scan . nextInt ( ) ; arr [ 1 ] = scan . nextInt ( ) ; arr [ 2 ] = scan . nextInt ( ) ; Arrays . sort ( arr ) ; int count = 0 ; if ( arr [ 0 ] > 0 || arr [ 1 ] > 0 || arr [ 2 ] > 0 ) { if ( arr [ 0 ] > 0 ) { arr [ 0 ] -- ; count ++ ; } if ( arr [ 1 ] > 0 ) { arr [ 1 ] -- ; count ++ ; } if ( arr [ 2 ] > 0 ) { arr [ 2 ] -- ; count ++ ; } } if ( arr [ 2 ] > 0 && arr [ 1 ] > 0 ) { arr [ 2 ] -- ; arr [ 1 ] -- ; count += 1 ; } if ( arr [ 2 ] > 0 && arr [ 0 ] > 0 ) { arr [ 2 ] -- ; arr [ 0 ] -- ; count += 1 ; } if ( arr [ 1 ] > 0 && arr [ 0 ] > 0 ) { arr [ 1 ] -- ; arr [ 0 ] -- ; count += 1 ; } if ( arr [ 2 ] > 0 && arr [ 1 ] > 0 && arr [ 0 ] > 0 ) { arr [ 2 ] -- ; arr [ 1 ] -- ; arr [ 0 ] -- ; count += 1 ; } System . out . println ( count ) ; } } }


import java . util . * ; public class fastfoodrestaurant { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; for ( int i = 1 ; i <= t ; i ++ ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int count = 0 ; int A [ ] = { 1 , 0 , 0 , 1 , 1 , 0 , 1 } ; int B [ ] = { 0 , 1 , 0 , 1 , 0 , 1 , 1 } ; int C [ ] = { 0 , 0 , 1 , 0 , 1 , 1 , 1 } ; if ( c > a ) { int k = c ; c = a ; a = k ; } for ( int j = 0 ; j <= 6 ; j ++ ) { if ( a - A [ j ] >= 0 && b - B [ j ] >= 0 && c - C [ j ] >= 0 ) { a = a - A [ j ] ; b = b - B [ j ] ; c = c - C [ j ] ; count ++ ; } } System . out . println ( count ) ; } } }


import java . util . Scanner ; public class CF800 { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int x = input . nextInt ( ) ; int counter = 0 ; int counter2 = 1 ; int [ ] y = new int [ x ] ; for ( int i = 0 ; i < y . length ; i ++ ) { y [ i ] = input . nextInt ( ) ; counter ++ ; } for ( int c = 0 ; c < counter - 1 ; c ++ ) { if ( y [ c ] != y [ c + 1 ] ) { counter2 ++ ; } } System . out . println ( counter2 ) ; } }

def function ( Str , X ) : import itertools Lst = [ ] for i , j in itertools . groupby ( Str ) : if i == X : Lst . append ( len ( list ( j ) ) ) return Lst N = int ( input ( ) ) Lst1 = [ ] for _ in range ( N ) : Str = input ( ) Lst1 . append ( Str ) NStr1 = " " . join ( Lst1 )   NStr = NStr1 . replace ( "10" , " P " ) NStr2 = NStr . replace ( "01" , " Q " )       Val = len ( function ( NStr2 , " P " ) )   Val1 = len ( function ( NStr2 , " Q " ) )   print ( Val + Val1 ) NEW_LINE


""" n = input ( ) . strip ( ) m = input ( ) . strip ( ) s = n [ : : -1 ] if ▁ s = = m : ▁ ▁ ▁ ▁ print ( " YES " ) else : ▁ ▁ ▁ ▁ print ( " NO " )  n = int ( input ( ) ) s = input ( ) . strip ( ) if ▁ s . count ( ' A ' ) > s . count ( ' D ' ) : ▁ ▁ ▁ ▁ print ( " Anton " ) elif ▁ s . count ( ' A ' ) < s . count ( ' D ' ) : ▁ ▁ ▁ ▁ print ( " Danik " ) else : ▁ ▁ ▁ ▁ print ( " Friendship " ) """ """ n = input ( ) . strip ( ) if ▁ ' H ' ▁ in ▁ n ▁ or ▁ ' Q ' ▁ in ▁ n ▁ or ▁ ' 9 ' ▁ in ▁ n : ▁ ▁ ▁ ▁ print ( " YES " ) else : ▁ ▁ ▁ ▁ print ( " NO " ) """ """ n , h = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) c = 0for ▁ i ▁ in ▁ a : ▁ ▁ ▁ ▁ if ▁ i > h : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ c = c + 2 ▁ ▁ ▁ ▁ else : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ c = c + 1print ( c ) """ """ c = 0for ▁ i ▁ in ▁ range ( int ( input ( ) ) ) : ▁ ▁ ▁ ▁ p , q = map ( int , input ( ) . split ( ) ) ▁ ▁ ▁ ▁ if ▁ ( q - p ) > = 2 : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ c = c + 1print ( c ) """ p = [ ] c = 1 for i in range ( int ( input ( ) ) ) : s = input ( ) p . append ( s ) if len ( p ) == 1 : print ( 1 ) else : for i in range ( len ( p ) - 1 ) : if p [ i ] != p [ i + 1 ] : c = c + 1 print ( c ) NEW_LINE


n = int ( input ( ) ) poles = [ ] for _ in range ( n ) : poles . append ( input ( ) ) num_groups = 1 for i in range ( n - 1 ) : if not int ( poles [ i ] [ 1 ] ) ^ int ( poles [ i + 1 ] [ 0 ] ) : num_groups += 1 print ( num_groups ) NEW_LINE


n = int ( input ( ) ) c = 1 for i in range ( n ) : if i == 0 : new = input ( ) continue old = new new = input ( ) if old [ 1 ] == new [ 0 ] : c += 1 print ( c ) NEW_LINE


n = int ( input ( ) ) current = input ( ) c = 1 for _ in range ( 1 , n ) : x = input ( ) if current != x : c += 1 current = xprint ( c ) NEW_LINE


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


import java . util . * ; public class magnets { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int c = 0 , d = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int m = sc . nextInt ( ) ; if ( m != c ) { c = m ; d ++ ; } } System . out . println ( d ) ; } }


import java . io . * ; import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String [ ] arr = new String [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = sc . next ( ) ; } int cnt = 1 ; for ( int i = 0 ; i < n - 1 ; i ++ ) { if ( ! ( arr [ i ] . equals ( arr [ i + 1 ] ) ) ) { cnt ++ ; } } System . out . println ( cnt ) ; } }


import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ;   public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; FastScanner in = new FastScanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; AMagnets solver = new AMagnets ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }   static class AMagnets { public void solve ( int testNumber , FastScanner fs , PrintWriter out ) { int n = fs . nextInt ( ) ; int rep = 0 ; String p = fs . next ( ) , t ; for ( int i = 1 ; i < n ; i ++ ) { t = fs . next ( ) ; if ( t . charAt ( 0 ) == p . charAt ( 1 ) ) { rep ++ ; } p = t ; } rep ++ ; out . println ( rep ) ; }   }   static class FastScanner { BufferedReader br ; StringTokenizer st ;   public FastScanner ( InputStream inputStream ) { br = new BufferedReader ( new InputStreamReader ( inputStream ) ) ; }   public String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; }   public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   } }


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 final long INF = Long . MAX_VALUE ; 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 = 100000007 ;   private static final int MAXN = 300005 ; private static final int MAXA = 100007 ; private static final int MAXLOG = 22 ;   public static void main ( String [ ] args ) throws IOException {   InputReader in = new InputReader ( System . in ) ;

n , m = map ( int , input ( ) . split ( ) ) arr = [ [ 0 , 0 , 0 , 0 ] for i in range ( n ) ]   i = 1 pos = 0 while 1 : if i > m or pos == n : break if i <= m : arr [ pos ] [ 0 ] = i i += 1 if i <= m : arr [ pos ] [ 3 ] = i i += 1 pos += 1   pos = 0 while 1 : if i > m or pos == n : break if i <= m : arr [ pos ] [ 1 ] = i i += 1 if i <= m : arr [ pos ] [ 2 ] = i i += 1 pos += 1       for i in arr : if i [ 1 ] : print ( i [ 1 ] , end = " ▁ " ) if i [ 0 ] : print ( i [ 0 ] , end = " ▁ " ) if i [ 2 ] : print ( i [ 2 ] , end = " ▁ " ) if i [ 3 ] : print ( i [ 3 ] , end = " ▁ " )   NEW_LINE


def STR ( ) : return list ( input ( ) ) def INT ( ) : return int ( input ( ) ) def MAP ( ) : return map ( int , input ( ) . split ( ) ) def MAP2 ( ) : return map ( float , input ( ) . split ( ) ) def LIST ( ) : return list ( map ( int , input ( ) . split ( ) ) ) def STRING ( ) : return input ( ) import stringimport sysfrom heapq import heappop , heappushfrom bisect import * from collections import deque , Counter , defaultdictfrom math import * from itertools import permutations , accumulatedx = [ - 1 , 1 , 0 , 0 ] dy = [ 0 , 0 , 1 , - 1 ] NEW_LINE


n , m = input ( ) . split ( ) n , m = int ( n ) , int ( m ) temp = 1 groos = n * 2 + 1 while groos <= m : print ( groos , end = " ▁ " ) print ( temp , end = " ▁ " ) groos , temp = groos + 1 , temp + 1 while temp <= min ( n * 2 , m ) : print ( temp , end = " ▁ " ) temp += 1 NEW_LINE


n , m = map ( int , input ( ) . split ( ) ) a , b , c , d = [ ] , [ ] , [ ] , [ ] for i in range ( n ) : if 2 * i + 1 <= m : a . append ( 2 * i + 1 ) NEW_LINE


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


import java . util . Arrays ; import java . util . Scanner ;   public class B1430 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int T = in . nextInt ( ) ; for ( int t = 0 ; t < T ; t ++ ) { int N = in . nextInt ( ) ; int K = in . nextInt ( ) ; Integer [ ] A = new Integer [ N ] ; for ( int n = 0 ; n < N ; n ++ ) { A [ n ] = in . nextInt ( ) ; } Arrays . sort ( A ) ; long answer = 0 ; for ( int n = 1 ; n <= K + 1 ; n ++ ) { answer += A [ N - n ] ; } System . out . println ( answer ) ; } }   }

for i in range ( int ( input ( ) ) ) : n , k = map ( int , input ( ) . split ( ) ) NEW_LINE lis = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE temp = 0 NEW_LINE rr = sorted ( lis , reverse = True ) NEW_LINE for i in range ( k + 1 ) : temp += rr [ i ] NEW_LINE print ( temp ) NEW_LINE


for i in range ( int ( input ( ) ) ) : n , k = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE print ( sum ( sorted ( list ( map ( int , input ( ) . split ( ) ) ) ) [ : : - 1 ] [ : k + 1 ] ) ) NEW_LINE


t = int ( input ( ) ) NEW_LINE for j in range ( t ) : a , b = map ( int , input ( ) . split ( ' ▁ ' ) ) NEW_LINE k = list ( map ( int , input ( ' ' ) . split ( ' ▁ ' ) ) ) NEW_LINE if k . count ( 0 ) == a : NEW_LINE INDENT print ( 0 ) else : NEW_LINE k = sorted ( k ) NEW_LINE DEDENT z = max ( k ) NEW_LINE for i in range ( 1 , b + 1 ) : z += k [ a - 1 - i ] NEW_LINE print ( z ) NEW_LINE


for _ in range ( int ( input ( ) ) ) : n , k = map ( int , input ( ) . split ( ) ) NEW_LINE A = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE A . sort ( ) NEW_LINE print ( sum ( A [ - k - 1 : ] ) ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Arrays ; import java . util . Collections ;   public class barrels { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int t = Integer . parseInt ( br . readLine ( ) ) ; for ( int i = 0 ; i < t ; i ++ ) { int [ ] rong0 = Arrays . stream ( br . readLine ( ) . split ( " \\ s " ) ) . mapToInt ( Integer :: parseInt ) . toArray ( ) ; int [ ] rong = Arrays . stream ( br . readLine ( ) . split ( " \\ s " ) ) . mapToInt ( Integer :: parseInt ) . toArray ( ) ; int n = rong0 [ 0 ] , k = rong0 [ 1 ] ; Integer [ ] newArray = new Integer [ rong . length ] ; int x = 0 ; for ( int value : rong ) { newArray [ x ++ ] = Integer . valueOf ( value ) ; } Arrays . sort ( newArray , Collections . reverseOrder ( ) ) ; long sum = 0 ; for ( int d = 0 ; d <= k ; d ++ ) { sum += newArray [ d ] ; } System . out . println ( sum ) ; } }   }


import java . util . * ; public class LittleElephantandMagicSquare { public static void main ( String arg [ ] ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] arr = new int [ 3 ] [ 3 ] ; long sum = 0 ;   for ( int i = 0 ; i < 3 ; i ++ ) { for ( int j = 0 ; j < 3 ; j ++ ) { arr [ i ] [ j ] = sc . nextInt ( ) ; sum += arr [ i ] [ j ] ; } }   sum /= 2 ;   arr [ 0 ] [ 0 ] = ( int ) sum - arr [ 0 ] [ 1 ] - arr [ 0 ] [ 2 ] ; arr [ 1 ] [ 1 ] = ( int ) sum - arr [ 1 ] [ 0 ] - arr [ 1 ] [ 2 ] ; arr [ 2 ] [ 2 ] = ( int ) sum - arr [ 2 ] [ 0 ] - arr [ 2 ] [ 1 ] ;   System . out . println ( ) ;   for ( int i = 0 ; i < 3 ; i ++ ) { for ( int j = 0 ; j < 3 ; j ++ ) { System . out . print ( arr [ i ] [ j ] + " ▁ " ) ; } System . out . println ( ) ; }      } }

a , b , c = map ( int , input ( ) . split ( ) ) d , e , f = map ( int , input ( ) . split ( ) ) g , h , i = map ( int , input ( ) . split ( ) )   sum1 = a + b + csum2 = d + e + fsum3 = g + h + ia = ( sum1 + sum2 + sum3 ) // 2 - ( sum1 ) e = ( sum1 + sum2 + sum3 ) // 2 - ( sum2 ) i = ( sum1 + sum2 + sum3 ) // 2 - ( sum3 ) print ( a , b , c ) print ( d , e , f ) print ( g , h , i )           NEW_LINE


""" ▁ ▁ ▁ ▁ https : / / codeforces . com / problemset / problem / 259 / B """ import fileinput   def sommeColonne ( t , col ) : res = 0 for i in range ( 3 ) : res += t [ i ] [ col ] return res   def sommeLigne ( t , lig ) : res = 0 for i in range ( 3 ) : res += t [ lig ] [ i ] return res   def sommeDiag1 ( t ) : return t [ 0 ] [ 0 ] + t [ 1 ] [ 1 ] + t [ 2 ] [ 2 ]   def sommeDiag2 ( t ) : return t [ 0 ] [ 2 ] + t [ 1 ] [ 1 ] + t [ 2 ] [ 0 ]   def valide ( v ) : return v >= 1 and v <= 100000   def cherche ( t ) : """ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ Recherche ▁ par ▁ force ▁ brute . . . ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ Un ▁ candidat ▁ est ▁ un ▁ triplet ▁ de ▁ nombres ▁ ( la ▁ diagonale ) . ▁ ▁ ▁ ▁ """ NEW_LINE


import java . util . * ; public class Practice { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int i , j , sum = 0 ; int [ ] [ ] a = new int [ 3 ] [ 3 ] ; for ( i = 0 ; i < 3 ; ++ i ) for ( j = 0 ; j < 3 ; ++ j ) { a [ i ] [ j ] = scan . nextInt ( ) ; sum += a [ i ] [ j ] ; } a [ 0 ] [ 0 ] = sum / 2 - ( a [ 1 ] [ 0 ] + a [ 2 ] [ 0 ] ) ; a [ 1 ] [ 1 ] = sum / 2 - ( a [ 0 ] [ 1 ] + a [ 2 ] [ 1 ] ) ; a [ 2 ] [ 2 ] = sum / 2 - ( a [ 0 ] [ 2 ] + a [ 1 ] [ 2 ] ) ; for ( i = 0 ; i < 3 ; ++ i ) { System . out . println ( ) ; for ( j = 0 ; j < 3 ; ++ j ) System . out . print ( a [ i ] [ j ] + " ▁ " ) ; } } }


import java . util . * ; import java . lang . * ; import java . io . * ;   public class FastIO { BufferedReader br ; StringTokenizer st ; public FastIO ( ) {


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


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class CF1372_D2_B { public static void main ( String [ ] args ) { FastScanner scanner = new FastScanner ( ) ; int t = scanner . nextInt ( ) ; StringBuilder out = new StringBuilder ( ) ; for ( int i = 0 ; i < t ; i ++ ) { solve ( scanner , out ) ; } System . out . print ( out ) ; }   private static void solve ( FastScanner scanner , StringBuilder out ) { int n = scanner . nextInt ( ) ;

def largest_factor ( n ) : if ( n % 3 == 0 ) : return n // 3 i = 5 while i ** 2 <= n : if ( n % i == 0 ) : return ( n // i ) if ( n % ( i + 2 ) ) == 0 : return n // ( i + 2 ) i += 6 return 1 def answer ( n ) : if n % 2 == 0 : return [ n // 2 , n // 2 ] NEW_LINE


for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) p = 0 for i in range ( 2 , int ( n ** 0.5 ) + 1 ) : if n % i == 0 : p = i break if p == 0 : p = n print ( n // p , n - ( n // p ) )   NEW_LINE


from math import sqrtdef isPrime ( n ) : if ( n <= 1 ) : return False if ( n <= 3 ) : return True if ( n % 2 == 0 or n % 3 == 0 ) : return False i = 5 while ( i * i <= n ) : if ( n % i == 0 or n % ( i + 2 ) == 0 ) : return False i = i + 6 return True   def fun ( n ) : if n % 2 == 0 : return n // 2 , n // 2 elif isPrime ( n ) : return 1 , n - 1 else : for i in range ( 2 , n // 2 ) : if isPrime ( i ) and n % i == 0 : return n // i , n - ( n // i )   for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) print ( * fun ( n ) ) NEW_LINE


from sys import stdin , stdoutstdin . readlinedef mp ( ) : return list ( map ( int , stdin . readline ( ) . strip ( ) . split ( ) ) ) def it ( ) : return int ( stdin . readline ( ) . strip ( ) ) from collections import defaultdict as dd , Counter as C , dequefrom math import ceil , gcd   def factors ( n ) : s = set ( ) i = 2 while i * i <= n : if n % i == 0 : s . add ( i ) s . add ( n // i ) i += 1 return sorted ( list ( s ) )   for _ in range ( it ( ) ) : n = it ( ) x = factors ( n ) NEW_LINE


from math import * t = int ( input ( ) ) for _ in range ( t ) : n = int ( input ( ) )   i = 2 res = n - 1 while i <= sqrt ( n ) : if n % i == 0 : res = n // i break i += 1   print ( res , n - res ) NEW_LINE


import java . awt . Desktop ;   import java . io . BufferedReader ;    import java . io . IOException ; import java . io . InputStreamReader ; import java . net . URI ; import java . net . URISyntaxException ; import java . sql . Array ; 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 . Iterator ; import java . util . LinkedHashMap ; import java . util . LinkedHashSet ; import java . util . LinkedList ; import java . util . List ; import java . util . Map ; 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 . TreeSet ; import java . util . Vector ;     public class codechef3 { static class comp implements Comparator < Integer > {   @ Override public int compare ( Integer o1 , Integer o2 ) { if ( Math . abs ( o1 ) > Math . abs ( o2 ) ) return - 1 ; else return 1 ; }   }   static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } }


import java . io . * ; import java . math . BigInteger ; import java . util . * ;    public class test1 {   static long getLCM ( int a , int b ) { int bigger = 0 , smaller = 0 ; if ( a > b ) { bigger = a ; smaller = b ; } else { bigger = b ; smaller = a ; }   if ( bigger % smaller == 0 ) return bigger ; long counter = 2 ; long num = bigger ; while ( num < Integer . MAX_VALUE ) { if ( ( num * counter ) % smaller == 0 ) { return num * counter ; } counter ++ ; } return ( long ) a * b ; }   public static void main ( String [ ] args ) throws IOException { long startTime = System . currentTimeMillis ( ) ; Reader sc = new Reader ( ) ; int t = sc . nextInt ( ) ; StringBuilder finalResult = new StringBuilder ( ) ;


import java . util . Scanner ; import java . util . ArrayList ; import java . util . Collections ; public class Main { public static void main ( String args [ ] ) { Scanner s = new Scanner ( System . in ) ; int t = s . nextInt ( ) ; while ( t -- != 0 ) { long n = s . nextLong ( ) ; ArrayList < Long > list = new ArrayList < > ( ) ; for ( long i = 1 ; i <= Math . sqrt ( n ) ; i ++ ) { if ( n % i == 0 ) { list . add ( i ) ; if ( n / i != i ) { list . add ( n / i ) ; } } } Collections . sort ( list ) ; long a = 0 , b = 0 , max = Long . MAX_VALUE ; for ( int i = 0 ; i < list . size ( ) - 1 ; i ++ ) {


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . math . BigInteger ;   import java . util . * ; import javafx . util . Pair ;   public class Main { public static void main ( String args [ ] ) { FastScanner input = new FastScanner ( ) ; int n = input . nextInt ( ) ; int m = input . nextInt ( ) ; int k = input . nextInt ( ) ; int ans [ ] = new int [ m ] ; char a [ ] [ ] = new char [ n ] [ m ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = input . next ( ) . toCharArray ( ) ; } for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { if ( a [ i ] [ j ] == ' U ' ) { if ( i % 2 == 0 ) ans [ j ] ++ ; } else if ( a [ i ] [ j ] == ' L ' ) { if ( j - i >= 0 ) { ans [ j - i ] ++ ; } } else if ( a [ i ] [ j ] == ' R ' ) { if ( j + i < m ) { ans [ j + i ] ++ ; } } } } for ( int an : ans ) { System . out . print ( an + " ▁ " ) ; } System . out . println ( " " ) ; }        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 ( ) ) ; }   long nextLong ( ) {   return Long . parseLong ( next ( ) ) ; }   double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; }   String nextLine ( ) throws IOException { return br . readLine ( ) ; } }   }

def solve ( ) : answer = [ 0 ] * m for i in range ( 1 , n ) : for j in range ( m ) : if j - i >= 0 : if park [ i ] [ j - i ] == ' R ' : answer [ j ] += 1 if j + i < m : if park [ i ] [ j + i ] == ' L ' : answer [ j ] += 1 if 2 * i < n : if park [ 2 * i ] [ j ] == ' U ' : answer [ j ] += 1 return answer   n , m , k = tuple ( map ( int , input ( ) . split ( ) ) ) park = [ input ( ) for i in range ( n ) ] print ( ' ▁ ' . join ( map ( str , solve ( ) ) ) ) NEW_LINE


n , m , k = map ( int , input ( ) . split ( ) ) ans = [ 0 ] * m   for i in range ( n ) : field = input ( ) for j in range ( m ) : if ( field [ j ] == ' U ' ) and ( i % 2 == 0 ) : ans [ j ] += 1 elif ( field [ j ] == ' L ' ) and ( j >= i ) : ans [ j - i ] += 1 elif ( field [ j ] == ' R ' ) and ( j + i < m ) : ans [ j + i ] += 1   print ( ' ▁ ' . join ( map ( str , ans ) ) ) NEW_LINE


n , m , k = map ( int , input ( ) . split ( ) ) seen = [ 0 for _ in range ( m ) ] for i in range ( n ) : S = list ( input ( ) ) for j in range ( m ) : if S [ j ] == ' U ' and not i & 1 : seen [ j ] += 1 elif S [ j ] == ' L ' and j - i >= 0 : seen [ j - i ] += 1 elif S [ j ] == ' R ' and j + i < m : seen [ j + i ] += 1 print ( * seen , sep = " ▁ " ) NEW_LINE


import java . lang . * ; import java . util . * ; import java . io . * ;   public class pblm2 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; List < Integer > al = new ArrayList < Integer > ( ) ; int i = 1 , c = n - k , end = n ; if ( k < n ) { if ( k == 1 ) { while ( i <= n ) { al . add ( i ++ ) ; } } else { while ( c > 0 ) { al . add ( i ++ ) ; c -- ; } while ( i <= end ) { if ( end != i ) al . add ( end -- ) ; al . add ( i ++ ) ; } } } else if ( k == 1 && n == 1 ) al . add ( i ) ; for ( int p : al ) System . out . print ( p + " ▁ " ) ; } }

n , k = [ int ( i ) for i in input ( ) . split ( ) ] if k == 2 : print ( 1 , 3 , 2 , end = " ▁ " ) for i in range ( 4 , n + 1 ) : print ( i , end = " ▁ " ) elif k % 2 == 0 : low = 1 high = n for i in range ( k - 1 ) : if i % 2 == 1 : print ( low , end = " ▁ " ) low += 1 else : print ( high , end = " ▁ " ) high -= 1 for i in range ( low , high + 1 ) : print ( i , end = " ▁ " ) else : low = 1 high = n for i in range ( k - 1 ) : if i % 2 == 0 : print ( low , end = " ▁ " ) low += 1 else : print ( high , end = " ▁ " ) high -= 1 for i in range ( low , high + 1 ) : print ( i , end = " ▁ " ) print ( ) NEW_LINE


n , k = map ( int , input ( ) . strip ( ) . split ( ' ▁ ' ) ) if n == 1 : print ( 1 ) elif n == 2 : print ( '1 ▁ 2' ) else : if k == 1 : for i in range ( 1 , n + 1 ) : print ( i , end = " ▁ " ) print ( ) elif k == n - 1 : i1 = 1 i2 = n for i in range ( 1 , n + 1 ) : if i % 2 != 0 : print ( i1 , end = " ▁ " ) i1 += 1 else : print ( i2 , end = " ▁ " ) i2 -= 1 else : for i in range ( 1 , n - k ) : print ( i , end = " ▁ " ) i1 = i + 1 i2 = n for j in range ( 1 , k + 2 ) : if j % 2 != 0 : print ( i1 , end = " ▁ " ) i1 += 1 else : print ( i2 , end = " ▁ " ) i2 -= 1 NEW_LINE


n , k = map ( int , input ( ) . split ( ) ) a = [ i + 1 for i in range ( n ) ] j = n ; ans = [ ] ; d = 1 ; t = 0 for i in range ( k ) : if i % 2 == 0 : ans . append ( j ) j -= 1 else : ans . append ( d ) d += 1 if k % 2 == 0 : for i in range ( d , j + 1 ) : ans . append ( i ) else : for i in range ( j , d - 1 , - 1 ) : ans . append ( i ) print ( * ans ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class test { public static void main ( String ... args ) throws NumberFormatException , IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; int n = Integer . parseInt ( st . nextToken ( ) ) ; int k = Integer . parseInt ( st . nextToken ( ) ) ; int start = 1 ; int end = k + 1 ; int i = 0 ; while ( i < n ) { if ( i <= k && i % 2 == 0 ) { System . out . print ( start + " ▁ " ) ; start ++ ; i ++ ; } else if ( i <= k && i % 2 != 0 ) { System . out . print ( end + " ▁ " ) ; end -- ; i ++ ; } else { System . out . print ( ( i + 1 ) + " ▁ " ) ; i ++ ; } } } }


import java . util . * ; import java . io . * ; public class Main { static int [ ] A ; static int [ ] B ; static int [ ] C ; static int n ; static int ans ; public static void main ( String [ ] args ) throws IOException {

n = int ( input ( ) ) lst = sorted ( list ( map ( int , input ( ) . split ( ) ) ) , reverse = True ) pis = [ i for i in lst if i % 2 == 0 ] pos = [ i for i in lst if i not in pis ] a , b = len ( pis ) , len ( pos ) if abs ( a - b ) <= 1 : print ( 0 ) else : print ( sum ( pis [ b + 1 : ] ) if a > b else sum ( pos [ a + 1 : ] ) ) NEW_LINE


n = int ( input ( ) ) daf = list ( map ( int , input ( ) . split ( ) ) ) daf_even = [ x for x in daf if x % 2 == 0 ] daf_odd = [ x for x in daf if x % 2 ] daf_even . sort ( ) daf_odd . sort ( ) x = len ( daf_even ) y = len ( daf_odd ) if abs ( x - y ) <= 1 : print ( 0 ) else : if x > y + 1 : sel = x - ( y + 1 ) print ( sum ( daf_even [ : sel ] ) ) else : sel = y - ( x + 1 ) print ( sum ( daf_odd [ : sel ] ) ) NEW_LINE


T_ON = 0 DEBUG_ON = 0 MOD = 998244353     def solve ( ) : n = read_int ( ) A = read_ints ( ) A . sort ( ) odds = [ ] evens = [ ] for a in A : if is_odd ( a ) : odds . append ( a ) else : evens . append ( a ) count_odd = len ( odds ) count_even = len ( evens ) if abs ( count_odd - count_even ) <= 1 : print ( 0 ) return if count_odd > count_even : left = count_odd - count_even - 1 print ( sum ( odds [ : left ] ) ) else : left = count_even - count_odd - 1 print ( sum ( evens [ : left ] ) )     def main ( ) : T = read_int ( ) if T_ON else 1 for i in range ( T ) : solve ( )     def debug ( * xargs ) : if DEBUG_ON : print ( * xargs )     from collections import * import math     NEW_LINE


import java . util . * ; public class MyClass { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; ArrayList < Integer > even = new ArrayList < Integer > ( ) ; ArrayList < Integer > odd = new ArrayList < Integer > ( ) ; int n = sc . nextInt ( ) ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; } Arrays . sort ( arr ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] % 2 == 0 ) even . add ( arr [ i ] ) ; else odd . add ( arr [ i ] ) ; } if ( even . size ( ) == odd . size ( ) ) System . out . println ( 0 ) ; else if ( even . size ( ) == odd . size ( ) + 1 || odd . size ( ) == even . size ( ) + 1 ) System . out . println ( 0 ) ; else { int s = 0 ; if ( odd . size ( ) > even . size ( ) ) { int k = odd . size ( ) - even . size ( ) ; for ( int i = k - 2 ; i >= 0 ; i -- ) s = s + odd . get ( i ) ; } else { int k = even . size ( ) - odd . size ( ) ; for ( int i = k - 2 ; i >= 0 ; i -- ) s = s + even . get ( i ) ; } System . out . println ( s ) ; } } }


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long sum = 0 ; ArrayList < Integer > odd = new ArrayList < Integer > ( ) ; ArrayList < Integer > even = new ArrayList < Integer > ( ) ; while ( n -- > 0 ) { int t = sc . nextInt ( ) ; if ( t % 2 == 0 ) even . add ( t ) ; else odd . add ( t ) ; } Collections . sort ( odd ) ; Collections . sort ( even ) ; int t = Math . abs ( even . size ( ) - odd . size ( ) ) ; if ( t <= 1 ) sum = 0 ; else { t -- ; if ( even . size ( ) > odd . size ( ) ) { for ( int i = 0 ; i < t ; i ++ ) { sum += even . get ( i ) ; } } else { for ( int i = 0 ; i < t ; i ++ ) { sum += odd . get ( i ) ; } } } System . out . println ( sum ) ; } }


import java . util . * ; import java . util . Scanner ; import java . io . * ; import javax . lang . model . util . ElementScanner6 ; import static java . lang . System . out ;    public class B545 {   public static void main ( String args [ ] ) {   FastReader in = new FastReader ( ) ; PrintWriter pr = new PrintWriter ( new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ) ; int tc = 1 ;

import sysfrom os import pathif ( path . exists ( ' input . txt ' ) and path . exists ( ' output . txt ' ) ) : sys . stdout = open ( ' output . txt ' , ' w ' ) sys . stdin = open ( ' input . txt ' , ' r ' )   def main ( ) : s , t = input ( ) , input ( ) n = len ( s ) diff = 0 answer = [ ]   for i in range ( n ) : if s [ i ] != t [ i ] : answer . append ( s [ i ] if diff % 2 == 0 else t [ i ] ) diff += 1 else : answer . append ( s [ i ] ) if diff % 2 == 0 : print ( " " . join ( answer ) ) else : print ( " impossible " )   main ( ) NEW_LINE


a = input ( ) b = input ( ) l = [ ] for i in range ( len ( a ) ) : if ( a [ i ] != b [ i ] ) : l . append ( i )   if len ( l ) % 2 : print ( " impossible " ) elif l : i = l [ len ( l ) // 2 ] print ( a [ : i ] + b [ i : ] ) else : print ( a ) NEW_LINE


s = input ( ) t = input ( ) c = 0 n = len ( s ) for j in range ( n ) : if s [ j ] != t [ j ] : c += 1 if c % 2 != 0 : print ( ' impossible ' ) else : c1 = 0 c2 = 0 p = " " for j in range ( n ) : if s [ j ] == t [ j ] : p += s [ j ] else : if c1 < c // 2 : c1 += 1 p += s [ j ] else : p += t [ j ] print ( p ) NEW_LINE


from sys import stdin , stdoutfrom os import pathrd = lambda : stdin . readline ( ) . strip ( ) wr = stdout . writeif ( path . exists ( ' input . txt ' ) ) : stdin = open ( " input . txt " , " r " ) import time NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class B {   public static void main ( String [ ] args ) { FastScanner fs = new FastScanner ( ) ; String s1 = fs . next ( ) ; String s2 = fs . next ( ) ; int dist = 0 ; for ( int i = 0 ; i < s1 . length ( ) ; i ++ ) { if ( s1 . charAt ( i ) != s2 . charAt ( i ) ) dist ++ ; } if ( dist % 2 != 0 ) { System . out . println ( " impossible " ) ; return ; } boolean f = true ; for ( int i = 0 ; i < s1 . length ( ) ; i ++ ) { if ( s1 . charAt ( i ) != s2 . charAt ( i ) ) { if ( f ) System . out . print ( s1 . charAt ( i ) ) ; else System . out . print ( s2 . charAt ( i ) ) ; f = ! f ; } else { System . out . print ( s1 . charAt ( i ) ) ; } } } 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 ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } } }


import java . util . * ;    public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; String s = input . nextLine ( ) ; String t = input . nextLine ( ) ; int count = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) != t . charAt ( i ) ) count ++ ; } if ( count % 2 == 1 ) { System . out . println ( " impossible " ) ; } else { count = count / 2 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == t . charAt ( i ) ) System . out . print ( s . charAt ( i ) ) ; else { if ( count % 2 == 0 ) System . out . print ( s . charAt ( i ) ) ; else System . out . print ( t . charAt ( i ) ) ; count -- ; } } System . out . println ( " " ) ; } } }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . OutputStream ; import java . io . PrintWriter ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . HashMap ; import java . util . List ; import java . util . Map ; import java . util . StringTokenizer ;   public class Gym {

l = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE x = min ( l [ : 4 ] ) NEW_LINE if x > l [ 5 ] : NEW_LINE INDENT print ( l [ 5 ] - l [ 4 ] + 1 ) elif x >= l [ 4 ] : NEW_LINE print ( x - l [ 4 ] ) else : NEW_LINE print ( "0" ) NEW_LINE DEDENT


* P , a , b = map ( int , input ( ) . split ( ) ) NEW_LINE print ( max ( 0 , min ( b - a + 1 , min ( P ) - a ) ) ) NEW_LINE


l = list ( map ( int , input ( ) . split ( ' ▁ ' ) ) ) NEW_LINE print ( min ( l [ 5 ] - l [ 4 ] + 1 , max ( 0 , min ( l [ : 4 ] ) - l [ 4 ] ) ) ) NEW_LINE


def check_permutations ( p1 , p2 , p3 , p4 , x ) : total = 0 NEW_LINE s1 = { p1 , p2 , p3 , p4 } NEW_LINE for i in s1 : a = i NEW_LINE s2 = { a } NEW_LINE s2 = s1 - s2 NEW_LINE for j in s2 : b = j NEW_LINE s3 = { j } NEW_LINE s3 = s2 - s3 NEW_LINE for k in s3 : c = k NEW_LINE s4 = { k } NEW_LINE s4 = s3 - s4 NEW_LINE for z in ( s4 ) : d = z NEW_LINE if ( ( ( ( x % a ) % b ) ) % c ) % d == x : total += 1 NEW_LINE return total NEW_LINE p1 , p2 , p3 , p4 , a , b = map ( int , input ( ) . split ( ) ) NEW_LINE ans = 0 NEW_LINE for i in range ( a , b + 1 ) : if NEW_LINE check_permutations ( p1 , p2 , p3 , p4 , i ) >= 7 : ans += 1 NEW_LINE print ( ans ) NEW_LINE


p1 , p2 , p3 , p4 , a , b = map ( int , input ( ) . split ( ) )   m = min ( p1 , p2 , p3 , p4 )   if m - a <= 0 : NEW_LINE INDENT print ( 0 ) elif m > b : NEW_LINE print ( b - a + 1 ) else : NEW_LINE print ( m - a ) NEW_LINE DEDENT


import java . util . * ;     import java . io . * ; public class Main { 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 . util . * ;   public class dDiversity { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String s = scan . next ( ) ; int k = scan . nextInt ( ) ; int counter = 0 ; if ( s . length ( ) < k ) { System . out . println ( " impossible " ) ; } else { int [ ] AtoZcount = new int [ 26 ] ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { AtoZcount [ s . charAt ( i ) - ' a ' ] ++ ; }

s = input ( ) k = int ( input ( ) ) if len ( s ) >= k : print ( max ( 0 , k - len ( set ( s ) ) ) ) else : print ( ' impossible ' ) NEW_LINE


s = input ( ) k = int ( input ( ) ) arr = set ( list ( s ) )   x = len ( arr )     if ( x >= k ) : print ( 0 ) else : k -= x rem = len ( s ) - x   NEW_LINE


s = input ( ) k = int ( input ( ) )   ss = set ( s . strip ( ) )   ns = len ( ss )   if k > len ( s ) : print ( " impossible " ) else : print ( max ( 0 , k - ns ) )   NEW_LINE


s = list ( str ( input ( ) ) ) k = int ( input ( ) ) r = 0 possible = Trueif len ( s ) < k : possible = Falseelse : r = k - len ( set ( s ) ) r = 0 if r < 0 else rprint ( r if possible else " impossible " ) NEW_LINE


string = list ( input ( ) ) differnt_words = int ( input ( ) ) difset = set ( string )   if ( differnt_words > len ( string ) ) : print ( " impossible " ) else : val = differnt_words - len ( difset ) if ( val < 0 ) : print ( 0 ) else : print ( val ) NEW_LINE


import javax . print . DocFlavor ; import java . io . * ; import java . net . Inet4Address ; import java . sql . ClientInfoStatus ; import java . util . * ;


import java . io . * ; import java . util . * ;   public class Main {   public static void main ( String [ ] args ) throws IOException { String s = sc . nextLine ( ) ; int k = sc . nextInt ( ) ; if ( k > s . length ( ) ) pw . println ( " impossible " ) ; else {