import java . util . ArrayList ; import java . util . Arrays ; import java . util . HashMap ; import java . util . LinkedHashMap ; import java . util . Map ; import java . util . Scanner ; import java . util . * ; import java . util . stream . Collectors ;   public class absolute { static int [ ] ar ; static int total ; static void generatePrimes ( ) { ar = new int [ total + 2 ] ; Arrays . fill ( ar , 1 ) ; ar [ 1 ] = 1 ; ar [ 2 ] = 1 ; for ( int i = 2 ; i <= Math . sqrt ( total ) ; i ++ ) { if ( ar [ i ] == 1 ) { for ( int j = i * i ; j <= total ; j += i ) ar [ j ] = 2 ; } } } public static void main ( String [ ] args ) {


from math import * import sysinput = sys . stdin . readlinea = int ( input ( ) ) for x in range ( a ) : b = int ( input ( ) ) c = list ( map ( int , input ( ) . split ( ) ) ) j = list ( set ( c ) ) n = 0 d = { } for z in range ( len ( j ) ) : if j [ z ] & 1 == 0 : d [ j [ z ] ] = 1   j . sort ( ) for y in range ( len ( j ) ) : if j [ y ] & 1 == 0 : j [ y ] = int ( j [ y ] / 2 ) n += 1 while ( j [ y ] & 1 == 0 and d . get ( j [ y ] ) == None ) : d [ j [ y ] ] = 1 j [ y ] = int ( j [ y ] / 2 ) n += 1   print ( n ) NEW_LINE


for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) b = list ( set ( a ) ) d = { } c = 0 for i in range ( len ( b ) ) : if ( b [ i ] & 1 == 0 ) : d [ b [ i ] ] = 1 b . sort ( reverse = True ) for i in range ( len ( b ) ) : if b [ i ] & 1 == 0 : b [ i ] = b [ i ] // 2 c += 1 while ( b [ i ] & 1 == 0 and d . get ( b [ i ] ) == None ) : d [ b [ i ] ] = 1 b [ i ] = b [ i ] // 2 c += 1 print ( c ) NEW_LINE


for _ in range ( int ( input ( ) ) ) : input ( ) l = list ( map ( int , input ( ) . split ( ) ) ) s = set ( ) for x in l : while x % 2 == 0 and x not in s : s . add ( x ) x //= 2 print ( len ( s ) ) NEW_LINE


import java . util . * ; import java . math . * ; public class MakeThemOdd { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int runs = sc . nextInt ( ) ; while ( runs -- > 0 ) { int size = sc . nextInt ( ) ; TreeSet < Integer > arr = new TreeSet < Integer > ( ) ; while ( size -- > 0 ) { Integer num = sc . nextInt ( ) ; if ( num % 2 == 0 ) arr . add ( num ) ; } long out = 0 ; while ( arr . size ( ) > 0 ) { Integer temp = arr . pollLast ( ) ; temp /= 2 ; if ( temp % 2 == 0 ) arr . add ( temp ) ; out ++ ; } System . out . println ( out ) ; } } }

I = lambda : map ( int , input ( ) . split ( ) ) INT = lambda : int ( input ( ) )   T = INT ( ) NEW_LINE


import java . util . Scanner ;   public class DigitCounter { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ;   long n = scanner . nextLong ( ) ; long count = 0 ;   for ( int i = 1 ; i <= n ; i *= 10 ) { count += n - i + 1 ; }   System . out . println ( count ) ; } }

def digitsof ( n ) : lst = [ ] while n > 0 : lst . append ( n % 10 ) n //= 10 return lst     def answer ( n ) : NEW_LINE


n = int ( input ( ) ) p = ni = 1 l = 1 sd = 0 s = 0j = 1 while ( n > 9 ) : n = int ( n / 10 ) i *= 10 l += 1 if p > 9 : while i != 1 : s = p - i if j == 1 : s = s + 1 sd += s * l p = i i = i / 10 l -= 1 j += 1 p = 9 print ( int ( p + sd ) ) NEW_LINE


n = int ( input ( ) ) i = 10 count = 0 c2 = 0 while True :   if n >= i : count += 9 * ( i // 10 ) * ( len ( str ( i // 10 ) ) ) i *= 10   elif n < i : i = i // 10   count += ( ( n - i ) + 1 ) * ( len ( str ( i ) ) ) break   print ( count ) NEW_LINE


n = int ( input ( ) ) ans = 0 i = 9 while n > 0 : ans += n n -= i i *= 10 print ( ans )     NEW_LINE


import java . util . Scanner ;   public class CF552_D2_B { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int l = String . valueOf ( n ) . length ( ) ; long c = 1 ; long sum = 0 ; int rem = n ; for ( int i = 0 ; i < l - 1 ; i ++ ) { int count = ( int ) ( 9 * Math . pow ( 10 , i ) ) ; rem -= count ; sum += count * c ; c ++ ; } sum += rem * c ;   System . out . println ( sum ) ; } }


import java . util . * ;   public class a { public static void main ( String [ ] arg ) { Scanner in = new Scanner ( System . in ) ; long x = in . nextLong ( ) ; long at = 0 , aux = x , u = 1 , cnt = 1 ; while ( aux >= 10 ) { at += x - u ; aux /= 10 ; u *= 10 ; cnt ++ ; } at += ( x - u + cnt ) ;   System . out . printf ( " % d \n " , at ) ; } }


import java . lang . * ; import java . util . * ;   public class Abhishek {   public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int d = ( int ) Math . floor ( Math . log10 ( n ) + 1 ) ; if ( n < 9 ) System . out . println ( n ) ; else { double i = 1 ; long sum = 0 , res = 0 ; while ( i < d ) { long k = ( long ) ( 9 * Math . pow ( 10 , i - 1 ) ) ; sum = sum + ( k ) ; res = ( long ) ( res + ( k * i ) ) ; i ++ ; } res = ( long ) ( res + ( ( n - sum ) * i ) ) ; System . out . println ( res ) ; } } }


import java . util . * ; public class george { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int c = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int p = sc . nextInt ( ) ; int q = sc . nextInt ( ) ; if ( ( q - p ) >= 2 ) c ++ ; } System . out . println ( c ) ; } }

rooms = int ( input ( ' ' ) ) count = 0 for room in range ( rooms ) : x = input ( ' ' ) . split ( ) if int ( x [ 1 ] ) - int ( x [ 0 ] ) >= 2 : count += 1 print ( count ) NEW_LINE


n = int ( input ( ) ) i = 0 for _ in range ( n ) : p , q = tuple ( map ( int , input ( ) . split ( ' ▁ ' ) ) ) if p < q - 1 : i += 1 print ( i ) NEW_LINE


a = int ( input ( ) ) o = 0 while a > 0 : N = [ i for i in input ( ) ] i = 1 while i < len ( N ) : if N [ i ] != ' ▁ ' : N [ i - 1 ] = int ( N [ i - 1 ] ) * 10 + int ( N [ i ] ) N . pop ( i ) else : N [ 0 ] = int ( N [ 0 ] ) N . pop ( i ) i = i + 1 N [ - 1 ] = int ( N [ - 1 ] ) if N [ 0 ] + 2 <= N [ 1 ] : o = o + 1 a = a - 1 print ( o ) NEW_LINE


n = int ( input ( ) ) e = 0 for i in range ( n ) : l = list ( map ( int , input ( ) . split ( ) ) ) if ( l [ 0 ] < l [ 1 ] ) : a = l [ 1 ] - l [ 0 ] if ( a >= 2 ) : e = e + 1 print ( e ) NEW_LINE


n = int ( input ( ) ) b = 0 for i in range ( n ) : a = list ( map ( int , input ( ) . split ( ) ) ) if ( a [ 1 ] - a [ 0 ] >= 2 ) : b += 1 print ( b ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ;    public class CF467AGeorgeAndAccommodation {   static BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; static PrintWriter out = new PrintWriter ( System . out ) ;   public static void main ( String [ ] args ) throws IOException { byte n = Byte . parseByte ( in . readLine ( ) ) ; String [ ] l ; int p , q , rooms = 0 ; while ( n -- > 0 ) { l = in . readLine ( ) . split ( " \\ s " ) ; p = Byte . parseByte ( l [ 0 ] ) ; q = Byte . parseByte ( l [ 1 ] ) ; if ( q - p > 1 ) { rooms ++ ; } } out . print ( rooms ) ; out . close ( ) ; } }


import java . util . Scanner ;   public class George_and_Accommodation {   static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int number = sc . nextInt ( ) ; int count = 0 ; while ( number > 0 ) { int into = sc . nextInt ( ) ; int max = sc . nextInt ( ) ; if ( ( max - into ) >= 2 ) { count ++ ; } number -- ; } System . out . println ( count ) ; } }


import java . io . * ; import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; int cnt = 0 ; while ( t -- > 0 ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; if ( a < b - 1 ) { cnt ++ ; } } System . out . println ( cnt ) ; } }


import java . util . Scanner ;   public class PolycarpsPockets { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int [ ] a = new int [ 110 ] ; for ( int i = 0 ; i < n ; i ++ ) { ++ a [ scan . nextInt ( ) ] ; } int res = 0 ; for ( int i = 0 ; i < 110 ; i ++ ) { res = Math . max ( a [ i ] , res ) ; } System . out . println ( res ) ; } }

from collections import Countern = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) c = Counter ( l ) print ( max ( c . values ( ) ) ) NEW_LINE


num = int ( input ( ) ) li = list ( map ( int , input ( ) . split ( ) ) ) li2 = [ ] for i in range ( num ) : a = li . count ( li [ i ] ) li2 . append ( a ) print ( max ( li2 ) ) NEW_LINE


a = input ( ) coins = [ int ( x ) for x in input ( ) . split ( ) ] numbers = dict ( )   for d in coins : if d in numbers : numbers [ d ] += 1 else : numbers [ d ] = 1 pockets = 0 for v in numbers . values ( ) : if v > pockets : pockets = vprint ( pockets ) NEW_LINE


num_numbers = int ( input ( ) ) integers = sorted ( [ int ( i ) for i in input ( ) . split ( ) ] ) num_nums = [ ] for number in set ( integers ) : num_nums . append ( integers . count ( number ) ) num_nums = sorted ( num_nums , reverse = True ) print ( num_nums [ 0 ] ) NEW_LINE


import java . util . * ; public class MyClass { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; ArrayList < Integer > a = new ArrayList < Integer > ( ) ; int n = sc . nextInt ( ) ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) arr [ i ] = sc . nextInt ( ) ; HashMap < Integer , Integer > h = new HashMap < Integer , Integer > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( h . containsKey ( arr [ i ] ) ) { int count = h . get ( arr [ i ] ) ; h . put ( arr [ i ] , count + 1 ) ; } else h . put ( arr [ i ] , 1 ) ; } int max = ( Collections . max ( h . values ( ) ) ) ; System . out . println ( max ) ; } }


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


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . Collections ; import java . util . HashMap ; import java . util . StringTokenizer ;   public class A { public static void main ( String [ ] args ) { FastScanner fs = new FastScanner ( ) ; int n = fs . nextInt ( ) ; HashMap < Integer , Integer > map = new HashMap < > ( ) ; int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int b = fs . nextInt ( ) ; map . put ( b , map . getOrDefault ( b , 0 ) + 1 ) ; ans = Math . max ( ans , map . get ( b ) ) ; } System . out . println ( ans ) ; } static class FastScanner { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( " " ) ; String next ( ) { while ( ! st . hasMoreTokens ( ) ) try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } int [ ] readArray ( int n ) { int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextInt ( ) ; return a ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } } }


import java . util . * ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class a { static int [ ] count , count1 , count2 ; static int [ ] arr ; static char [ ] ch , ch1 ; static int [ ] darr , farr ; static Character [ ] [ ] mat , mat1 ; static long x , h ; static long maxl ; static double dec ; static String s ; static long minl ; static int mx = ( int ) 1e6 ; static long mod = 998244353l ;

t = int ( input ( ) ) for _ in range ( t ) : s = str ( input ( ) ) l = [ ] u = [ ] d = [ ] for i , c in enumerate ( s ) : if c . islower ( ) : l . append ( i ) elif c . isupper ( ) : u . append ( i ) else : d . append ( i ) s = list ( s ) if l and u and d : pass elif not l and u and d : if len ( u ) > len ( d ) : s [ u [ 0 ] ] = ' a ' else : s [ d [ 0 ] ] = ' a ' elif l and not u and d : if len ( l ) > len ( d ) : s [ l [ 0 ] ] = ' A ' else : s [ d [ 0 ] ] = ' A ' elif l and u and not d : if len ( l ) > len ( u ) : s [ l [ 0 ] ] = '1' else : s [ u [ 0 ] ] = '1' elif l and not u and not d : s [ l [ 0 ] ] = ' A ' s [ l [ 1 ] ] = '1' elif not l and u and not d : s [ u [ 0 ] ] = ' a ' s [ u [ 1 ] ] = '1' elif not l and not u and d : s [ d [ 0 ] ] = ' a ' s [ d [ 1 ] ] = ' A ' print ( ' ' . join ( s ) ) NEW_LINE


''' lobeli ▁ code  ANSWER ▁ EXISTS ▁ FOR ▁ SURE  '''   T = int ( input ( ) ) for testis in range ( T ) : s = list ( input ( ) ) CL = - 1 L = - 1 D = - 1 for i in range ( len ( s ) ) : if ' A ' <= s [ i ] and s [ i ] <= ' Z ' : CL = i if ' a ' <= s [ i ] and s [ i ] <= ' z ' : L = i if '0' <= s [ i ] and s [ i ] <= '9' : D = i if D == - 1 : for i in range ( len ( s ) ) : if i != L and i != CL : NEW_LINE


def solve ( s ) : f1 = False f2 = False f3 = False for i in range ( len ( s ) ) : s1 = s [ i ] if s1 . isupper ( ) : f1 = True if s1 . islower ( ) : f2 = True if s1 . isdigit ( ) : f3 = True if f1 and f2 and f3 : break if f1 and f2 and f3 : return True else : return Falsefor _ in range ( int ( input ( ) ) ) : s = input ( ) if solve ( s ) : print ( s ) else : f = True t = list ( s ) for i in range ( len ( t ) ) : z = t [ i ] t [ i ] = '1' if solve ( ' ' . join ( map ( str , t ) ) ) : print ( ' ' . join ( map ( str , t ) ) ) f = False break t [ i ] = ' a ' if solve ( ' ' . join ( map ( str , t ) ) ) : print ( ' ' . join ( map ( str , t ) ) ) f = False break t [ i ] = ' A ' if solve ( ' ' . join ( map ( str , t ) ) ) : print ( ' ' . join ( map ( str , t ) ) ) f = False break t [ i ] = z if f : if s [ 2 ] . isupper ( ) : print ( ' a1' + s [ 2 : ] ) continue if s [ 2 ] . islower ( ) : print ( ' A1' + s [ 2 : ] ) continue if s [ 2 ] . isdigit ( ) : print ( ' aA ' + s [ 2 : ] ) continue NEW_LINE


import javax . swing . plaf . IconUIResource ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ;   public class codeforces { static int M = 1_000_000_007 ; static int INF = Integer . MAX_VALUE ; static final FastScanner fs = new FastScanner ( ) ;

n , m , d = map ( int , input ( ) . split ( ) ) A = [ ] for i in range ( n ) : A += list ( map ( int , input ( ) . split ( ) ) )   A = sorted ( A ) median = A [ m * n // 2 ]   rem = A [ 0 ] % d sum = 0 for i in range ( n * m ) : if A [ i ] % d != rem : print ( - 1 ) exit ( ) else : sum += abs ( A [ i ] - median ) / d   print ( int ( sum ) ) NEW_LINE


n , m , d = [ int ( e ) for e in input ( ) . split ( " ▁ " ) ] mat = [ ] for _ in range ( n ) : mat . append ( [ int ( e ) for e in input ( ) . split ( " ▁ " ) ] ) r = mat [ 0 ] [ 0 ] % da = [ ] for i in range ( n ) : for j in range ( m ) : if mat [ i ] [ j ] % d != r : print ( - 1 ) exit ( ) a . append ( mat [ i ] [ j ] )   a . sort ( ) m = len ( a ) // 2 ans = 0 for i in range ( len ( a ) ) : ans += abs ( a [ i ] - a [ m ] )   print ( ans // d )   NEW_LINE


n , m , d = map ( int , input ( ) . split ( ) ) a = [ 0 ] for i in range ( n ) : a += list ( map ( int , input ( ) . split ( ) ) ) a . sort ( ) s = set ( ) for i in range ( 1 , len ( a ) ) : s . add ( a [ i ] % d ) if len ( s ) >= 2 : print ( - 1 ) exit ( ) aa = [ 0 ] * ( n * m + 1 ) for i in range ( 1 , n * m + 1 ) : aa [ i ] = aa [ i - 1 ] + a [ i ] ans = 10 ** 18 for i in range ( 1 , n * m + 1 ) : ans = min ( ans , ( aa [ - 1 ] - 2 * aa [ i ] - ( n * m - 2 * i ) * a [ i ] ) // d ) print ( ans ) NEW_LINE


def median ( arr ) : n = len ( arr ) return ( n - 1 ) // 2 from math import ceil , floor   n , m , d = map ( int , input ( ) . split ( ' ▁ ' ) ) arr = [ ] for i in range ( n ) : x = [ int ( w ) for w in input ( ) . split ( ' ▁ ' ) ] for item in x : arr . append ( item ) arr . sort ( )   if ( n * m ) % 2 == 0 : x = arr [ median ( arr ) ] y = arr [ median ( arr ) + 1 ] ans = 0 for item in arr : f = ( abs ( item ) - x ) / d if ceil ( f ) == floor ( f ) : ans = ans + abs ( f ) else : ans = - 1 break ans1 = 0 for item in arr : f = ( abs ( item ) - y ) / d if ceil ( f ) == floor ( f ) : ans1 = ans1 + abs ( f ) else : ans1 = - 1 break if ans == - 1 and ans1 == - 1 : ans = - 1 else : if ans == - 1 : ans = ans1 elif ans1 == - 1 : ans = ans else : ans = min ( ans1 , ans )   else : ans = 0 x = arr [ median ( arr ) ] for item in arr : f = ( abs ( item ) - x ) / d if ceil ( f ) == floor ( f ) : ans = ans + abs ( f ) else : ans = - 1 breakprint ( int ( ans ) ) NEW_LINE


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 n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int [ ] arr = new int [ n * m ] ; boolean flag = true ; int count = 0 , sum = 0 ; for ( int i = 0 ; i < ( n * m ) ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; sum += arr [ i ] ; } if ( m * n == 1 ) { System . out . println ( "0" ) ; return ; } Arrays . sort ( arr ) ; int cmp = arr [ ( m * n ) / 2 ] ; for ( int i = 0 ; i < ( m * n ) ; i ++ ) { if ( ( cmp - arr [ i ] ) % d == 0 ) { count += Math . abs ( cmp - arr [ i ] ) / d ; } else { flag = false ; break ; } } if ( flag == false ) System . out . println ( " - 1" ) ; else System . out . println ( count ) ; } }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Arrays ;   public class PoloMatrix {   public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] temp = br . readLine ( ) . split ( " ▁ " ) ; int rows = Integer . parseInt ( temp [ 0 ] ) ; int columns = Integer . parseInt ( temp [ 1 ] ) ; int diff = Integer . parseInt ( temp [ 2 ] ) ; int [ ] numbers = new int [ rows * columns ] ; for ( int i = 0 ; i < rows ; i ++ ) { String [ ] temp2 = br . readLine ( ) . split ( " ▁ " ) ; for ( int j = 0 ; j < columns ; j ++ ) { numbers [ i * columns + j ] = Integer . parseInt ( temp2 [ j ] ) ; } } boolean possible = true ; int mod = numbers [ 0 ] % diff ; for ( int i = 0 ; i < numbers . length ; i ++ ) { if ( numbers [ i ] % diff != mod ) { possible = false ; break ; } } if ( possible ) { Arrays . sort ( numbers ) ; int median = numbers [ numbers . length / 2 ] ; int moves = 0 ; for ( int i = 0 ; i < numbers . length ; i ++ ) { moves += ( Math . abs ( median - numbers [ i ] ) ) / diff ; } System . out . println ( moves ) ; } else { System . out . println ( " - 1" ) ; } }   }


import java . util . Arrays ; import java . util . HashMap ; import java . util . Map ; import java . util . Scanner ;   public class Problem_289B { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int rows = s . nextInt ( ) ; int cols = s . nextInt ( ) ;   double d = s . nextDouble ( ) ;   int [ ] nums = new int [ rows * cols ] ; for ( int i = 0 ; i < rows * cols ; i ++ ) nums [ i ] = s . nextInt ( ) ;   Arrays . sort ( nums ) ; int median = nums . length % 2 == 0 ? ( nums [ nums . length / 2 - 1 ] ) : nums [ nums . length / 2 ] ;   double moves = 0 ; for ( int i = 0 ; i < rows * cols ; i ++ ) { if ( nums [ i ] != median ) moves += Math . abs ( ( nums [ i ] - median ) / d ) ; }   if ( moves == Math . ceil ( moves ) ) System . out . println ( ( int ) moves ) ; else System . out . println ( " - 1" ) ; } }


import java . util . Scanner ; public class p1496A { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; l : for ( int t = sc . nextInt ( ) ; t -- > 0 ; ) { int n = sc . nextInt ( ) , k = sc . nextInt ( ) ; String s = sc . next ( ) ; if ( s . substring ( 0 , k ) . equals ( reverse ( s . substring ( n - k , n ) ) ) && k * 2 < n ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } static String reverse ( String s ) { return new StringBuilder ( s ) . reverse ( ) . toString ( ) ; } }

I = input NEW_LINE exec ( int ( I ( ) ) * " n , k = map ( int , I ( ) . split ( ) ) ; s = I ( ) ; print ( ' YNEOS ' [ s [ : k ] ! = s [ : ~ k : -1 ] or ▁ 2 * k = = n : :2 ] ) ; " ) NEW_LINE


I = input NEW_LINE for _ in ' ▁ ' * int ( I ( ) ) : NEW_LINE INDENT n , k = map ( int , I ( ) . split ( ) ) NEW_LINE s = I ( ) NEW_LINE print ( ' YNEOS ' [ 2 * k == n or s [ : k ] != s [ - 1 : - k - 1 : - 1 ] : : 2 ] ) NEW_LINE DEDENT


I = input NEW_LINE exec ( int ( I ( ) ) * " n , k = map ( int , I ( ) . split ( ) ) ; s = I ( ) ; i = 0 \n while ▁ i < k ▁ and ▁ s [ i ] = = s [ ~ i ] : i + = 1 \n print ( ' NYOE ▁ S ' [ n > 2 * k < = 2 * i : :2 ] ) \n " ) NEW_LINE


import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int t = s . nextInt ( ) ; for ( int i = 0 ; i < t ; i ++ ) { int n = s . nextInt ( ) ; int k = s . nextInt ( ) ; String str = s . next ( ) ; int count = 0 ; int range = ( n - 1 ) / 2 ; for ( int j = 0 ; j < range ; j ++ ) { if ( str . charAt ( j ) != str . charAt ( n - 1 - j ) ) { break ; } else { count ++ ; } } if ( k <= count ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } }


import java . util . Scanner ; public class A { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int t = scanner . nextInt ( ) ; for ( int i = 0 ; i < t ; i ++ ) { int n = scanner . nextInt ( ) ; int k = scanner . nextInt ( ) ; scanner . nextLine ( ) ; String s = scanner . nextLine ( ) ; boolean b = n > 2 * k ; for ( int j = 0 ; j < k ; j ++ ) b = b && ( s . charAt ( j ) == s . charAt ( s . length ( ) - 1 - j ) ) ; if ( b ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } }


import java . util . Scanner ; public class javaProject { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int test = input . nextInt ( ) ; while ( test -- > 0 ) { int n = input . nextInt ( ) , k = input . nextInt ( ) ; String s = input . next ( ) ; int count = 0 ; for ( int i = 0 ; i < ( n % 2 == 1 ? n / 2 : n / 2 - 1 ) ; i ++ ) { if ( s . charAt ( i ) == s . charAt ( n - 1 - i ) ) { count ++ ; } else { break ; } } if ( count >= k ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } }


import java . util . * ; public class A1496 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; String s = sc . next ( ) ; char ch = ' ▁ ' ; char ch2 = ' ▁ ' ; int sum = 0 ; int min = 0 , max = n - 1 ; while ( ( max - min ) >= 2 ) { ch = s . charAt ( min ) ; ch2 = s . charAt ( max ) ; if ( ch == ch2 ) sum ++ ; else break ; max -- ; min ++ ; } if ( sum >= k ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } }


import java . util . * ; import java . io . * ;   public class B1137 {   static int [ ] prefixFunction ( char [ ] s )

def z_func ( s : str ) : z = [ 0 ] * len ( s ) left , right = 0 , 0 for i in range ( 1 , len ( s ) ) : z [ i ] = max ( 0 , min ( z [ i - left ] , right - i ) ) while i + z [ i ] < len ( s ) and s [ z [ i ] ] == s [ i + z [ i ] ] : z [ i ] += 1 if i + z [ i ] > right : left , right = i , i + z [ i ] return z     def get_zeros_ones_count ( s : str ) : zeros_count = 0 ones_count = 0 for digit in s : if digit == '0' : zeros_count += 1 else : ones_count += 1 return zeros_count , ones_count     cur_timetable = input ( ) ideal_timetable = input ( )   cur_zeros_count , cur_ones_count = get_zeros_ones_count ( cur_timetable )   ideal_z_values = z_func ( ideal_timetable ) ideal_length = len ( ideal_z_values ) max_pref_len = 0   for i in range ( ideal_length - 1 , ideal_length // 2 - 1 , - 1 ) : if ideal_z_values [ i ] + i == ideal_length : if ideal_z_values [ i ] > max_pref_len : max_pref_len = ideal_z_values [ i ]   period = ideal_timetable [ : ( ideal_length - max_pref_len ) ] if max_pref_len != 0 else ideal_timetablesuffix = ideal_timetable [ : max_pref_len ] if max_pref_len != 0 else ' '   period_zeros , period_ones = get_zeros_ones_count ( period ) suffix_zeros , suffix_ones = get_zeros_ones_count ( suffix )   res = [ ] while True : if period_ones > cur_ones_count or period_zeros > cur_zeros_count : break res . append ( period ) cur_ones_count -= period_ones cur_zeros_count -= period_zeros   if cur_zeros_count >= suffix_zeros and cur_ones_count >= suffix_ones : res . append ( suffix ) cur_ones_count -= suffix_ones cur_zeros_count -= suffix_zeros   if cur_ones_count != 0 : res += [ '1' ] * cur_ones_count   if cur_zeros_count != 0 : res += [ '0' ] * cur_zeros_count   print ( ' ' . join ( res ) ) NEW_LINE


import sysinput = sys . stdin . readline     def MP ( s ) : a = [ 0 ] * ( len ( s ) + 1 ) a [ 0 ] = - 1 j = - 1 for i in range ( len ( s ) ) : while j >= 0 and s [ i ] != s [ j ] : j = a [ j ] j += 1 a [ i + 1 ] = j return a     s = input ( ) [ : - 1 ] t = input ( ) [ : - 1 ] cnt = [ 0 , 0 ] for char in s : cnt [ int ( char ) ] += 1   tbl = MP ( t ) lap = len ( t ) - tbl [ len ( t ) ] t = t [ 0 : lap ]   ans = [ ] while True : for char in t : if cnt [ int ( char ) ] > 0 : ans . append ( char ) cnt [ int ( char ) ] -= 1 else : break else : continue break   for i in range ( cnt [ 0 ] ) : ans . append ( "0" ) for i in range ( cnt [ 1 ] ) : ans . append ( "1" )   print ( ' ' . join ( ans ) ) NEW_LINE


import java . io . * ; import java . util . * ;     public class D {   static int longestPrefixSuffix ( String s ) { int n = s . length ( ) ; int lps [ ] = new int [ n ] ;


import java . util . * ; import java . io . * ;   public class Div680 {


import java . util . * ; import java . io . * ; public class Solution { static int rock = 0 ; static BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; public static void main ( String [ ] args ) throws Exception {

k = int ( input ( ) ) n = input ( ) sum = 0 for i in n : sum += int ( i ) cnt = 0 n = sorted ( n ) i = 0 while ( k > sum ) : if n [ i ] != '9' : sum += ( 9 - int ( n [ i ] ) ) cnt += 1 i += 1 print ( cnt ) NEW_LINE


k = int ( input ( ) ) p = input ( ) n = sorted ( map ( int , p ) ) s = sum ( n ) if s >= k : print ( 0 ) else : i = 0 while ( s < k ) : s = s + 9 - n [ i ] i += 1 print ( i ) NEW_LINE


import sysdef input ( ) : return sys . stdin . readline ( ) . strip ( ) def iinput ( ) : return int ( input ( ) ) def minput ( ) : return map ( int , input ( ) . split ( ) ) def listinput ( ) : return list ( map ( int , input ( ) ) ) k = iinput ( ) n = listinput ( ) n . sort ( ) i = 0 s = sum ( n ) while s < k : s += 9 - n [ i ] i += 1 print ( i ) NEW_LINE


k = int ( input ( ) ) digits = [ int ( i ) for i in input ( ) ] digits . sort ( ) cur = sum ( digits ) ans = 0 for d in digits : if cur < k : cur += 9 - d ans += 1 print ( ans ) NEW_LINE


n = int ( input ( ) ) num = input ( ) s = [ ] for ch in num : s . append ( int ( ch ) ) s . sort ( ) total = sum ( s ) if total >= n : print ( 0 ) exit ( ) total = n - totali , count = 0 , 1   while i < len ( s ) : if ( 9 - s [ i ] ) < total : total -= 9 - s [ i ] count += 1 i += 1 else : print ( count ) exit ( ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Arrays ; import java . util . HashSet ; import java . util . StringTokenizer ; import java . util . Collections ; import java . lang . Math ;    public class Main { public static void main ( String [ ] args ) { FastScanner scanner = new FastScanner ( ) ; int k = scanner . nextInt ( ) ; String N = scanner . next ( ) ; int L = N . length ( ) , total = 0 , current = 0 ; int count [ ] = new int [ 15 ] ;   for ( int idx = 0 ; idx < N . length ( ) ; ++ idx ) { count [ N . charAt ( idx ) - '0' ] ++ ; current += N . charAt ( idx ) - '0' ; }   for ( int digit = 0 , avail , req , take ; digit < 10 && current < k ; ++ digit ) { avail = count [ digit ] ; req = ( k - current + 8 - digit ) / ( 9 - digit ) ; take = Math . min ( avail , req ) ;   total += take ; current += take * ( 9 - digit ) ; }   System . out . println ( total ) ; return ; }   static class FastScanner { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( " " ) ; String next ( ) { while ( ! st . hasMoreTokens ( ) ) try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } int [ ] readArray ( int n ) { int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextInt ( ) ; return a ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } }   }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . math . BigInteger ; import java . util . * ; import static java . util . Arrays . sort ; import javafx . util . Pair ;   public class Main { public static int SumOfDigits ( char s [ ] ) { int sum = 0 ; for ( int i = 0 ; i < s . length ; i ++ ) { sum += ( s [ i ] - '0' ) ; } return sum ; }   public static void main ( String [ ] args ) {   FastScanner input = new FastScanner ( ) ; int k = input . nextInt ( ) ; char s [ ] = input . next ( ) . toCharArray ( ) ; int sum = SumOfDigits ( s ) ; if ( sum >= k ) { System . out . println ( "0" ) ; return ; } Arrays . sort ( s ) ; int count = 0 ; for ( int i = 0 ; i < s . length ; i ++ ) { int ch = s [ i ] - '0' ; if ( ch != 9 ) { sum -= ch ; sum += 9 ; count ++ ; if ( sum >= k ) { System . out . println ( count ) ; return ; } } } }   static class FastScanner {   BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( " " ) ;   String next ( ) { while ( ! st . hasMoreTokens ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   long nextLong ( ) {   return Long . parseLong ( next ( ) ) ; }   double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; }   String nextLine ( ) throws IOException { return br . readLine ( ) ; } }   }


import java . io . File ; import java . io . FileNotFoundException ; import java . io . IOException ; import java . io . PrintWriter ; import java . util . * ;   public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; int a [ ] = new int [ n ] ; int b [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = input . nextInt ( ) ; } long sum = a [ n - 1 ] ; for ( int i = n - 2 ; i >= 0 ; i -- ) { if ( a [ i ] <= sum ) b [ i ] = ( int ) ( sum ) - a [ i ] + 1 ; else if ( a [ i ] > sum ) { sum = a [ i ] ; } } for ( int i = 0 ; i < n ; i ++ ) { System . out . print ( b [ i ] + " ▁ " ) ; } System . out . println ( " " ) ; }   }

n = int ( input ( ) ) h = list ( map ( int , input ( ) . split ( ) ) ) r = [ 0 ] m = h [ - 1 ]   for i in range ( n - 2 , - 1 , - 1 ) : if h [ i ] <= m : r . append ( m + 1 - h [ i ] ) else : r . append ( 0 ) m = h [ i ] for i in range ( n - 1 , - 1 , - 1 ) : print ( r [ i ] , end = ' ▁ ' ) NEW_LINE


n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) max1 = 0 arr1 = [ ] for i in range ( n - 1 , - 1 , - 1 ) : if l [ i ] > max1 : max1 = l [ i ] arr1 . append ( 0 ) elif l [ i ] == max1 : arr1 . append ( 1 ) else : arr1 . append ( max1 - l [ i ] + 1 ) arr1 = arr1 [ : : - 1 ] print ( * arr1 ) NEW_LINE


n = int ( input ( ) ) houses = [ int ( h ) for h in input ( ) . split ( ) ] [ : : - 1 ]   maxheight = houses [ 0 ]   res = [ ] res . append ( 0 )   for house in houses [ 1 : ] : if house <= maxheight : res . append ( maxheight - house + 1 ) else : res . append ( 0 ) maxheight = max ( maxheight , house )   res1 = [ str ( r ) for r in res [ : : - 1 ] ]   print ( ' ▁ ' . join ( res1 ) ) NEW_LINE


n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) l = [ 0 ] * nm = a [ n - 1 ] for i in range ( n - 2 , - 1 , - 1 ) : l [ i ] = max ( 0 , m - a [ i ] + 1 ) m = max ( m , a [ i ] ) print ( * l ) NEW_LINE


import java . util . Scanner ;   public class Practice { public static Scanner input = new Scanner ( System . in ) ;   public static void main ( String [ ] args ) { int n = input . nextInt ( ) ; int [ ] arr = new int [ n ] ; int m [ ] = new int [ n ] ; int maxi = arr [ n - 1 ] ; for ( int i = 0 ; i < n ; i ++ ) arr [ i ] = input . nextInt ( ) ; for ( int i = n - 1 ; i >= 0 ; i -- ) { m [ i ] = Math . max ( 0 , maxi - arr [ i ] + 1 ) ; if ( maxi < arr [ i ] ) maxi = arr [ i ] ; } for ( int i = 0 ; i < n ; i ++ ) System . out . print ( m [ i ] + " ▁ " ) ; }  	  }


import java . util . Scanner ;   public class Codeforces581BLuxeryHouse {   public static void main ( String [ ] args ) { int a , b , sum = 0 ; Scanner scanner = new Scanner ( System . in ) ; a = scanner . nextInt ( ) ; int [ ] arr = new int [ a ] ; for ( int i = 0 ; i < a ; i ++ ) { arr [ i ] = scanner . nextInt ( ) ; } int [ ] answer = new int [ a ] ; answer [ a - 1 ] = 0 ; for ( int i = a - 2 ; i >= 0 ; i -- ) { if ( arr [ i + 1 ] >= arr [ i ] ) { answer [ i ] = arr [ i + 1 ] - arr [ i ] + 1 ; arr [ i ] = arr [ i ] + arr [ i + 1 ] - arr [ i ] ; }   else answer [ i ] = 0 ;   } for ( int j : answer ) { System . out . print ( j + " ▁ " ) ; } }   }


import java . util . * ;    public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; long a [ ] [ ] = new long [ n ] [ 2 ] ; long max = 0 ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] [ 0 ] = input . nextLong ( ) ; } max = a [ n - 1 ] [ 0 ] ; a [ n - 1 ] [ 1 ] = max ; for ( int i = n - 2 ; i >= 0 ; i -- ) { a [ i ] [ 1 ] = max ; max = Math . max ( max , a [ i ] [ 0 ] ) ; } for ( int i = 0 ; i < n ; i ++ ) { if ( i == n - 1 ) { System . out . println ( "0" ) ; return ; } System . out . print ( ( ( a [ i ] [ 1 ] - a [ i ] [ 0 ] ) < 0 ) ? 0 + " ▁ " : ( ( ( a [ i ] [ 1 ] - a [ i ] [ 0 ] ) + 1 ) ) + " ▁ " ) ; } } }


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

from heapq import heappush , heappopn , k1 , k2 = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) b = list ( map ( int , input ( ) . split ( ) ) ) pq = [ ] for i in range ( n ) : if abs ( a [ i ] - b [ i ] ) > 0 : heappush ( pq , - abs ( a [ i ] - b [ i ] ) ) tot = k1 + k2while pq and tot > 0 : ce = - heappop ( pq ) tot -= 1 if ce == 1 : continue heappush ( pq , - ( ce - 1 ) ) ans = 0 if tot > 0 : ans = tot % 2 elif pq : for elm in pq : ans += elm ** 2 print ( ans ) NEW_LINE


n , oa , ob = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) b = list ( map ( int , input ( ) . split ( ) ) ) diff = [ ] for i , j in zip ( a , b ) : diff . append ( abs ( i - j ) ) k = oa + obwhile k > 0 : diff . sort ( ) if diff [ len ( diff ) - 1 ] == 0 : break diff [ len ( diff ) - 1 ] = diff [ len ( diff ) - 1 ] - 1 k = k - 1 if k & 1 == 1 : print ( 1 ) else : ans = [ i ** 2 for i in diff ] print ( sum ( ans ) ) NEW_LINE


R = lambda : map ( int , input ( ) . split ( ) ) n , k1 , k2 = R ( )   diff = [ abs ( x1 - x2 ) for x1 , x2 in zip ( R ( ) , R ( ) ) ]   for _ in range ( k1 + k2 ) : diff . sort ( ) diff [ - 1 ] = abs ( diff [ - 1 ] - 1 )   print ( sum ( i ** 2 for i in diff ) ) NEW_LINE


import java . util . * ; import java . io . * ; public class EdA {   public static void main ( String [ ] args ) throws Exception { int num = 998244353 ;


import java . io . * ; import java . util . * ; import java . math . * ;   public class Main { public static void main ( String [ ] args ) throws java . lang . Exception { Reader pm = new Reader ( ) ;


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

for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) a = [ int ( x ) for x in input ( ) . split ( ) ] x = 0 add = 0 for i in range ( 1 , n ) : if a [ i - 1 ] > a [ i ] : diff = a [ i - 1 ] - a [ i ] while diff > add : add += 2 ** x x += 1 a [ i ] = a [ i - 1 ] print ( x ) NEW_LINE


for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) a = [ int ( x ) for x in input ( ) . split ( ) ] maxi = 0 for i in range ( 1 , n ) : if a [ i - 1 ] > a [ i ] : maxi = max ( maxi , a [ i - 1 ] - a [ i ] ) a [ i ] = a [ i - 1 ] temp = bin ( maxi ) if temp [ 2 ] == '0' : print ( len ( temp ) - 3 ) else : print ( len ( temp ) - 2 ) NEW_LINE


from math import logfor _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) a = [ int ( x ) for x in input ( ) . split ( ) ] NEW_LINE


import mathfrom collections import defaultdict , Counter , deque   INF = float ( ' inf ' )   t = int ( input ( ) ) for _ in range ( t ) : n = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) )   peak = - INF diff = 0 for i in range ( n ) : peak = max ( peak , arr [ i ] ) diff = max ( diff , peak - arr [ i ] )   p = 1 cnt = 0 while p <= diff : p *= 2 cnt += 1   print ( cnt )   NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . Collections ; import java . util . StringTokenizer ;   public class Main {   public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( ) ; System . out . println ( ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int n = sc . nextInt ( ) ; int a [ ] = new int [ n ] ; int maxSoFar = Integer . MIN_VALUE ; int max = 0 ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; maxSoFar = Math . max ( maxSoFar , a [ i ] ) ; max = Math . max ( max , maxSoFar - a [ i ] ) ; } int ans = 0 ; while ( max > 0 ) { max /= 2 ; ans ++ ; } System . out . println ( ans ) ; }   }   static void sort ( int [ ] a ) { ArrayList < Integer > l = new ArrayList < > ( ) ; for ( int i : a ) l . add ( i ) ; Collections . sort ( l ) ; for ( int i = 0 ; i < a . length ; i ++ ) a [ i ] = l . get ( i ) ; }   }   class Scanner { BufferedReader br ; StringTokenizer st ;   Scanner ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; }   String next ( ) throws IOException { while ( st == null || ! st . hasMoreElements ( ) ) st = new StringTokenizer ( br . readLine ( ) ) ; return st . nextToken ( ) ; }   int nextInt ( ) throws NumberFormatException , IOException { return Integer . parseInt ( next ( ) ) ; }   long nextLong ( ) throws NumberFormatException , IOException { return Long . parseLong ( next ( ) ) ; }   double nextDouble ( ) throws NumberFormatException , IOException { return Double . parseDouble ( next ( ) ) ; } }


from sys import stdint = int ( stdin . readline ( ) ) # t = 1   for _ in xrange ( t ) : # a , b = map ( int , stdin . readline ( ) . split ( ) ) n = int ( stdin . readline ( ) ) a = map ( int , stdin . readline ( ) . split ( ) ) # b = map ( int , stdin . readline ( ) . split ( ) ) pr = a [ 0 ] dif = 0 for i in a : pr = max ( pr , i ) dif = max ( dif , pr - i ) cur = 0 while True : if ( 1 << cur ) > dif : break cur += 1 print cur


import java . util . Scanner ;   public class Solution { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int totalCases = input . nextInt ( ) ;   for ( int caseNumber = 1 ; caseNumber <= totalCases ; caseNumber ++ ) { int arrayLength = input . nextInt ( ) ; int previousElement = Integer . MIN_VALUE ; int maximumDifference = 0 ;   for ( int index = 0 ; index < arrayLength ; index ++ ) { int currentElement = input . nextInt ( ) ;   if ( previousElement > currentElement ) { maximumDifference = Math . max ( maximumDifference , previousElement - currentElement ) ; } else { previousElement = currentElement ; } }   System . out . println ( ( int ) Math . ceil ( Math . log ( maximumDifference + 1 ) / Math . log ( 2 ) ) ) ; } } }


import java . util . * ; import java . io . * ; import java . io . FileInputStream ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . * ; import java . io . FileInputStream ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ; import java . math . * ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class Sol { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int n = sc . nextInt ( ) ; Long [ ] ar = new Long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { ar [ i ] = sc . nextLong ( ) ; } Long curMax = Long . MIN_VALUE ; Long max = Long . MIN_VALUE ; for ( int i = 0 ; i < n ; i ++ ) { if ( ar [ i ] > curMax ) { curMax = ar [ i ] ; } if ( ar [ i ] < curMax ) { max = Math . max ( curMax - ar [ i ] , max ) ; } } int ans = 0 ; for ( int i = 0 ; i <= 32 ; i ++ ) { Long x = ( long ) Math . pow ( 2 , i ) ; if ( x <= max ) { ans ++ ; } else { break ; } } System . out . println ( ans ) ; } } }


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

def hcfnaive ( a , b ) : if ( b == 0 ) : return a else : return hcfnaive ( b , a % b ) n = int ( input ( ) ) li = [ int ( x ) for x in input ( ) . split ( ) ] a = li [ 0 ] for _ in range ( n - 1 ) : a = hcfnaive ( a , li [ _ + 1 ] ) print ( a * n ) NEW_LINE


""" Handle : ▁ shashank - sharmaCreated ▁ at : ▁ 12-03-2021T17:16:49 """   import sysinput = sys . stdin . readline   NEW_LINE


n = input ( ) n1 = int ( n ) c = list ( map ( int , input ( ) . split ( ) [ : n1 ] ) ) c . sort ( reverse = True ) l = len ( c ) i = - 1 while i < l - 2 : i = i + 1 if i == l - 1 : break if c [ i ] > c [ i + 1 ] : c [ i ] = c [ i ] - c [ i + 1 ] c . sort ( reverse = True ) i = - 1 print ( sum ( c ) ) NEW_LINE


def hcf ( x , y ) : while ( y ) : x , y = y , x % y return x   n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) h = hcf ( l [ 0 ] , l [ 1 ] ) for i in range ( 2 , n ) : h = hcf ( h , l [ i ] ) print ( h * n ) NEW_LINE


try : n = int ( input ( ) ) k = [ int ( i ) for i in input ( ) . split ( ) ] k . sort ( ) while ( min ( k ) != max ( k ) ) : k [ n - 1 ] = k [ n - 1 ] - k [ 0 ] k . sort ( ) print ( min ( k ) * n ) except : pass NEW_LINE


import java . util . * ; import java . io . * ;   public class _practise { public static void main ( String args [ ] ) { FastReader in = new FastReader ( ) ; PrintWriter so = new PrintWriter ( new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ) ; int t = 1 ; while ( t -- > 0 ) { int n = in . nextInt ( ) ; int a [ ] = new int [ n ] ; int min = 101 , s = 0 ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = in . nextInt ( ) ; min = Math . min ( a [ i ] , min ) ; if ( i > 0 && a [ i ] == a [ i - 1 ] ) s ++ ; } if ( n != 2 ) { boolean flag = true ; int c = 0 ; int ans = - 1 ; for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] % min == 0 ) c ++ ; } if ( c == n ) { ans = min ; flag = false ; } if ( flag ) for ( int i = 2 ; i <= min ; i ++ ) { c = 0 ; for ( int j = 0 ; j < n ; j ++ ) { if ( a [ j ] % i == 0 ) c ++ ; } if ( c == n ) { ans = i ; flag = false ; break ; } }


import java . util . Scanner ;   public class _0714FoxandNumberGame { static boolean isPrime ( int n ) {


import java . util . * ;   public class Check2 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; int [ ] ar = new int [ t ] ; int gcd = 0 ; for ( int i = 0 ; i < t ; i ++ ) { ar [ i ] = sc . nextInt ( ) ; gcd = ( int ) gcd ( ar [ i ] , gcd ) ; } System . out . println ( gcd * t ) ;          }     public static long power ( long a , long b , long c ) { long ans = 1 ; while ( b != 0 ) { if ( b % 2 == 1 ) { ans = ans * a ; ans %= c ; } a = a * a ; a %= c ; b /= 2 ; } return ans ; }   public static long power1 ( long a , long b , long c ) { long ans = 1 ; while ( b != 0 ) { if ( b % 2 == 1 ) { ans = multiply ( ans , a , c ) ; } a = multiply ( a , a , c ) ; b /= 2 ;   } return ans ;   }   public static long multiply ( long a , long b , long c ) { long res = 0 ; a %= c ; while ( b > 0 ) { if ( b % 2 == 1 ) { res = ( res + a ) % c ; } a = ( a + a ) % c ; b /= 2 ; }   return res % c ;   }   public static long totient ( long n ) { long result = n ; for ( long i = 2 ; i * i <= n ; i ++ ) { if ( n % i == 0 ) {


import java . util . Scanner ; import java . lang . * ; public class Solution { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int largest ; int smallest ; int help ; int z1 = 0 ; int arr1 [ ] = new int [ n ] ; for ( int i1 = 0 ; i1 < n ; i1 ++ ) { arr1 [ i1 ] = sc . nextInt ( ) ; } for ( int i2 = 0 ; i2 < n ; i2 ++ ) { for ( int i3 = i2 ; i3 < n ; i3 ++ ) { int o1 = ( arr1 [ i2 ] > arr1 [ i3 ] ) ? ( arr1 [ i2 ] ) : ( arr1 [ i3 ] ) ; arr1 [ i3 ] = ( arr1 [ i2 ] < arr1 [ i3 ] ) ? ( arr1 [ i2 ] ) : ( arr1 [ i3 ] ) ; arr1 [ i2 ] = o1 ; } } largest = arr1 [ 0 ] ; smallest = arr1 [ n - 1 ] ;


import java . util . * ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; char a = sc . next ( ) . charAt ( 0 ) ; char b = sc . next ( ) . charAt ( 0 ) ; int n = sc . nextInt ( ) ; int x = 0 , y = 0 ; if ( a == ' v ' ) x = 1 ; else if ( a == ' < ' ) x = 2 ; else if ( a == ' ^ ' ) x = 3 ; else if ( a == ' > ' ) x = 4 ; if ( b == ' v ' ) y = 1 ; else if ( b == ' < ' ) y = 2 ; else if ( b == ' ^ ' ) y = 3 ; else if ( b == ' > ' ) y = 4 ; int d = ( ( y - x ) + 4 ) % 4 ; if ( d == 0 || d == 2 ) { System . out . println ( " undefined " ) ; } else if ( d == n % 4 ) { System . out . println ( " cw " ) ; } else { System . out . println ( " ccw " ) ; } } }

DIRS = [ ' v ' , ' < ' , ' ^ ' , ' > ' ] a , b = map ( DIRS . index , input ( ) . split ( ) ) n = int ( input ( ) ) delta = ( b - a + 4 ) % 4 if delta == 0 or delta == 2 : print ( ' undefined ' ) elif delta == n % 4 : print ( ' cw ' ) else : print ( ' ccw ' ) NEW_LINE


a , b = input ( ) . split ( ) n = int ( input ( ) ) l = [ ' v ' , ' < ' , ' ^ ' , ' > ' ] i = l . index ( a ) j = l . index ( b ) if ( j - i + 4 ) % 4 == 0 or ( j - i + 4 ) % 4 == 2 : print ( ' undefined ' ) elif ( j - i + 4 ) % 4 == n % 4 : print ( ' cw ' ) else : print ( ' ccw ' ) NEW_LINE


a , c , b = list ( str ( input ( ) ) ) n = int ( input ( ) ) s = [ 94 , 62 , 118 , 60 ] if n % 2 == 0 : print ( " undefined " ) else : k = s . index ( ord ( a ) ) if s [ ( k + n ) % 4 ] == ord ( b ) : print ( " cw " ) else : print ( " ccw " )     NEW_LINE


start , end = map ( str , input ( ) . split ( ) ) rotating_time = int ( input ( ) )   array = [ " < " , " ^ " , " > " , " v " ]   if ( rotating_time == 1 ) : start_ix = array . index ( start ) end_idx = start_ix + 1 if ( end_idx > 3 ) : end_idx = 0 if ( end == array [ end_idx ] ) : print ( " cw " ) else : end_idx = start_ix - 1 if ( start_ix == - 1 ) : start_ix = 3 if ( end == array [ end_idx ] ) : print ( " ccw " ) else : print ( " undefined " ) else : rotating_time -= 2 time_left = rotating_time % 4 start_ix = array . index ( start ) flag = 0 while True : end_idx = start_ix + time_left if ( end_idx > 3 ) : end_idx = end_idx - 4 if ( end == array [ end_idx ] ) : print ( " ccw " ) flag = - 1 break while flag == 0 : end_idx = start_ix - time_left if ( end_idx < 0 ) : end_idx = 4 + end_idx if ( end == array [ end_idx ] ) : print ( " cw " ) flag = 1 else : print ( " undefined " ) flag = 1 break NEW_LINE


import java . util . * ; import java . util . stream . * ; public class Solution { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String s = scan . nextLine ( ) ; int n = scan . nextInt ( ) ; Integer start = state ( s . charAt ( 0 ) ) ; Integer end = state ( s . charAt ( 2 ) ) ; n = n % 4 ; List < Integer > cw = Arrays . asList ( 1 , 2 , 3 , 4 , 1 , 2 , 3 , 4 ) ; List < Integer > ccw = Arrays . asList ( 1 , 4 , 3 , 2 , 1 , 4 , 3 , 2 ) ; String result ; boolean isCw = cw . get ( cw . indexOf ( start ) + n ) == end ; boolean isCcw = ccw . get ( ccw . indexOf ( start ) + n ) == end ; if ( isCw && ! isCcw ) { result = " cw " ; } else if ( isCcw && ! isCw ) { result = " ccw " ; } else { result = " undefined " ; } System . out . println ( result ) ; } private static int state ( char ch ) { if ( ch == ' v ' ) { return 1 ; } else if ( ch == ' < ' ) { return 2 ; } else if ( ch == ' ^ ' ) { return 3 ; } else if ( ch == ' > ' ) { return 4 ; } else { return - 1 ; } } }


import java . util . * ; public class Solution { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; String s1 = s . nextLine ( ) ; int n = s . nextInt ( ) ; char ch [ ] = { ' ^ ' , ' > ' , ' v ' , ' < ' } ; int p1 = 0 , p2 = 0 ; for ( int i = 0 ; i < 4 ; i ++ ) { if ( ch [ i ] == s1 . charAt ( 0 ) ) p1 = i ; if ( ch [ i ] == s1 . charAt ( 2 ) ) p2 = i ; } int step = n % 4 ; if ( step != 0 && step != 2 ) { if ( ch [ ( p1 + step ) % 4 ] == ch [ p2 ] ) { System . out . println ( " cw " ) ; } else if ( ch [ Math . abs ( p2 + step ) % 4 ] == ch [ p1 ] ) System . out . println ( " ccw " ) ; else System . out . println ( " undefined " ) ; } else System . out . println ( " undefined " ) ; } }


import java . util . * ; public class Cifera { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long k = sc . nextLong ( ) ; long l = sc . nextLong ( ) ; sc . close ( ) ;

import sysfrom functools import lru_cache , cmp_to_keyfrom heapq import merge , heapify , heappop , heappushfrom math import * from collections import defaultdict as dd , deque , Counter as Cfrom itertools import combinations as comb , permutations as permfrom bisect import bisect_left as bl , bisect_right as br , bisect , insortfrom time import perf_counterfrom fractions import Fractionimport copyfrom copy import deepcopyimport timestarttime = time . time ( ) mod = int ( pow ( 10 , 9 ) + 7 ) mod2 = 998244353   def data ( ) : return sys . stdin . readline ( ) . strip ( ) def out ( * var , end = " \n " ) : sys . stdout . write ( ' ▁ ' . join ( map ( str , var ) ) + end ) def L ( ) : return list ( sp ( ) ) def sl ( ) : return list ( ssp ( ) ) def sp ( ) : return map ( int , data ( ) . split ( ) ) def ssp ( ) : return map ( str , data ( ) . split ( ) ) def l1d ( n , val = 0 ) : return [ val for i in range ( n ) ] def l2d ( n , m , val = 0 ) : return [ l1d ( n , val ) for j in range ( m ) ] try : NEW_LINE


k = int ( input ( ) ) l = int ( input ( ) ) i = 1 c = 0 while k ** i < l + 1 : if k ** i == l : c = i break i += 1 if c == 0 : print ( " NO " ) else : print ( " YES " ) print ( c - 1 ) NEW_LINE


k = int ( input ( ) ) l = int ( input ( ) ) i = 0 while l > 1 : l /= k ; i += 1 if l == 1 : print ( " YES " ) print ( i - 1 ) else : print ( " NO " ) NEW_LINE


import math   k , l = int ( input ( ) ) , int ( input ( ) ) p = 0 while l >= k and l % k == 0 : l //= k p += 1   if p > 0 and l == 1 : print ( ' YES ' ) print ( p - 1 ) else : print ( ' NO ' ) NEW_LINE


a = int ( input ( ) ) b = int ( input ( ) ) c = 0 x = awhile a * x <= b : c += 1 a *= x     if a == b : print ( " YES \n " , c ) else : print ( " NO " ) NEW_LINE


import java . util . Scanner ;   public class Ciferia {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long k = sc . nextLong ( ) ; long num = sc . nextLong ( ) ; Cafe ( k , num ) ; }   public static void Cafe ( long k , long num ) { boolean check = false ; long ans = 0 ; long a = k ; if ( k == num ) { ans = 0 ; check = true ; } else { while ( a * k <= num ) { ans ++ ; if ( a * k == num ) { check = true ; break ; } k = a * k ; } }   if ( check ) { System . out . println ( " YES " ) ; System . out . println ( ans ) ; } else { System . out . println ( " NO " ) ; } }   }


import java . util . Scanner ;   public class cifera { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int number = sc . nextInt ( ) ; int i = 1 ; if ( number % n != 0 ) { System . out . println ( " NO " ) ; return ; } else { while ( Math . pow ( n , i ) <= number ) { i ++ ;


import java . util . Scanner ; public class Solution { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long l = sc . nextLong ( ) ; int z1 = 0 ; int z2 = 0 ; long po = n ; if ( n == 1 ) { if ( l == 1 ) { System . out . println ( " YES " ) ; System . out . println ( 0 ) ; } else { System . out . println ( " NO " ) ; } } else { while ( po <= l ) { if ( po == l ) { System . out . println ( " YES " ) ; System . out . println ( z1 ) ; z2 ++ ; po = po * n ; } else { po = po * n ; z1 ++ ; } } if ( z2 == 0 ) { System . out . println ( " NO " ) ; } } } }


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


import java . io . BufferedWriter ; import java . io . IOException ; import java . io . OutputStreamWriter ; import java . util . ArrayList ; import java . util . HashSet ; import java . util . List ; import java . util . Scanner ;   public class PrincessesAndPrinces { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int test = scanner . nextInt ( ) ; try ( BufferedWriter output = new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ) { outerLoop : while ( test -- > 0 ) { int n = scanner . nextInt ( ) ; boolean [ ] isReserved = new boolean [ n + 1 ] ; List < Integer > single = new ArrayList < > ( ) ; HashSet < Integer > singleP = new HashSet < > ( ) ; List < List < Integer > > priority = new ArrayList < > ( n + 1 ) ; priority . add ( new ArrayList < > ( ) ) ; for ( int i = 1 ; i <= n ; i ++ ) { singleP . add ( i ) ; int k = scanner . nextInt ( ) ; List < Integer > t = new ArrayList < > ( k ) ; for ( int j = 1 ; j <= k ; j ++ ) { int temp = scanner . nextInt ( ) ; t . add ( temp ) ; } priority . add ( t ) ; } for ( int i = 1 ; i <= n ; i ++ ) { boolean flag = false ; for ( int j : priority . get ( i ) ) { if ( ! isReserved [ j ] ) { isReserved [ j ] = true ; flag = true ; singleP . remove ( j ) ; break ; } } if ( ! flag ) { single . add ( i ) ; } } if ( single . size ( ) == 0 ) { output . write ( " OPTIMAL \n " ) ; } else { for ( int i : single ) { for ( int j : singleP ) { if ( ! priority . get ( i ) . contains ( j ) ) { output . write ( " IMPROVE \n " ) ; output . write ( i + " ▁ " + j + " \n " ) ; continue outerLoop ; } } } output . write ( " OPTIMAL \n " ) ; } } output . flush ( ) ; } catch ( IOException e ) { } } }

def calc ( optionsList ) : unusedDaughter = None usedKingdoms = [ False ] * ( len ( optionsList ) + 5 ) for daughterIdx , options in enumerate ( optionsList ) : kingdomFound = False for option in options : if not usedKingdoms [ option ] : usedKingdoms [ option ] = True kingdomFound = True break if not kingdomFound : unusedDaughter = daughterIdx toImprove = None if unusedDaughter is not None : for idx in range ( 1 , len ( optionsList ) + 1 ) : if not usedKingdoms [ idx ] : toImprove = " { } ▁ { } " . format ( unusedDaughter + 1 , idx ) break   NEW_LINE


import sys   def answer ( n , g ) : NEW_LINE


def calc ( optionsList ) : unusedDaughter = None usedKingdoms = [ False ] * ( len ( optionsList ) + 5 ) for daughterIdx , options in enumerate ( optionsList ) : kingdomFound = False for option in options : if not usedKingdoms [ option ] : usedKingdoms [ option ] = True kingdomFound = True break if not kingdomFound : unusedDaughter = daughterIdx toImprove = None if unusedDaughter is not None : for idx in range ( 1 , len ( optionsList ) + 1 ) : if not usedKingdoms [ idx ] and idx not in optionsList [ unusedDaughter ] : toImprove = " { } ▁ { } " . format ( unusedDaughter + 1 , idx ) break   NEW_LINE


import java . math . * ; import java . util . * ; public class PrincessAndPrince { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int runs = sc . nextInt ( ) ; while ( runs -- > 0 ) { int size = sc . nextInt ( ) ; boolean optimal = true ; int [ ] arr = new int [ size + 1 ] ; int out = 0 ; boolean add = false ; int [ ] dex = new int [ 2 ] ; for ( int i = 1 ; i < size + 1 ; i ++ ) { arr [ i ] = 1 ; } for ( int i = 0 ; i < size ; i ++ ) { int len = sc . nextInt ( ) ; boolean fill = false ; for ( int j = 0 ; j < len ; j ++ ) { int num = sc . nextInt ( ) ; if ( ! fill ) { if ( arr [ num ] == 1 ) { out ++ ; arr [ num ] -- ; fill = true ; } } } if ( ! fill && add == false ) { dex [ 0 ] = i + 1 ; add = true ; } } if ( add ) { for ( int j = 1 ; j < size + 1 ; j ++ ) { if ( arr [ j ] == 1 ) { arr [ j ] = 0 ; out ++ ; optimal = false ; dex [ 1 ] = j ; break ; } } } if ( optimal ) System . out . println ( " OPTIMAL " ) ; else { System . out . println ( " IMPROVE " ) ; System . out . println ( dex [ 0 ] + " ▁ " + dex [ 1 ] ) ; } } } }


import java . io . IOException ; import java . util . * ; import java . util . Arrays ; import java . util . Scanner ;   public class Bit_year { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int T = sc . nextInt ( ) ; while ( T -- > 0 ) { int n = sc . nextInt ( ) ; LinkedList < Integer > [ ] adj = new LinkedList [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) adj [ i ] = new LinkedList ( ) ; Set < Integer > prince = new HashSet < Integer > ( ) ; for ( int i = 1 ; i <= n ; i ++ ) { int s = sc . nextInt ( ) ; while ( s -- > 0 ) { adj [ i ] . add ( sc . nextInt ( ) ) ; } Collections . sort ( adj [ i ] ) ; prince . add ( i ) ; } boolean [ ] visited = new boolean [ n + 1 ] ; boolean [ ] visitedD = new boolean [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) { Iterator itr = adj [ i ] . listIterator ( ) ; while ( itr . hasNext ( ) ) { int m = ( int ) itr . next ( ) ; if ( ! visited [ m ] ) { visited [ m ] = true ; prince . remove ( m ) ; visitedD [ i ] = true ; break ; } } }


import java . util . * ; import java . io . * ; import java . io . FileInputStream ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . * ; import java . io . FileInputStream ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ; import java . math . * ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;    public class Sol { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int n = sc . nextInt ( ) ; boolean [ ] matched = new boolean [ n + 1 ] ; int extra = 0 ; int [ ] array = new int [ n + 1 ] ; int pair = 0 ; boolean [ ] daughter = new boolean [ n + 1 ] ; int boy = - 1 ; int girl = - 1 ; int left = 0 ; int index = - 1 ; for ( int i = 1 ; i <= n ; i ++ ) { int k = sc . nextInt ( ) ; boolean found = false ; while ( k > 0 ) { int prince = sc . nextInt ( ) ; if ( matched [ prince ] == false && daughter [ i ] == false ) { matched [ prince ] = true ; daughter [ i ] = true ; pair ++ ; array [ prince ] = - 1 ; found = true ; k -- ; continue ; } k -- ; }   if ( found == false ) { left ++ ; index = i ; } } int b = - 1 ; if ( left > 0 ) { for ( int i = 1 ; i <= n ; i ++ ) { if ( array [ i ] == 0 ) { b = i ; break ; } } } if ( left > 0 && b != - 1 ) { System . out . println ( " IMPROVE " ) ; System . out . println ( index + " ▁ " + b ) ; } else { System . out . println ( " OPTIMAL " ) ; } } } }


import java . util . * ; import java . io . * ;   public class Main { public static void main ( String [ ] args ) throws IOException { FastScanner in = new FastScanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; Main m = new Main ( ) ; int t = in . nextInt ( ) ; while ( t -- > 0 ) { m . run ( in , out ) ; }   out . close ( ) ; }   public static long mod = 17352642619633L ;   static char [ ] cat = " abacaba " . toCharArray ( ) ; static int [ ] kmp ( char [ ] ca ) { int [ ] kmp = new int [ ca . length ] ; int N = ca . length ; for ( int i = 1 ; i < N ; i ++ ) { int p = kmp [ i - 1 ] ; while ( p > 0 && ca [ p ] != ca [ i ] ) { p = kmp [ p - 1 ] ; } if ( ca [ p ] == ca [ i ] ) p ++ ; kmp [ i ] = p ; } return kmp ; } static int [ ] kmp = kmp ( cat ) ;    void run ( FastScanner in , PrintWriter out ) {   int N = in . nextInt ( ) ; char [ ] ca = in . next ( ) . toCharArray ( ) ;

def count ( s , want ) : ans = 0 for i in range ( n ) : if s [ i : i + 7 ] == want : ans += 1 return ansfor _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) s = input ( ) want = ' abacaba ' f = 0 for i in range ( n - 6 ) : flag = 0 for j in range ( 7 ) : if s [ i + j ] != want [ j ] and s [ i + j ] != " ? " : flag = 1 if flag == 1 : continue ss = " " . join ( s [ : i ] + want + s [ i + 7 : ] ) if count ( ss , want ) == 1 : ss = ss . replace ( " ? " , ' z ' ) print ( " Yes " ) print ( ss ) f = 1 break if f == 0 : print ( " No " ) NEW_LINE


''' import ▁ sysdef ▁ get _ ints ( ) : ▁ return ▁ map ( int , ▁ sys . stdin . readline ( ) . strip ( ) . split ( ) )  def ▁ sort _ list ( list1 , ▁ list2 ) : ▁ ▁ ▁ ▁ zipped _ pairs ▁ = ▁ zip ( list2 , ▁ list1 )   ▁ ▁ ▁ ▁ z ▁ = ▁ [ x ▁ for ▁ _ , ▁ x ▁ in ▁ sorted ( zipped _ pairs ) ]   ▁ ▁ ▁ ▁ return ▁ z ''' def coun ( s ) : c = 0 x = " abacaba " for i in range ( n - len ( x ) + 1 ) : if " " . join ( s [ i : i + len ( x ) ] ) == x : c += 1 return c   for ad in range ( int ( input ( ) ) ) : n = int ( input ( ) ) s = list ( input ( ) ) c = coun ( s ) NEW_LINE


import sysfrom math import sqrtinput = lambda : sys . stdin . readline ( ) . rstrip ( " \n " ) lm = lambda : list ( map ( int , input ( ) . split ( ) ) )   for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) a = [ ] [ a . append ( i ) for i in input ( ) ] ck = [ ' a ' , ' b ' , ' a ' , ' c ' , ' a ' , ' b ' , ' a ' ] 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 check ( pat , txt ) : M = len ( pat ) N = len ( txt ) res = 0 for i in range ( N - M + 1 ) : j = 0 while j < M : if ( txt [ i + j ] != pat [ j ] ) : break j += 1 if ( j == M ) : res += 1 j = 0 return res for _ in range ( it ( ) ) : n = it ( ) s = input ( ) l = ' abacaba ' k = check ( l , s ) NEW_LINE


import java . io . BufferedReader ; import java . io . FileNotFoundException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . Random ; import java . util . StringTokenizer ;   public class Main { private static final Random random = new Random ( ) ; static PrintWriter out = new PrintWriter ( System . out ) ;   public static void main ( String [ ] args ) throws FileNotFoundException {

n , m = map ( int , input ( ) . split ( ) ) arr = [ 0 ] * n for i in range ( m ) : a , b , c = map ( int , input ( ) . split ( ) ) a -= 1 b -= 1 arr [ b ] += c arr [ a ] -= c s = 0 for e in arr : if e < 0 : s += - e print ( s ) NEW_LINE


from sys import stdina , b = map ( int , stdin . readline ( ) . split ( ) ) ; z = [ 0 ] * afor _ in " ▁ " * b : u , v , w = map ( int , stdin . readline ( ) . split ( ) ) ; z [ u - 1 ] += w ; z [ v - 1 ] -= wprint ( sum ( max ( 0 , z [ i ] ) for i in range ( a ) ) ) NEW_LINE


from collections import defaultdict   n , m = map ( int , input ( ) . split ( ) ) s = defaultdict ( lambda : 0 ) for i in range ( m ) : a , b , c = map ( int , input ( ) . split ( ) ) s [ a ] -= c s [ b ] += c   print ( sum ( i for i in s . values ( ) if i > 0 ) ) NEW_LINE


from collections import defaultdictn , m = list ( map ( int , input ( ) . split ( ) ) ) friends_money = defaultdict ( int ) for friend in range ( 1 , n + 1 ) : friends_money [ friend ] for i in range ( m ) : f1 , f2 , money = list ( map ( int , input ( ) . split ( ) ) ) friends_money [ f1 ] = friends_money [ f1 ] - money friends_money [ f2 ] = friends_money [ f2 ] + money debt = 0 for money in friends_money . values ( ) : if money < 0 : debt = debt + abs ( money ) print ( debt ) NEW_LINE


n , m = map ( int , input ( ) . split ( ) )   debts = [ 0 ] * ( n + 1 )     for i in range ( m ) : a , b , debt = map ( int , input ( ) . split ( ) ) debts [ a ] -= debt debts [ b ] += debt     total = 0 for i in range ( n ) : if debts [ i + 1 ] > 0 : total += debts [ i + 1 ]   print ( total ) NEW_LINE


import java . util . Arrays ; import java . util . Scanner ;   public class practice { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; int m = input . nextInt ( ) ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < m ; i ++ ) { int from = input . nextInt ( ) - 1 ; int to = input . nextInt ( ) - 1 ; int value = input . nextInt ( ) ; arr [ from ] += value ; arr [ to ] -= value ; } Arrays . sort ( arr ) ; int total = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] > 0 ) break ; total += arr [ i ] ; } System . out . println ( Math . abs ( total ) ) ; }   }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Arrays ; import java . util . HashMap ; import java . util . Map ; import java . util . StringTokenizer ;    public class Main {   public static void main ( String [ ] args ) throws IOException {   BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer stk = new StringTokenizer ( in . readLine ( ) ) ;   int n = Integer . parseInt ( stk . nextToken ( ) ) ; int m = Integer . parseInt ( stk . nextToken ( ) ) ;   int arr [ ] = new int [ n + 1 ] ; Arrays . fill ( arr , 0 ) ; for ( int i = 0 ; i < m ; i ++ ) { stk = new StringTokenizer ( in . readLine ( ) ) ; int a = Integer . parseInt ( stk . nextToken ( ) ) ; int b = Integer . parseInt ( stk . nextToken ( ) ) ; int c = Integer . parseInt ( stk . nextToken ( ) ) ; arr [ a ] += c ; arr [ b ] -= c ; } long ans = 0 ; for ( int i = 0 ; i < n + 1 ; i ++ ) { if ( arr [ i ] > 0 ) ans += arr [ i ] ; } System . out . println ( ans ) ; } }


import java . util . Scanner ;   public class B376 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int N = in . nextInt ( ) ; int [ ] [ ] D = new int [ N ] [ N ] ; int M = in . nextInt ( ) ; for ( int m = 0 ; m < M ; m ++ ) { int from = in . nextInt ( ) - 1 ; int to = in . nextInt ( ) - 1 ; int amount = in . nextInt ( ) ; D [ from ] [ to ] = amount ; D [ to ] [ from ] = - amount ; } for ( int n = 0 ; n < N ; n ++ ) { int pos = 0 ; int neg = 0 ; while ( true ) { while ( pos < N && D [ pos ] [ n ] <= 0 ) pos ++ ; if ( pos == N ) break ; while ( neg < N && D [ neg ] [ n ] >= 0 ) neg ++ ; if ( neg == N ) break ; int transfer = Math . min ( D [ pos ] [ n ] , - D [ neg ] [ n ] ) ; D [ pos ] [ n ] -= transfer ; D [ n ] [ pos ] += transfer ; D [ neg ] [ n ] += transfer ; D [ n ] [ neg ] -= transfer ; D [ pos ] [ neg ] += transfer ; D [ neg ] [ pos ] -= transfer ; } } int answer = 0 ; for ( int from = 0 ; from < N ; from ++ ) { for ( int to = from + 1 ; to < N ; to ++ ) { answer += Math . abs ( D [ from ] [ to ] ) ; } } System . out . println ( answer ) ; }   }


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

f1 , t1 = [ int ( i ) for i in input ( ) . split ( " ▁ " ) ] f2 , t2 = [ int ( i ) for i in input ( ) . split ( " ▁ " ) ] time = [ str ( i ) for i in input ( ) . split ( " ▁ " ) ] time = time [ 0 ]   th , tm = time . split ( " : " ) th = int ( th ) tm = int ( tm )   NEW_LINE


import sys   a , ta = map ( int , input ( ) . split ( ) ) b , tb = map ( int , input ( ) . split ( ) ) h , m = map ( int , input ( ) . split ( ' : ' ) ) s , t = h * 60 + m , min ( h * 60 + m + ta , 24 * 60 ) ans = 0   for x in range ( 5 * 60 , 24 * 60 , b ) : if s < x + tb and t > x : ans += 1   print ( ans ) NEW_LINE


import sys   input = sys . stdin . readline     def gcd ( a , b ) : if a == 0 : return b return gcd ( b % a , a )     def lcm ( a , b ) : return ( a * b ) / gcd ( a , b )   def main ( ) : a , ta = map ( int , input ( ) . split ( ) ) b , tb = map ( int , input ( ) . split ( ) ) hh , mm = map ( int , input ( ) . split ( ' : ' ) ) secs = hh * 60 + mm - ( 5 * 60 - 1 ) curr = 0 i = 0 ans = 0 x1 = hh * 60 + mm y1 = x1 + ta for x2 in range ( 5 * 60 , 24 * 60 , b ) : y2 = x2 + tb x = max ( x1 , x2 ) y = min ( y1 , y2 ) if ( x < y ) : ans += 1 print ( ans )           return   if __name__ == " _ _ main _ _ " : main ( )   NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . StringTokenizer ;   public class BusesBetweenCities { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter pw = new PrintWriter ( System . out ) ;   StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; int a = Integer . parseInt ( st . nextToken ( ) ) ; int tA = Integer . parseInt ( st . nextToken ( ) ) ;   st = new StringTokenizer ( br . readLine ( ) ) ; int b = Integer . parseInt ( st . nextToken ( ) ) ; int tB = Integer . parseInt ( st . nextToken ( ) ) ;   String timing = br . readLine ( ) ;   int hrs = Integer . parseInt ( timing . substring ( 0 , 2 ) ) ; int mins = Integer . parseInt ( timing . substring ( 3 ) ) ;   int simDeparture = hrs * 60 + mins ; int simArrival = simDeparture + tA ;   int counter = 0 ; for ( int i = 300 ; i < 1440 ; i += b ) { int busDeparture = i ; int busArrival = i + tB ;   if ( busDeparture >= simArrival || simDeparture >= busArrival ) continue ; counter ++ ; }   pw . println ( counter ) ; pw . flush ( ) ; pw . close ( ) ; } }


import java . awt . * ; import java . io . * ; import java . util . * ; import java . lang . * ; import java . math . * ; import java . text . DecimalFormat ; import java . lang . reflect . Array ; import java . io . BufferedOutputStream ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . math . BigDecimal ; import java . security . cert . TrustAnchor ;   public class A { public static PrintWriter out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ; static long MOD = ( long ) ( 1e9 + 7 ) ;

n = int ( input ( ) )     t = input ( )       pre = [ ] suff = [ ]   if t [ 0 ] == ' G ' : pre . append ( 1 ) else : pre . append ( 0 )   if t [ - 1 ] == ' G ' : suff . append ( 1 ) else : suff . append ( 0 )             for i in range ( 1 , n ) : if t [ i ] == ' G ' : pre . append ( 1 + pre [ - 1 ] ) else : pre . append ( 0 )     u = n - 1 - i if t [ u ] == ' G ' : suff . append ( suff [ - 1 ] + 1 ) else : suff . append ( 0 )   suff = suff [ : : - 1 ]   g = t . count ( ' G ' )         ans = 0   for i in range ( n ) : if t [ i ] == ' S ' : if 0 < i < n - 1 : a = pre [ i - 1 ] + suff [ i + 1 ] elif i == 0 : a = suff [ i + 1 ] else : a = pre [ i - 1 ] NEW_LINE


import mathn = int ( input ( ) ) s = input ( ) l = [ 0 ] prev = " G " for i in range ( n ) : if ( s [ i ] == prev ) : l [ - 1 ] += 1 else : prev = s [ i ] l . append ( 1 ) ans = 0 h = s . count ( " G " ) for i in range ( 0 , len ( l ) , 2 ) : if ( l [ i ] != h ) : ans = max ( ans , l [ i ] + 1 ) else : ans = max ( ans , l [ i ] )   gg = [ ] for i in range ( 0 , len ( l ) - 2 , 2 ) : if ( l [ i + 1 ] == 1 ) : gg . append ( [ l [ i ] , l [ i + 2 ] ] )         for i in gg : if ( sum ( i ) != h ) : ans = max ( ans , sum ( i ) + 1 ) else : ans = max ( ans , sum ( i ) ) print ( ans ) NEW_LINE


n = int ( input ( ) ) s = input ( ) if s . count ( " G " ) == 0 : print ( 0 ) exit ( ) b = [ ] c = 1 s = s [ s . find ( " G " ) : ] n = len ( s ) for i in range ( 1 , n ) : if s [ i ] == s [ i - 1 ] : c += 1 else : b . append ( c ) c = 1 b . append ( c ) ans = 0 n = len ( b ) for i in range ( 0 , n , 2 ) : ans = max ( ans , b [ i ] ) g = ( len ( b ) - 1 ) // 2 + 1 if g > 1 : for i in range ( 0 , n , 2 ) : ans = max ( ans , b [ i ] + 1 ) for i in range ( 1 , n , 2 ) : if b [ i ] == 1 and i < n - 1 : if g > 2 : ans = max ( ans , b [ i - 1 ] + b [ i + 1 ] + 1 ) else : ans = max ( ans , b [ i - 1 ] + b [ i + 1 ] ) print ( ans ) NEW_LINE


import osimport sysfrom io import BytesIO , IOBaseimport mathimport itertoolsimport bisectimport heapq NEW_LINE


import java . util . * ;   public class CodeForces1082B { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; String s = input . next ( ) ; int cs = 0 , max = 0 , cg = 0 , res = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( s . charAt ( i ) == ' G ' ) { max ++ ; cg ++ ; } else { cs = cg ; cg = 0 ; } res = Math . max ( res , cs + cg + 1 ) ; } System . out . println ( Math . min ( res , max ) ) ; } }


import java . io . BufferedReader ; import java . io . * ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . StringTokenizer ; import java . util . * ; import java . math . * ; public class Main { static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } public static void main ( String args [ ] ) throws Exception { FastReader sc = new FastReader ( ) ; PrintWriter pw = new PrintWriter ( System . out ) ; int t = 1 ;

from collections import Counterimport stringimport mathimport sysdef array_int ( ) : return [ int ( i ) for i in sys . stdin . readline ( ) . split ( ) ] def vary ( number_of_variables ) : if number_of_variables == 1 : return int ( sys . stdin . readline ( ) ) if number_of_variables >= 2 : return map ( int , sys . stdin . readline ( ) . split ( ) ) def makedict ( var ) : return dict ( Counter ( var ) ) mod = 100000007 s = input ( ) x = y = n = 0 t = s . find ( ' + ' ) tt = s . find ( ' = ' ) x = s . count ( ' | ' , 0 , t ) y = s . count ( ' | ' , t + 1 , tt ) n = s . count ( ' | ' , tt + 1 , len ( s ) ) if x + y == n : print ( s ) elif x + 1 + y == n - 1 : print ( ' | ' * ( x + 1 ) + ' + ' + ' | ' * y + ' = ' + ' | ' * ( n - 1 ) ) elif x - 1 + y == n + 1 : if x != 1 : print ( ' | ' * ( x - 1 ) + ' + ' + ' | ' * y + ' = ' + ' | ' * ( n + 1 ) ) elif y > 1 : print ( ' | ' * ( x ) + ' + ' + ' | ' * ( y - 1 ) + ' = ' + ' | ' * ( n + 1 ) )   else : print ( ' Impossible ' ) else :   print ( ' Impossible ' )                                                                                NEW_LINE


s = input ( )   A = 0 B = 0 C = 0 i = 0 while ( s [ i ] != ' + ' ) : A += 1 i += 1 i += 1 while ( s [ i ] != ' = ' ) : B += 1 i += 1 C = len ( s ) - A - B - 2 sep = " | " if A + B != C and abs ( A + B - C ) != 2 : res = " Impossible " elif A + B == C : res = selif A + B == C + 2 and A != 1 : res = s [ 1 : ] + " | " elif A + B == C + 2 and A == 1 : res = " { } + { } = { } " . format ( sep * A , sep * ( B - 1 ) , sep * ( C + 1 ) ) elif A + B == C - 2 : res = " | " + s [ : - 1 ] print ( res ) NEW_LINE


str1 = input ( ) str = str1 . split ( ' = ' ) ans = str [ 0 ] . split ( ' + ' ) r = len ( ans [ 0 ] ) + len ( ans [ 1 ] ) if r - len ( str [ 1 ] ) != 0 and r - len ( str [ 1 ] ) != - 2 and r - len ( str [ 1 ] ) != 2 : print ( " Impossible " ) else : a = len ( ans [ 0 ] ) b = len ( ans [ 1 ] ) c = len ( str [ 1 ] ) if r - c == 2 : if a > 1 : a -= 1 else : b -= 1 c += 1 elif r - c == - 2 : a += 1 c -= 1 print ( a * ' | ' + ' + ' + b * ' | ' + ' = ' + c * ' | ' ) NEW_LINE


import java . lang . StringBuilder ; import java . io . BufferedReader ; import java . io . DataInputStream ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Deque ; import java . util . HashMap ; import java . util . LinkedList ; import java . util . Queue ; import java . util . Scanner ; import java . util . Stack ; import java . util . StringTokenizer ;   public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; String a = in . nextLine ( ) ; String z , v , m ; int x = a . indexOf ( " + " ) ; int y = a . indexOf ( " = " ) ; z = a . substring ( 0 , x ) ; v = a . substring ( x + 1 , y ) ; m = a . substring ( y + 1 , a . length ( ) ) ; if ( z . length ( ) + v . length ( ) == m . length ( ) ) { System . out . println ( a ) ; } else if ( z . length ( ) + 1 + v . length ( ) == m . length ( ) - 1 && m . length ( ) - 1 > 0 ) { a = ' | ' + a ; System . out . println ( a . substring ( 0 , a . length ( ) - 1 ) ) ; } else if ( z . length ( ) - 1 + v . length ( ) == m . length ( ) + 1 && z . length ( ) - 1 > 0 ) { a += ' | ' ; System . out . println ( a . substring ( 1 , a . length ( ) ) ) ; } else if ( z . length ( ) + v . length ( ) - 1 == m . length ( ) + 1 && v . length ( ) - 1 > 0 ) { v = v . substring ( 1 , v . length ( ) ) ; m += ' | ' ; System . out . println ( z + " + " + v + " = " + m ) ; } else System . out . println ( " Impossible " ) ;   } }


import java . lang . StringBuilder ; import java . io . BufferedReader ; import java . io . DataInputStream ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Deque ; import java . util . HashMap ; import java . util . LinkedList ; import java . util . Queue ; import java . util . Scanner ; import java . util . Stack ; import java . util . StringTokenizer ;   public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; String a = in . nextLine ( ) ; String z , v , m ; int x = a . indexOf ( " + " ) ; int y = a . indexOf ( " = " ) ; z = a . substring ( 0 , x ) ; v = a . substring ( x + 1 , y ) ; m = a . substring ( y + 1 , a . length ( ) ) ; if ( z . length ( ) + v . length ( ) == m . length ( ) ) { System . out . println ( a ) ; } else if ( z . length ( ) + 1 + v . length ( ) == m . length ( ) - 1 && m . length ( ) > 0 ) { a = ' | ' + a ; System . out . println ( a . substring ( 0 , a . length ( ) - 1 ) ) ; } else if ( z . length ( ) - 1 + v . length ( ) == m . length ( ) + 1 && z . length ( ) - 1 > 0 ) { a += ' | ' ; System . out . println ( a . substring ( 1 , a . length ( ) ) ) ; } else if ( z . length ( ) + v . length ( ) - 1 == m . length ( ) + 1 && v . length ( ) - 1 > 0 ) { v = v . substring ( 1 , v . length ( ) ) ; m += ' | ' ; System . out . println ( z + " + " + v + " = " + m ) ; } else System . out . println ( " Impossible " ) ;   } }


import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; String s = input . next ( ) ; char x = ' | ' , y = ' + ' , z = ' = ' ; long a = 0 , b = 0 , c = 0 , p = 0 , e = 0 ; int i ; for ( i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == y ) { p ++ ; } else if ( s . charAt ( i ) == z ) { e ++ ; } else if ( s . charAt ( i ) == x && p == 0 && e == 0 ) { a ++ ; } else if ( s . charAt ( i ) == x && p > 0 && e == 0 ) { b ++ ; } else if ( s . charAt ( i ) == x && p > 0 && e > 0 ) { c ++ ; } } if ( a + b == c ) { System . out . println ( s ) ; } else if ( Math . abs ( ( a + b ) - c ) == 2 ) { if ( a + b > c ) { if ( a > b && a > 1 ) a -- ; else b -- ; c ++ ; } else { a ++ ; c -- ; } for ( i = 0 ; i < a ; i ++ ) System . out . print ( " | " ) ; System . out . print ( " + " ) ; for ( i = 0 ; i < b ; i ++ ) System . out . print ( " | " ) ; System . out . print ( " = " ) ; for ( i = 0 ; i < c ; i ++ ) System . out . print ( " | " ) ; System . out . print ( " \n " ) ; } else { System . out . println ( " Impossible " ) ; } } }


import java . lang . * ; import java . util . * ; import java . util . stream . Collectors ; import java . io . * ;   public class Bouncing {   public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; long n = sc . nextLong ( ) ; long copy = n ; long bn = 0 ; while ( copy >= 10 ) { bn *= 10 ; bn += 9 ; copy /= 10 ;

n = int ( input ( ) )     def sum_of_digits ( numer ) : numer = str ( numer ) summ = 0 for digit in numer : summ += int ( digit ) return summ     if n < 10 : print ( n ) else : len_num = len ( str ( n ) ) - 1 num_1 = int ( len_num * "9" ) num_2 = n - num_1 NEW_LINE


def countsum ( s ) : l = list ( map ( int , list ( s ) ) ) return sum ( l ) t = int ( input ( ) ) if ( t > 9 ) : u = '9' * ( len ( str ( t ) ) - 1 ) print ( countsum ( u ) + countsum ( str ( t - int ( u ) ) ) ) elif ( t <= 9 ) : print ( t ) NEW_LINE


def maxSum ( a , b ) : s1 = 0 s2 = 0 for i in a : s1 = s1 + int ( i ) for i in b : s2 = s2 + int ( i ) print ( s1 + s2 ) returntry : n = input ( ) a = str ( int ( n [ 0 ] ) - 1 ) for i in range ( len ( n ) - 1 ) : a = a + "9" b = str ( int ( n ) - int ( a ) ) maxSum ( a , b ) except : pass NEW_LINE


n = int ( input ( ) ) res = 0 carrier = 0 while n > 9 : target = ( n % 10 ) - carrier if target == 9 : res += 9 carrier = 0 elif target == - 1 : res += 9 carrier = 1 else : res += 10 + target carrier = 1 n //= 10   print ( res + n - carrier ) NEW_LINE


def ds ( n ) : s = str ( n ) k = 0 for i in s : k += int ( i ) return kn = int ( input ( ) ) k = len ( str ( n ) ) - 1 m = str ( n ) s = " " print ( s ) if m [ 0 ] == "1" : s = "9" * kelse : s = "1" + "9" * kif s == " " : s = "0" x = n - int ( s ) print ( ds ( x ) + ds ( int ( s ) ) )         NEW_LINE


import java . util . * ;   public class Test { public static void main ( String [ ] args ) {   Scanner input = new Scanner ( System . in ) ; long n = input . nextLong ( ) ;   long a = ( long ) Math . pow ( 10 , ( long ) Math . log10 ( n ) ) - 1 ; long b = n - a ; int sum = 0 ;   while ( a > 0 ) { sum += a % 10 ; a /= 10 ; }   while ( b > 0 ) { sum += b % 10 ; b /= 10 ; } System . out . println ( sum ) ; } }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . * ;   public class Solution { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Long n = sc . nextLong ( ) ; ArrayList < Long > p = new ArrayList < Long > ( ) ; Long i = 2L , c = 0L ; outer : while ( i * i <= n ) { if ( n % i == 0 ) while ( n % i == 0 ) { c ++ ; p . add ( i ) ; n /= i ; if ( c == 3 ) { System . out . printf ( " % d \n % d " , 1 , p . get ( 0 ) * p . get ( 1 ) ) ; return ; } } i ++ ; } if ( n >= 2 ) { p . add ( i ) ; c ++ ; } if ( c == 2 ) System . out . println ( 2 ) ; else { if ( c <= 1 ) System . out . printf ( " % d \n % d " , 1 , 0 ) ; else System . out . printf ( " % d \n % d " , 1 , p . get ( 0 ) * p . get ( 1 ) ) ; } } static class FastScanner { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( " " ) ; String next ( ) { while ( ! st . hasMoreTokens ( ) ) try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } int [ ] readArray ( int n ) { int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextInt ( ) ; return a ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } } }

q = int ( input ( ) ) if q == 1 : print ( 1 ) print ( 0 ) else : ls = [ ] for i in range ( 2 , int ( q ** 0.5 ) + 1 ) : while q % i == 0 : ls . append ( i ) q = q // i if q > 1 : ls . append ( q ) if len ( ls ) > 2 : print ( 1 ) print ( ls [ 0 ] * ls [ 1 ] ) elif len ( ls ) == 2 : print ( 2 ) else : print ( 1 ) print ( 0 ) NEW_LINE


def factorize ( n ) : p = 2 r = [ ] while p * p <= n : while n % p == 0 : r . append ( p ) n //= p p += 1 if n > 1 : r . append ( n ) return r     q = int ( input ( ) ) f = factorize ( q ) if len ( f ) <= 1 : print ( 1 ) print ( 0 ) elif len ( f ) == 2 : print ( 2 ) else : print ( 1 ) print ( f [ 0 ] * f [ 1 ] ) NEW_LINE


def factorize ( q ) : factors = [ ] k = 2 while k * k <= q : while q % k == 0 : q //= k factors . append ( k ) k += 1 if q > 1 : factors . append ( q ) return factors     q = int ( input ( ) ) factors = factorize ( q ) if len ( factors ) <= 1 : print ( "1" ) print ( "0" ) elif len ( factors ) > 2 : print ( "1" ) print ( factors [ 0 ] * factors [ 1 ] ) else : print ( "2" ) NEW_LINE


import sysinput = sys . stdin . readlinedef read ( ) : return map ( int , input ( ) . split ( ) ) n = int ( input ( ) ) i = 2 ans , ans2 = 1 , 0 while i * i <= n : if n % i == 0 : ans += 1 ans2 = i n //= i break i += 1 while i * i <= n : if n % i == 0 : ans = 1 ans2 *= i n //= i break i += 1 if ans == 1 : print ( ans ) print ( ans2 ) else : print ( ans ) NEW_LINE


import java . io . * ; import java . util . ArrayList ;   public class Main { static PrintWriter pr = new PrintWriter ( new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ) ; public static void main ( String [ ] args ) throws IOException { long q = input . nextLong ( ) ; if ( q == 1 || isPrime ( q ) ) { pr . print ( "1 \n " + 0 ) ; pr . flush ( ) ; return ; } ArrayList list = new ArrayList ( ) ; for ( long i = 2 ; i * i <= q ; i ++ ) { while ( q % i == 0 ) { list . add ( i ) ; q /= i ; } if ( list . size ( ) >= 2 ) break ; } if ( q > 1 ) list . add ( q ) ; if ( list . size ( ) == 2 ) { pr . println ( 2 ) ; } else { pr . print ( "1 \n " + Long . valueOf ( String . valueOf ( list . get ( 0 ) ) ) * Long . valueOf ( String . valueOf ( list . get ( 1 ) ) ) ) ; } pr . flush ( ) ; } public static boolean isPrime ( long x ) { if ( x <= 3 ) { return x > 1 ; } for ( long i = 2 ; i * i <= x ; i ++ ) { if ( x % i == 0 ) { return false ; } } return true ; } static class input { static BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; static StreamTokenizer in = new StreamTokenizer ( br ) ; static String next ( ) throws IOException { return br . readLine ( ) ; } static int nextInt ( ) throws IOException { in . nextToken ( ) ; return ( int ) in . nval ; } static long nextLong ( ) throws IOException { in . nextToken ( ) ; return ( long ) in . nval ; } static double nextDouble ( ) throws IOException { in . nextToken ( ) ; return in . nval ; } } }


import java . util . Arrays ; import java . util . Scanner ;   public class Main {    public static void main ( String [ ] args ) {   long n ; Scanner in = new Scanner ( System . in ) ; n = in . nextLong ( ) ; int num = 0 ; long [ ] ns = new long [ 50 ] ; long temp = n ; for ( long i = 2 ; i * i <= n ; i ++ ) { if ( n % i == 0 ) { while ( n % i == 0 ) { ns [ num ] = i ; num ++ ; n /= i ; } if ( num >= 2 ) break ; } } if ( n != temp && n != 1 ) ns [ num ++ ] = n ; if ( num != 2 ) { System . out . println ( 1 ) ; System . out . println ( ns [ 1 ] * ns [ 0 ] ) ; } else System . out . println ( 2 ) ;   }     }


import java . io . * ; import java . util . * ; public class p741a { static class Pair { public int a , b ; public Pair ( int a , int b ) { this . a = a ; this . b = b ; } } public static long hcf ( long a , long b ) { if ( a == 0 || b == 0 ) return a + b ; return hcf ( b , a % b ) ; } public static long lcm ( long a , long b ) { return ( a * b ) / hcf ( a , b ) ; } public static void main ( String [ ] args ) throws IOException { InputReader in = new InputReader ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; int n = in . nextInt ( ) ; int arr [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) arr [ i ] = in . nextInt ( ) - 1 ; long rep [ ] = new long [ n ] ; Arrays . fill ( rep , - 1 ) ; long lc = 1 ; for ( int i = 0 ; i < n ; i ++ ) { int v = i ; for ( int j = 0 ; j < n ; j ++ ) { v = arr [ v ] ; if ( v == i ) { long val = ( ( j + 1 ) % 2 != 0 ) ? ( j + 1 ) : ( j + 1 ) / ( int ) 2 ;

def gcd ( a , b ) : if b == 0 : return a return gcd ( b , a % b ) def lcm ( a , b ) : return a * b / gcd ( a , b ) def dfs ( sad , num , posjeceno ) : """ if ▁ sad = = a [ sad ] -1 ▁ and ▁ posjeceno ! = [ 0 ] * n : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ return ▁ ( -10 , ▁ [ ] ) """ posjeceno [ sad ] = 1 if posjeceno [ a [ sad ] - 1 ] == 1 : return ( num + 1 , posjeceno ) return dfs ( a [ sad ] - 1 , num + 1 , posjeceno )   def trazi ( oznaka ) : global memo if memo [ oznaka ] == [ ] : memo [ oznaka ] = dfs ( oznaka , 0 , [ 0 ] * n ) return memo [ oznaka ] n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) d = set ( ) brojac = nmemo = [ [ ] for e in range ( n ) ] while brojac > - 1 : brojac -= 1 if memo [ brojac ] == [ ] : trazi ( brojac ) """ if ▁ memo [ brojac ] [0 ] = = - 10 : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ d = - 10 ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ break """ l = memo [ brojac ] [ 1 ] for w in range ( n ) : if l [ w ] == 1 : if trazi ( w ) [ 1 ] != l : d = - 10 break if d == - 10 : break vrati , l = trazi ( brojac ) if vrati % 2 == 0 : d . add ( float ( vrati / 2 ) ) else : d . add ( float ( vrati ) ) if d == - 10 : print ( - 1 ) else : sol = 1 for r in d : sol = lcm ( sol , r ) print ( int ( sol ) ) NEW_LINE


from math import gcddef lcm ( a , b ) : return a * b // gcd ( a , b ) n = int ( input ( ) ) A = [ 0 ] + list ( map ( int , input ( ) . split ( ) ) ) g = { } for i in range ( 1 , n + 1 ) : g [ A [ i ] ] = iif len ( g ) != n : print ( - 1 ) else : clc = 1 for i in g : x = g [ i ] cnt = 1 while x != i : x = g [ x ] cnt += 1 if cnt % 2 == 0 : cnt //= 2 clc = lcm ( clc , cnt ) print ( clc ) NEW_LINE


from math import gcdn = int ( input ( ) ) arr = map ( int , input ( ) . split ( ) ) arr = list ( map ( lambda x : x - 1 , arr ) )   res = 1 for i in range ( n ) : p , k = 0 , i for j in range ( n ) : k = arr [ k ] if k == i : p = j break if k != i : print ( - 1 ) exit ( ) p += 1 if p % 2 == 0 : p //= 2 res = res * p // gcd ( res , p ) print ( res ) NEW_LINE


def read_int ( ) : return int ( input ( ) )     def read_ints ( ) : return map ( int , input ( ) . split ( ' ▁ ' ) )     def gcd ( x , y ) : return x if y == 0 else gcd ( y , x % y )     n = read_int ( ) a = list ( read_ints ( ) ) vis = [ False for i in range ( n ) ] loop = 0 ok = Truefor i in range ( n ) : if vis [ i ] : continue current = i length = 0 while not vis [ current ] : vis [ current ] = True current = a [ current ] - 1 length += 1 if current != i : ok = False print ( - 1 ) break if length % 2 == 0 : length //= 2 if loop == 0 : loop = length else : loop = loop * length // gcd ( loop , length ) if ok : print ( loop ) NEW_LINE


from math import gcdn = int ( input ( ) ) arr = map ( int , input ( ) . split ( ) ) arr = list ( map ( lambda x : x - 1 , arr ) )   res = 1f or i in range ( n ) : p , k = 0 , i for j in range ( n ) : k = arr [ k ] if k == i : p = j break if k != i : print ( - 1 ) exit ( ) p += 1 if p % 2 == 0 : p


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 . Scanner ;   public class Main { public static void main ( String [ ] args ) { try ( Scanner input = new Scanner ( System . in ) ) { String [ ] pointA = input . nextLine ( ) . split ( " ▁ " ) ; String [ ] pointB = input . nextLine ( ) . split ( " ▁ " ) ; String [ ] pointC = input . nextLine ( ) . split ( " ▁ " ) ; discoverWay ( pointA , pointB , pointC ) ; } }   private static void discoverWay ( String [ ] pointA , String [ ] pointB , String [ ] pointC ) { long xa = Long . parseLong ( pointA [ 0 ] ) ; long ya = Long . parseLong ( pointA [ 1 ] ) ; long xb = Long . parseLong ( pointB [ 0 ] ) ; long yb = Long . parseLong ( pointB [ 1 ] ) ; long xc = Long . parseLong ( pointC [ 0 ] ) ; long yc = Long . parseLong ( pointC [ 1 ] ) ; long [ ] BA = { ( long ) ( xa - xb ) , ( long ) ( ya - yb ) } ; long [ ] BC = { ( long ) ( xc - xb ) , ( long ) ( yc - yb ) } ; long BAx = BA [ 0 ] ; long BAy = BA [ 1 ] ;   long BCx = BC [ 0 ] ; long BCy = BC [ 1 ] ; long direction = ( long ) ( BAx * BCy ) - ( long ) ( BCx * BAy ) ;

import sysinput = sys . stdin . readlinel = input ( ) . split ( ) xa = int ( l [ 0 ] ) ya = int ( l [ 1 ] ) l = input ( ) . split ( ) xb = int ( l [ 0 ] ) yb = int ( l [ 1 ] ) l = input ( ) . split ( ) xc = int ( l [ 0 ] ) yc = int ( l [ 1 ] ) num1 = ( xb - xa ) * ( xc - xb ) + ( yb - ya ) * ( yc - yb ) if ( num1 != 0 ) : print ( " TOWARDS " ) quit ( ) num1 = ( yc - yb ) num2 = xb - xaif ( num1 != 0 ) : if ( num1 * num2 > 0 ) : print ( ' LEFT ' ) else : print ( " RIGHT " ) else : num1 = ( xc - xb ) num2 = yb - ya if ( num1 != 0 ) : if ( num1 * num2 < 0 ) : print ( ' LEFT ' ) else : print ( " RIGHT " ) NEW_LINE


import math   a = list ( map ( int , input ( ) . split ( ) ) ) b = list ( map ( int , input ( ) . split ( ) ) ) c = list ( map ( int , input ( ) . split ( ) ) )   xab = b [ 0 ] - a [ 0 ] NEW_LINE


a = list ( map ( int , input ( ) . split ( ) ) ) b = list ( map ( int , input ( ) . split ( ) ) ) c = list ( map ( int , input ( ) . split ( ) ) ) position = ( ( b [ 0 ] - a [ 0 ] ) * ( c [ 1 ] - a [ 1 ] ) - ( b [ 1 ] - a [ 1 ] ) * ( c [ 0 ] - a [ 0 ] ) ) if position < 0 : print ( " RIGHT " ) elif position == 0 : print ( " TOWARDS " ) else : print ( " LEFT " ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . StringTokenizer ;   public class WhereDoITurn {


import java . util . * ;   public class WhereDoITurn {   public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; Vec a = new Vec ( scan . nextLong ( ) , scan . nextLong ( ) ) ; Vec b = new Vec ( scan . nextLong ( ) , scan . nextLong ( ) ) ; Vec c = new Vec ( scan . nextLong ( ) , scan . nextLong ( ) ) ; Vec ab = b . sub ( a ) ; Vec bc = c . sub ( b ) ; long cp = ab . cprod ( bc ) ; if ( cp == 0 ) System . out . println ( " TOWARDS " ) ; else if ( cp > 0 ) System . out . println ( " LEFT " ) ; else System . out . println ( " RIGHT " ) ; } static class Vec { long x ; long y ; public Vec ( long x , long y ) { this . x = x ; this . y = y ; } public Vec sub ( Vec v ) { return new Vec ( x - v . x , y - v . y ) ; } public long cprod ( Vec v ) { return x * v . y - y * v . x ; } }   }


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a , b , c , d , e , f , g ; a = sc . nextInt ( ) ; Vector < Integer > x = new Vector < Integer > ( ) ; g = 0 ; e = 0 ; f = 0 ; d = 0 ; for ( b = 0 ; b < a ; b ++ ) { c = sc . nextInt ( ) ; if ( c == 0 ) { x . add ( c ) ; } if ( c == 100 ) { x . add ( c ) ; } if ( c >= 1 && c <= 9 ) { if ( d == 0 ) { d ++ ; x . add ( c ) ; } } if ( c >= 10 && c <= 99 ) { if ( c % 10 == 0 ) { if ( e == 0 ) { e ++ ; x . add ( c ) ; } } else { if ( d == 0 && f == 0 && e == 0 ) { f ++ ; x . add ( c ) ; g = x . size ( ) ; } } } } if ( e >= 1 && f >= 1 ) { x . remove ( g - 1 ) ; f -- ; } else if ( d >= 1 && f >= 1 ) { x . remove ( g - 1 ) ; } System . out . println ( x . size ( ) ) ; for ( b = 0 ; b < x . size ( ) ; b ++ ) { System . out . print ( x . get ( b ) + " ▁ " ) ; } System . out . println ( ) ; } }

n = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) t = [ ] flag = 0 if ( 0 in arr ) : t . append ( 0 ) if ( 100 in arr ) : t . append ( 100 ) for i in range ( n ) : if ( arr [ i ] > 0 and arr [ i ] < 10 ) : t . append ( arr [ i ] ) flag = 1 breakfor i in range ( n ) : if ( arr [ i ] % 10 == 0 and arr [ i ] > 0 and arr [ i ] < 100 ) : t . append ( arr [ i ] ) flag = 1 breakif ( flag == 0 ) : for i in range ( n ) : if ( arr [ i ] > 10 and arr [ i ] < 100 ) : t . append ( arr [ i ] ) breakprint ( len ( t ) ) for i in range ( len ( t ) ) : print ( t [ i ] , end = " ▁ " ) NEW_LINE


k = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) r = 0 e = 0 l . sort ( ) q0 = 0 q1 = 0 q11 = 0 q10 = 0 q100 = 0 r1 = [ ] for i in range ( k ) : if ( l [ i ] == 0 ) : q0 = q0 + 1 elif ( l [ i ] > 0 and l [ i ] < 10 ) : q1 = q1 + 1 elif ( l [ i ] == 100 ) : q100 = q100 + 1 elif ( l [ i ] % 10 == 0 ) : q10 = q10 + 1 elif ( l [ i ] > 10 and l [ i ] % 10 != 0 ) : q11 = q11 + 1 if ( q0 > 0 ) : r1 . append ( 0 ) r = r + 1 if ( q100 > 0 ) : r1 . append ( 100 ) r = r + 1 temp = rif ( q10 > 0 ) : for i in range ( k ) : if ( l [ i ] > 9 and l [ i ] < 100 and l [ i ] % 10 == 0 ) : r = r + 1 e = 1 r1 . append ( l [ i ] ) breaktemp1 = rif ( q1 > 0 ) : for i in range ( k ) : if ( l [ i ] > 0 and l [ i ] < 10 ) : r = r + 1 r1 . append ( l [ i ] ) breakif ( r == 0 or ( temp1 == r and q11 > 0 and ( q0 > 0 or q100 > 0 ) and e == 0 ) ) : for i in range ( k ) : if ( l [ i ] > 10 and l [ i ] % 10 != 0 ) : r = r + 1 r1 . append ( l [ i ] ) breakprint ( r ) for i in range ( r ) : print ( r1 [ i ] , end = " ▁ " ) NEW_LINE


from collections import defaultdictn = int ( input ( ) ) arr = [ int ( x ) for x in input ( ) . split ( ) ] ans = [ ] d = defaultdict ( bool ) for i in arr : if ( i == 0 ) : ans . append ( i ) elif ( i % 100 == 0 and not d [ 100 ] ) : d [ 100 ] = True ans . append ( i ) elif ( i % 10 == 0 and not d [ 10 ] ) : d [ 10 ] = True ans . append ( i ) if ( d [ 10 ] ) : for i in arr : if ( '0' not in str ( i ) and len ( str ( i ) ) == 1 ) : ans . append ( i ) breakelse : for i in arr : if ( '0' not in str ( i ) ) : ans . append ( i ) breakprint ( len ( ans ) ) print ( * ans )   NEW_LINE


k = int ( input ( ) )   zlist2 = [ int ( d ) for d in input ( ) . split ( ) ] zlist2 . sort ( )   if k == 1 : print ( k ) print ( str ( zlist2 [ 0 ] ) ) exit ( )   res = [ ]   dicti = { } dicti [ 0 ] = Falsedicti [ 100 ] = Truedicti [ '0-10' ] = Falsedicti [ '10-100' ] = False   cnt = 0 for x in zlist2 : if x == 0 : res . append ( '0' ) elif x == 100 : res . append ( '100' ) if 0 < x < 10 and dicti [ '0-10' ] == False : cnt += 1 res . append ( str ( x ) ) dicti [ '0-10' ] = True if 9 < x < 100 and dicti [ '10-100' ] == False and x % 10 == 0 : cnt += 1 res . append ( str ( x ) ) dicti [ '10-100' ] = True   if cnt == 0 : for y in zlist2 : if 9 < y < 100 and y % 10 != 0 : res . append ( str ( y ) ) breakprint ( len ( res ) ) print ( ' ▁ ' . join ( res ) )   NEW_LINE