import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . OutputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ;   public class Row { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; Task solver = new Task ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }   static class Task { public void solve ( int testNumber , InputReader in , PrintWriter out ) { int n = in . nextInt ( ) ; String s = "0" + in . next ( ) + "0" ; if ( s . indexOf ( "000" ) != - 1 || s . indexOf ( "11" ) != - 1 ) { out . println ( " No " ) ; } else { out . println ( " Yes " ) ; } } }   static class InputReader { public BufferedReader reader ; public StringTokenizer tokenizer ;   public InputReader ( InputStream stream ) { reader = new BufferedReader ( new InputStreamReader ( stream ) , 32768 ) ; tokenizer = null ; }   public String next ( ) { while ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( ) ; }   public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   } }


n = int ( input ( ) ) s = input ( ) if ( n == 1 ) : if ( s == "0" ) : print ( " No " ) else : print ( " Yes " ) exit ( 0 ) if ( "11" in s ) or ( "000" in s ) or ( s [ - 2 : ] == "00" ) or ( s [ : 2 ] == "00" ) : print ( " No " ) else : print ( " Yes " ) NEW_LINE


n = int ( input ( ) ) s = str ( input ( ) ) ans = ' YES ' count = 1 for i in range ( n ) : if int ( s [ i ] ) == 0 : count += 1 elif int ( s [ i ] ) == 1 and count > 0 : count = 0 else : ans = " NO " break if count > 2 : ans = " NO " breakif len ( s ) == 1 and int ( s [ 0 ] ) == 0 : ans = ' NO ' if count >= 2 : ans = ' NO ' print ( ans ) NEW_LINE


n = int ( input ( ) ) s = input ( ) a = '0' + s + '0' if '000' in a or '11' in a : print ( " NO " ) else : print ( " YES " ) NEW_LINE


import java . io . * ; import java . util . * ; import javax . print . attribute . standard . Finishings ;   import java . math . * ;   public class SnackTower { static final Random random = new Random ( ) ; static PrintWriter out = new PrintWriter ( ( System . out ) ) ; static Reader sc = new Reader ( ) ;   public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ;   int n = sc . nextInt ( ) ;   int c1 = 0 ; int c0 = 0 ; String s = sc . next ( ) ; boolean f = false ; if ( s . contains ( "11" ) || s . contains ( "000" ) ) { System . out . println ( " NO " ) ; f = true ; }   else { for ( int i = 0 ; i < s . length ( ) ; i ++ )   if ( s . charAt ( i ) == '1' ) c1 ++ ; if ( c1 < ( int ) Math . ceil ( ( double ) n / 3.00 ) ) { System . out . println ( " No " ) ; } else { if ( ( s . charAt ( n - 1 ) == '0' && s . charAt ( n - 2 ) == '0' ) || ( s . charAt ( 0 ) == '0' && s . charAt ( 1 ) == '0' ) ) System . out . println ( " No " ) ; else System . out . println ( " Yes " ) ; }   }

n = int ( input ( ) ) s = str ( input ( ) ) s = '0' + s + '0' if ( '11' in s ) or ( '000' in s ) : print ( " No " ) else : print ( " Yes " ) NEW_LINE


import java . util . * ; import java . math . * ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;

input ( ) print ( len ( set ( input ( ) . split ( ) ) - { '0' } ) ) NEW_LINE


n = int ( input ( ) ) a = [ * map ( int , input ( ) . split ( ) ) ] d = { } for i in a : if i != 0 : if d . get ( i ) == None : d [ i ] = 1 else : d [ i ] += 1 print ( len ( d ) ) NEW_LINE


n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) d = { } for i in l : if ( i in d ) : d [ i ] += 1 else : d [ i ] = 1 if ( l . count ( 0 ) >= 1 ) : print ( len ( d ) - 1 ) else : print ( len ( d ) ) NEW_LINE


n = input ( ) l = list ( map ( int , input ( ) . split ( ) ) ) d = { } for i in l : if ( i != 0 ) : if ( i in d ) : d [ i ] += 1 else : d [ i ] = 1 print ( len ( d ) ) NEW_LINE


i = int ( input ( ) ) s = list ( input ( ) . split ( ) ) l = { } c = 0 for j in range ( i ) : if int ( s [ j ] ) != 0 : if int ( s [ j ] ) not in l . keys ( ) : l [ int ( s [ j ] ) ] = 1 c += 1 else : l [ int ( s [ j ] ) ] += 1 print ( c ) NEW_LINE


import java . io . FileInputStream ; import java . io . FileNotFoundException ; import java . io . IOException ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . Collection ; import java . util . List ; import java . util . Scanner ; import java . util . TreeSet ; import java . util . function . Function ; import java . util . stream . Collectors ; public class _p000992A { static public void main ( final String [ ] args ) throws IOException { p000992A . _main ( args ) ; }


import java . util . * ; import java . math . * ; import java . io . * ; import java . lang . * ; 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 ; } int [ ] nextIntArray ( int n ) { int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = Integer . parseInt ( next ( ) ) ; } return a ; } } private static long startTime = System . currentTimeMillis ( ) ; public static void main ( String [ ] args ) { FastReader sc = new FastReader ( ) ; int n = sc . nextInt ( ) ; int a [ ] = sc . nextIntArray ( n ) ; HashSet < Integer > hs = new HashSet < > ( ) ; for ( int i : a ) { hs . add ( 0 - i ) ; } System . out . println ( hs . contains ( 0 ) ? hs . size ( ) - 1 : hs . size ( ) ) ; } }


import java . util . HashSet ; import java . util . Scanner ;   public class NastyaandanArray {   public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int c = 0 ; HashSet < Integer > a = new HashSet < Integer > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { int in = scan . nextInt ( ) ; a . add ( in ) ; if ( in == 0 ) { ++ c ; } } int res = a . size ( ) ; if ( c != 0 ) { -- res ; } System . out . println ( res ) ; }   }


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

n , k = 0 , int ( input ( ) ) p = [ [ '0' ] * 100 for i in range ( 100 ) ] while k : for i in range ( n ) : if i > k : break p [ n ] [ i ] = p [ i ] [ n ] = '1' k = k - i n += 1 print ( n ) for i in range ( n ) : print ( ' ' . join ( p [ i ] [ : n ] ) ) NEW_LINE


k = int ( input ( ) ) p = [ [ '0' ] * 100 for j in range ( 100 ) ] i , n = 0 , 0   g = lambda n : n * ( n * n - 1 ) // 6 while g ( n + 1 ) <= k : n += 1 while i < n + 1 : for j in range ( i ) : p [ i ] [ j ] = p [ j ] [ i ] = '1' i += 1 k -= g ( n )   g = lambda n : n * ( n - 1 ) // 2 while k : n = 0 while g ( n + 1 ) <= k : n += 1 for j in range ( n ) : p [ i ] [ j ] = p [ j ] [ i ] = '1' k -= g ( n ) i += 1 print ( i ) for j in range ( i ) : print ( ' ' . join ( p [ j ] [ : i ] ) ) NEW_LINE


import java . util . Arrays ; import java . util . Scanner ;   public class comp2 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int k = in . nextInt ( ) ; int num = 2 ; int ans [ ] [ ] = new int [ 100 ] [ 100 ] ; int i = 0 ;   while ( k > 0 ) { if ( k < i ) { i = 0 ;   num ++ ; } ans [ num - 1 ] [ i ] = 1 ; ans [ i ] [ num - 1 ] = 1 ; k -= i ; i ++ ; if ( i >= num - 1 && k > 0 ) { i = 0 ; num ++ ; }   } System . out . println ( num ) ; for ( int j = 0 ; j < num ; j ++ ) { for ( int m = 0 ; m < num ; m ++ ) { System . out . print ( ans [ j ] [ m ] ) ; } System . out . println ( " " ) ;   } } }


import java . io . File ; import java . io . FileInputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintStream ; import java . io . BufferedOutputStream ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . InputMismatchException ;   public class Main {   public static void main ( String [ ] args ) { if ( args . length > 0 && args [ 0 ] . toLowerCase ( ) . equals ( " local " ) ) { try { System . setIn ( new FileInputStream ( " input . txt " ) ) ; System . setOut ( new PrintStream ( new File ( " output . txt " ) ) ) ; } catch ( IOException exc ) { } } Task task = new Task ( ) ; task . solve ( ) ; }   public static class Task { static final long MOD = ( long ) 1e9 + 7 ; static final PrintWriter out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ; int [ ] [ ] grid ; int res = 0 ;   public void solve ( ) { try { Scan sc = new Scan ( ) ; grid = new int [ 5 ] [ 5 ] ; for ( int i = 0 ; i < 5 ; ++ i ) { for ( int j = 0 ; j < 5 ; ++ j ) { grid [ i ] [ j ] = ( int ) sc . scanLong ( ) ; } } perm ( new int [ ] { 0 , 1 , 2 , 3 , 4 } , 5 ) ; out . println ( res ) ; } finally { out . close ( ) ; } }   private void perm ( int [ ] arr , int end ) { if ( end == 1 ) {

lista = [ ] for i in range ( 5 ) : lista . append ( input ( ) . split ( ) )   sums = [ ] for i in range ( 0 , 5 ) : for j in range ( 0 , 5 ) : for k in range ( 0 , 5 ) : for l in range ( 0 , 5 ) : for m in range ( 0 , 5 ) : a = int ( lista [ i ] [ j ] ) + int ( lista [ j ] [ i ] ) b = int ( lista [ k ] [ l ] ) + int ( lista [ l ] [ k ] ) c = int ( lista [ j ] [ k ] ) + int ( lista [ k ] [ j ] ) d = int ( lista [ l ] [ m ] ) + int ( lista [ m ] [ l ] ) s = a + 2 * b + c + 2 * d lx = [ i , j , k , l , m ] if not any ( lx . count ( x ) > 1 for x in lx ) : sums . append ( s ) print ( max ( sums ) )   NEW_LINE


import itertoolshappy = [ ] mhappy = 0 p = [ list ( i ) for i in itertools . permutations ( [ 0 , 1 , 2 , 3 , 4 ] ) ] for i in range ( 5 ) : happy . append ( [ int ( a ) for a in input ( ) . split ( ) ] ) for i in range ( len ( p ) ) : aux = ( happy [ p [ i ] [ 0 ] ] [ p [ i ] [ 1 ] ] + happy [ p [ i ] [ 1 ] ] [ p [ i ] [ 0 ] ] + 2 * happy [ p [ i ] [ 2 ] ] [ p [ i ] [ 3 ] ] + 2 * happy [ p [ i ] [ 3 ] ] [ p [ i ] [ 2 ] ] ) + ( happy [ p [ i ] [ 1 ] ] [ p [ i ] [ 2 ] ] + happy [ p [ i ] [ 2 ] ] [ p [ i ] [ 1 ] ] + 2 * happy [ p [ i ] [ 3 ] ] [ p [ i ] [ 4 ] ] + 2 * happy [ p [ i ] [ 4 ] ] [ p [ i ] [ 3 ] ] ) mhappy = max ( mhappy , aux ) print ( mhappy )   NEW_LINE


possibilidades = [ ] for i in range ( 5 ) : lista = [ ] for j in range ( 5 ) : if j == i : continue for k in range ( 5 ) : if k == j or k == i : continue for l in range ( 5 ) : if l == k or l == j or l == i : continue for m in range ( 5 ) : if m == l or m == k or m == j or m == i : continue lista . append ( i ) lista . append ( j ) lista . append ( k ) lista . append ( l ) lista . append ( m ) possibilidades . append ( lista ) lista = [ ]   matriz = [ ] linha = [ ] max = 0 num = 0 for i in range ( 5 ) : linha = input ( ) . split ( ) matriz . append ( linha ) for i in range ( len ( possibilidades ) ) : num = 0 num += int ( matriz [ possibilidades [ i ] [ 0 ] ] [ possibilidades [ i ] [ 1 ] ] ) num += int ( matriz [ possibilidades [ i ] [ 1 ] ] [ possibilidades [ i ] [ 0 ] ] ) num += int ( matriz [ possibilidades [ i ] [ 1 ] ] [ possibilidades [ i ] [ 2 ] ] ) num += int ( matriz [ possibilidades [ i ] [ 2 ] ] [ possibilidades [ i ] [ 1 ] ] ) num += 2 * int ( matriz [ possibilidades [ i ] [ 2 ] ] [ possibilidades [ i ] [ 3 ] ] ) num += 2 * int ( matriz [ possibilidades [ i ] [ 3 ] ] [ possibilidades [ i ] [ 2 ] ] ) num += 2 * int ( matriz [ possibilidades [ i ] [ 3 ] ] [ possibilidades [ i ] [ 4 ] ] ) num += 2 * int ( matriz [ possibilidades [ i ] [ 4 ] ] [ possibilidades [ i ] [ 3 ] ] ) if num > max : max = numprint ( max ) NEW_LINE


import itertoolspermutations = [ ]   for x in itertools . permutations ( [ 0 , 1 , 2 , 3 , 4 ] ) : permutations . append ( x )   matrix = [ ] for i in range ( 5 ) : matrix . append ( [ int ( val ) for val in input ( ) . split ( ) ] )   bigger = 0 for p in permutations : a = p [ 0 ] b = p [ 1 ] c = p [ 2 ] d = p [ 3 ] e = p [ 4 ] flag = ( matrix [ a ] [ b ] + matrix [ b ] [ a ] ) + ( matrix [ c ] [ d ] + matrix [ d ] [ c ] ) + ( matrix [ b ] [ c ] + matrix [ c ] [ b ] ) + ( matrix [ d ] [ e ] + matrix [ e ] [ d ] ) + ( matrix [ c ] [ d ] + matrix [ d ] [ c ] ) + ( matrix [ d ] [ e ] + matrix [ e ] [ d ] ) if ( flag > bigger ) : bigger = flagprint ( bigger ) NEW_LINE


from itertools import permutations     def main ( ) :   m = [ ] for i in range ( 5 ) : row = [ int ( j ) for j in input ( ) . split ( ) ] m . append ( row )   p = permutations ( range ( 5 ) )   max = 0 for j in list ( p ) :     acum = 0 acum += m [ j [ 0 ] ] [ j [ 1 ] ] + m [ j [ 2 ] ] [ j [ 3 ] ] + m [ j [ 1 ] ] [ j [ 0 ] ] + m [ j [ 3 ] ] [ j [ 2 ] ] acum += m [ j [ 1 ] ] [ j [ 2 ] ] + m [ j [ 3 ] ] [ j [ 4 ] ] + m [ j [ 2 ] ] [ j [ 1 ] ] + m [ j [ 4 ] ] [ j [ 3 ] ] acum += m [ j [ 2 ] ] [ j [ 3 ] ] + m [ j [ 3 ] ] [ j [ 2 ] ] acum += m [ j [ 3 ] ] [ j [ 4 ] ] + m [ j [ 4 ] ] [ j [ 3 ] ]   if acum > max : max = acum   print ( max ) return   main ( ) NEW_LINE


import java . util . * ; public class Main { static int a [ ] [ ] = new int [ 5 ] [ 5 ] ; static int max = 0 ; public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; for ( int i = 0 ; i < 5 ; i ++ ) { for ( int j = 0 ; j < 5 ; j ++ ) { a [ i ] [ j ] = input . nextInt ( ) ; } } HashSet < String > set = new HashSet < > ( ) ; for ( int i = 0 ; i < 5 ; i ++ ) { for ( int j = 0 ; j < 5 ; j ++ ) { if ( j == i ) continue ; for ( int k = 0 ; k < 5 ; k ++ ) { if ( k == j || k == i ) continue ; for ( int l = 0 ; l < 5 ; l ++ ) { if ( l == i || l == j || l == k ) continue ; for ( int m = 0 ; m < 5 ; m ++ ) { if ( m == l || m == k || m == j || m == i ) continue ; String s = i + " " + j + " " + k + " " + l + " " + m ; set . add ( s ) ; } } } } }


import java . util . * ; public class Main { static int a [ ] [ ] = new int [ 5 ] [ 5 ] ; static int max = 0 ; public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; for ( int i = 0 ; i < 5 ; i ++ ) { for ( int j = 0 ; j < 5 ; j ++ ) { a [ i ] [ j ] = input . nextInt ( ) ; } } int num [ ] = new int [ ] { 0 , 1 , 2 , 3 , 4 } ; permutation ( 0 , num ) ; System . out . println ( max ) ; }   static void permutation ( int s , int [ ] num ) { if ( s == num . length ) { int sum = 0 ; for ( int i = 0 ; i < 4 ; i ++ ) { for ( int j = i ; j < 4 ; j += 2 ) { sum += a [ num [ j ] ] [ num [ j + 1 ] ] + a [ num [ j + 1 ] ] [ num [ j ] ] ; } } max = Math . max ( max , sum ) ; return ; } for ( int i = s ; i < num . length ; i ++ ) { swap ( num , s , i ) ; permutation ( s + 1 , num ) ; swap ( num , s , i ) ; } }   static void swap ( int [ ] num , int s , int i ) { int tmp = num [ s ] ; num [ s ] = num [ i ] ; num [ i ] = tmp ; } }


import java . util . * ; import java . io . * ; public class A { static FastReader in = new FastReader ( ) ; static final Random random = new Random ( ) ; static long mod = 1000000007L ;   public static void main ( String args [ ] ) throws IOException { int t = 1 ;


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


import java . util . Scanner ; public class codeforces813A { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int x = 0 , n = s . nextInt ( ) , i , m , ans = 0 ; boolean j = false ; for ( i = 0 ; i < n ; i ++ ) x = x + s . nextInt ( ) ; m = s . nextInt ( ) ; int [ ] c = new int [ m ] ; int [ ] b = new int [ m ] ; for ( i = 0 ; i < m ; i ++ ) { c [ i ] = s . nextInt ( ) ; b [ i ] = s . nextInt ( ) ; } for ( i = 0 ; i < m ; i ++ ) { if ( x >= c [ i ] && x <= b [ i ] ) { ans = x ; j = true ; break ; } else if ( x < c [ i ] ) { ans = c [ i ] ; j = true ; break ; } } if ( j == true ) System . out . print ( ans ) ; else System . out . print ( - 1 ) ; } }

def find ( x , y , n ) : for i in range ( x , y + 1 ) : if i >= n : return i return 0                   n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) m = int ( input ( ) ) f = Truefor i in range ( m ) : x , y = map ( int , input ( ) . split ( ) ) if find ( x , y , sum ( a ) ) != 0 and f : print ( find ( x , y , sum ( a ) ) ) f = Falseif f : print ( - 1 ) NEW_LINE


n = int ( input ( ) ) a = sum ( map ( int , input ( ) . split ( ) ) ) for _ in range ( int ( input ( ) ) ) : q , w = map ( int , input ( ) . split ( ) ) if a <= w : exit ( print ( max ( a , q ) ) ) print ( - 1 ) NEW_LINE


def main ( ) : n = int ( input ( ) ) a = [ int ( s ) for s in input ( ) . split ( ) ] m = int ( input ( ) ) if m == 0 : print ( - 1 ) return l , r = [ ] , [ ] for _ in range ( m ) : x , y = [ int ( s ) for s in input ( ) . split ( ) ] l . append ( x ) r . append ( y )   total_time = sum ( a ) period = 0 while period < m and total_time > r [ period ] : period += 1 if period < m : print ( max ( total_time , l [ period ] ) ) else : print ( - 1 )   main ( ) NEW_LINE


def solve ( ) : n = int ( input ( ) ) a = [ int ( s ) for s in input ( ) . split ( ' ▁ ' ) ] x = sum ( a ) m = int ( input ( ) ) u = [ tuple ( [ int ( x ) for x in input ( ) . split ( ' ▁ ' ) ] ) for i in range ( m ) ] for l , r in u : if r >= x : return max ( l , x ) return - 1     print ( solve ( ) ) NEW_LINE


a = 0 c = input ( ) for x in list ( map ( int , input ( ) . split ( ) ) ) : a += xb = [ ] for x in range ( int ( input ( ) ) ) : i , j = map ( int , input ( ) . split ( ) ) for y in range ( i , j + 1 ) : b . append ( y ) for x in b : if a == x or a < x : print ( x ) breakelse : print ( - 1 ) NEW_LINE


import java . util . Scanner ;   public class A813 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int N = in . nextInt ( ) ; int total = 0 ; for ( int n = 0 ; n < N ; n ++ ) { total += in . nextInt ( ) ; } int M = in . nextInt ( ) ; int answer = Integer . MAX_VALUE ; for ( int m = 0 ; m < M ; m ++ ) { int L = in . nextInt ( ) ; int R = in . nextInt ( ) ; if ( total <= R ) { answer = Math . min ( answer , Math . max ( L , total ) ) ; } } if ( answer == Integer . MAX_VALUE ) { answer = - 1 ; } System . out . println ( answer ) ; }   }


import java . util . Scanner ;   public class qH {   public static void main ( String args [ ] ) { Scanner s = new Scanner ( System . in ) ;   int n = s . nextInt ( ) ;   long total_time = 0 ;   for ( int i = 0 ; i < n ; i ++ ) { total_time += s . nextInt ( ) ; }   int m = s . nextInt ( ) ;   long slot = - 1 ; for ( int i = 0 ; i < m ; i ++ ) { int l = s . nextInt ( ) ; int r = s . nextInt ( ) ;   if ( slot == - 1 ) { if ( total_time <= l ) { slot = l ; } else if ( total_time >= l && total_time <= r ) { slot = total_time ; } } }   System . out . println ( slot ) ; } }


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


import java . util . * ; import java . io . * ;   public class Main { public static void main ( String [ ] args ) throws IOException { FastScanner in = new FastScanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; new Main ( ) . run ( in , out ) ; out . close ( ) ; }   public static long mod = 17352642619633L ;   int N ; int [ ] a ; void run ( FastScanner in , PrintWriter out ) { N = in . nextInt ( ) * 2 ; a = new int [ N ] ; for ( int i = 0 ; i < a . length ; i ++ ) a [ i ] = in . nextInt ( ) ; Arrays . sort ( a ) ;   int [ ] [ ] dp = new int [ N + 1 ] [ 3 ] ; for ( int [ ] d : dp ) Arrays . fill ( d , Integer . MAX_VALUE ) ; for ( int i = 0 ; i < 3 ; i ++ ) dp [ 0 ] [ i ] = 0 ;

n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) nat = Falsefor i in range ( 2 * n ) : for c in range ( i + 1 , 2 * n ) : ls = l [ : ] ls [ i ] = 0 ls [ c ] = 0 ls = sorted ( ls ) now = 0 for loc in range ( 1 , len ( ls ) , 2 ) : now += ls [ loc ] - ls [ loc - 1 ] if now < nat or str ( nat ) == ' False ' : nat = nowprint ( nat ) NEW_LINE


""" Pseudocode : Read ▁ NRead ▁ the ▁ input ( ) , ▁ store ▁ in ▁ a ▁ list : ▁ weightssort ▁ weightsinstability ; for ▁ i ▁ ( 0 , ▁ len ▁ weights ▁ - ▁ 2 , ▁ 2 ) : ▁ ▁ ▁ ▁ instability ▁ = ▁ difference ▁ between ▁ 2print ▁ instability """ N = input ( ) weights = list ( map ( int , input ( ) . split ( ) ) )   weights . sort ( )   minCount = - 1   for i in range ( 0 , len ( weights ) - 1 ) : for j in range ( i + 1 , len ( weights ) ) : count = 0 tempWeights = weights . copy ( ) del tempWeights [ i ] del tempWeights [ j - 1 ]   for k in range ( 0 , len ( tempWeights ) - 1 , 2 ) : count += tempWeights [ k + 1 ] - tempWeights [ k ] if minCount == - 1 or count < minCount : minCount = count   print ( minCount ) NEW_LINE


N = int ( input ( ) ) weight = list ( map ( int , input ( ) . split ( ) ) ) weight . sort ( )   mc = - 1   for i in range ( 0 , len ( weight ) - 1 ) :   for x in range ( i + 1 , len ( weight ) ) : count = 0 tl = weight . copy ( ) tl . pop ( i ) tl . pop ( x - 1 )   for k in range ( 0 , len ( tl ) - 1 , 2 ) : count += tl [ k + 1 ] - tl [ k ] if mc == - 1 : mc = count if count < mc : mc = countprint ( mc ) NEW_LINE


import mathn = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) a . sort ( ) x = [ ] ans = math . inffor t in range ( 2 * n ) : for k in range ( t , 2 * n ) : c = a [ : ] c = a [ : t ] + a [ t + 1 : k ] + a [ k + 1 : ] for i in range ( 0 , 2 * n - 2 , 2 ) : x . append ( c [ i + 1 ] - c [ i ] ) ans = min ( ans , sum ( x ) ) x = [ ] print ( ans ) NEW_LINE


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


import java . io . * ; import java . util . * ;   public class kayaking { public static void main ( String [ ] args ) throws IOException { BufferedReader f = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter out = new PrintWriter ( System . out ) ; StringTokenizer st = new StringTokenizer ( f . readLine ( ) ) ; int numKayaks = Integer . parseInt ( st . nextToken ( ) ) * 2 ; int [ ] diff = new int [ numKayaks ] ; st = new StringTokenizer ( f . readLine ( ) ) ; for ( int i = 0 ; i < numKayaks ; i ++ ) { diff [ i ] = Integer . parseInt ( st . nextToken ( ) ) ; } Arrays . sort ( diff ) ; int min = Integer . MAX_VALUE ; for ( int i = 0 ; i < numKayaks ; i ++ ) { for ( int j = i + 1 ; j < numKayaks ; j ++ ) { int sum = 0 ; int index = - 1 ; for ( int k = 0 ; k < numKayaks ; k ++ ) { if ( k == i || k == j ) { continue ; } else if ( index == - 1 ) { index = k ; } else { sum += diff [ k ] - diff [ index ] ; index = - 1 ; } } min = Math . min ( min , sum ) ; } } out . println ( min ) ; out . close ( ) ; } }


import java . util . * ; public class Solution { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; int d = s . nextInt ( ) ; int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = s . nextInt ( ) ; Set < Integer > h = new HashSet < > ( ) ; h . add ( a [ 0 ] - d ) ; h . add ( a [ n - 1 ] + d ) ; int k = 1 ; for ( int j = 0 ; j < n ; j ++ ) { int a1 = a [ j ] - d ; if ( j > 0 && Math . abs ( a1 - a [ j - 1 ] ) >= d ) { h . add ( a1 ) ; } int a2 = a [ j ] + d ; if ( j < n - 1 && Math . abs ( a [ j + 1 ] - a2 ) >= d ) { h . add ( a2 ) ; } } System . out . println ( h . size ( ) ) ; } }

m , n = map ( int , input ( ) . split ( ) ) s = [ int ( v ) for v in input ( ) . split ( ) ] count = 2 for i in range ( len ( s ) - 1 ) : val = ( abs ( s [ i ] - s [ i + 1 ] ) / ( n * 2 ) ) if val == 1 : count += 1 elif val > 1 : count += 2 else : count += 0 print ( count ) NEW_LINE


n , d = map ( int , ( input ( ) . split ( ) ) )   x = list ( map ( int , input ( ) . split ( ) ) )     count = 2   if n > 1 : for i in range ( 1 , n ) : temp = x [ i ] - x [ i - 1 ] if temp == ( 2 * d ) : count = count + 1 if temp > 2 * d : count = count + 2   print ( count ) NEW_LINE


n , d = list ( map ( int , input ( ) . split ( ) ) ) s = list ( map ( int , input ( ) . split ( ) ) ) t = 2 for i in range ( n - 1 ) : if s [ i + 1 ] - s [ i ] == 2 * d : t += 1 if s [ i + 1 ] - s [ i ] > 2 * d : t += 2 print ( t ) NEW_LINE


n , d = map ( int , input ( ) . split ( ) ) cor = list ( map ( int , input ( ) . split ( ) ) ) count = 2 for i in range ( 1 , len ( cor ) ) : if abs ( cor [ i ] - cor [ i - 1 ] ) > 2 * d : count += 2 elif abs ( cor [ i ] - cor [ i - 1 ] ) == 2 * d : count += 1 else : continue   print ( count ) NEW_LINE


n , d = map ( int , input ( ) . split ( ) ) li = list ( map ( int , input ( ) . split ( ) ) ) c = 2 for i in range ( 1 , n ) : if ( li [ i ] - li [ i - 1 ] ) == 2 * d : c = c + 1 if ( li [ i ] - li [ i - 1 ] ) > 2 * d : c = c + 2 print ( c ) NEW_LINE


import java . util . Scanner ;   public class SonyaHotels { public static void main ( String [ ] args ) {   Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) , d = in . nextInt ( ) , i , a [ ] = new int [ n ] , c = 0 , l = - 1 ; for ( i = 0 ; i < n ; i ++ ) a [ i ] = in . nextInt ( ) ; in . close ( ) ;   for ( i = 0 ; i < n ; i ++ ) { if ( i == 0 || ( i > 0 && a [ i ] - d >= a [ i - 1 ] + d && a [ i ] - d != l ) ) { c ++ ; l = a [ i ] - d ; } if ( i == n - 1 || ( i < n - 1 && a [ i ] + d <= a [ i + 1 ] - d && a [ i ] + d != l ) ) { c ++ ; l = a [ i ] + d ; } } System . out . println ( c ) ; } }


import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner keyboard = new Scanner ( System . in ) ;   int n , min ; n = keyboard . nextInt ( ) ; min = keyboard . nextInt ( ) ; int [ ] hotel = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { hotel [ i ] = keyboard . nextInt ( ) ; }


import java . util . * ; import java . util . Arrays ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } int count = 2 ; for ( int i = 0 ; i < n - 1 ; i ++ ) { if ( ( a [ i + 1 ] - a [ i ] ) > ( 2 * d ) ) { count = count + 2 ; } else if ( a [ i + 1 ] - a [ i ] == 2 * d ) { count = count + 1 ; } else { continue ; } } System . out . println ( count ) ; } }


import javax . print . DocFlavor ; import javax . swing . * ; import java . awt . image . BandedSampleModel ; import java . util . * ;   public class Example { static long [ ] [ ] dp ;

k , n = map ( int , input ( ) . split ( ) ) r = lambda : list ( map ( int , input ( ) . split ( ) ) ) arr = r ( ) x = float ( ' inf ' )   for pos , i in enumerate ( arr ) : if ( k % i ) < x : x = k % i ans = pos       print ( ans + 1 , k // arr [ ans ] ) NEW_LINE


if __name__ == ' _ _ main _ _ ' : n , k = map ( int , input ( ) . split ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) min1 = 99999999999999999999999999 q = 1 for i in range ( k ) : if n % l [ i ] < min1 : min1 = n % l [ i ] q = i + 1 print ( q , n // l [ q - 1 ] ) NEW_LINE


n , k = [ int ( x ) for x in input ( ) . split ( ) ] capacities = [ int ( x ) for x in input ( ) . split ( ) ] mods = [ n % capacities [ i ] for i in range ( k ) ] min_mod = min ( mods ) index = mods . index ( min_mod ) print ( " { } ▁ { } " . format ( index + 1 , n // capacities [ index ] ) ) NEW_LINE


n , k = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) left = 10 ** 18 ans = 0 for i in range ( k ) : if n % a [ i ] < left : left = n % a [ i ] ans = iprint ( ans + 1 , n // a [ ans ] ) NEW_LINE


import java . util . * ;   public class Check2 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long n = sc . nextLong ( ) ; long k = sc . nextLong ( ) ; long [ ] ar = new long [ ( int ) k ] ; int ans = 0 ; long number = 0 ; long diff = Long . MAX_VALUE ;   for ( int i = 0 ; i < k ; i ++ ) { ar [ i ] = sc . nextLong ( ) ; long j1 = n / ar [ i ] ; long d1 = n % ar [ i ] ;


import java . util . * ; public class Solution { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; long n = s . nextLong ( ) ; int k = s . nextInt ( ) ; long a [ ] = new long [ k ] ; long ans = 0 , min = Long . MAX_VALUE ; int index = 0 ; for ( int i = 0 ; i < k ; i ++ ) a [ i ] = s . nextLong ( ) ; for ( int j = 0 ; j < k ; j ++ ) { if ( a [ j ] == n ) { ans = 1 ; break ; } else if ( a [ j ] < n ) { long o = n % a [ j ] ; if ( o < min ) { min = o ; ans = n / a [ j ] ; index = j ; } } } index ++ ; System . out . println ( index + " ▁ " + ans ) ; } }


import java . util . Scanner ;   public class B1451 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int T = in . nextInt ( ) ; for ( int t = 0 ; t < T ; t ++ ) { int N = in . nextInt ( ) ; int Q = in . nextInt ( ) ; char [ ] S = in . next ( ) . toCharArray ( ) ; for ( int q = 0 ; q < Q ; q ++ ) { int L = in . nextInt ( ) - 1 ; int R = in . nextInt ( ) - 1 ; boolean found = false ; for ( int i = 0 ; i < L ; i ++ ) { if ( S [ L ] == S [ i ] ) { found = true ; } } for ( int i = R + 1 ; i < N ; i ++ ) { if ( S [ R ] == S [ i ] ) { found = true ; } } System . out . println ( found ? " YES " : " NO " ) ; } } }   }

def solve ( s , l , r ) : lind , rind = s . find ( s [ l - 1 ] ) , s . rfind ( s [ r - 1 ] ) NEW_LINE if ( lind != - 1 and rind != - 1 ) : if NEW_LINE INDENT ( rind - lind >= len ( s [ l - 1 : r ] ) ) : NEW_LINE DEDENT return ( " YES " ) else : return ( " NO " ) else : return ( " NO " ) NEW_LINE for i in range ( int ( input ( ) ) ) : n , q = map ( int , input ( ) . split ( ) ) NEW_LINE s = input ( ) NEW_LINE for i in range ( q ) : l , r = map ( int , input ( ) . split ( ) ) NEW_LINE print ( solve ( s , l , r ) ) NEW_LINE


get = input     NEW_LINE def solve ( ) : l , q = list ( map ( int , get ( ) . split ( ) ) ) NEW_LINE string = get ( ) NEW_LINE check1 , check2 = False , False NEW_LINE for i in range ( q ) : a , b = list ( map ( int , get ( ) . split ( ) ) ) NEW_LINE if b - a + 1 == l : NEW_LINE INDENT print ( " NO " ) else : NEW_LINE for NEW_LINE DEDENT i in range ( 0 , a - 1 ) : NEW_LINE if string [ i ] == string [ a - 1 ] : print ( " YES " ) NEW_LINE check1 = True NEW_LINE break NEW_LINE if check1 == False : for NEW_LINE i in range ( b , l ) : NEW_LINE if string [ i ] == string [ b - 1 ] : print ( " YES " ) NEW_LINE check2 = True NEW_LINE break NEW_LINE if check1 == False and check2 == False : print ( " NO " )   check1 , check2 = False , False   for i in range ( int ( get ( ) ) ) : solve ( )         NEW_LINE


cases = int ( input ( ) ) NEW_LINE while cases : cases -= 1 NEW_LINE a , b = map ( int , input ( ) . split ( ) ) NEW_LINE s = input ( )   while b : b -= 1 NEW_LINE l , r = ( map ( int , input ( ) . split ( ) ) ) NEW_LINE l , r = l - 1 , r - 1   if s [ : l ] . count ( s [ l ] ) == s [ r + 1 : ] . count ( s [ r ] ) == 0 : NEW_LINE INDENT print ( " NO " ) else : NEW_LINE print ( " YES " ) NEW_LINE DEDENT


T = int ( input ( ) ) NEW_LINE for _ in range ( T ) : n , q = [ int ( x ) for x in input ( ) . split ( ) ] NEW_LINE s = input ( ) NEW_LINE for _ in range ( q ) : i , j = [ int ( x ) for x in input ( ) . split ( ) ] NEW_LINE sub = s [ i - 1 : j ] NEW_LINE k = 0 NEW_LINE while k < n and sub [ 0 ] != s [ k ] : k += 1 NEW_LINE l = n - 1 NEW_LINE while l >= 0 and sub [ - 1 ] != s [ l ] : l -= 1 NEW_LINE if k != i - 1 or l != j - 1 : NEW_LINE INDENT print ( " YES " ) else : NEW_LINE print ( " NO " )   NEW_LINE DEDENT


import java . util . * ; public class HelloWorld {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int n = sc . nextInt ( ) ; int q = sc . nextInt ( ) ; String s = sc . next ( ) ; while ( q -- > 0 ) { int l = sc . nextInt ( ) ; int r = sc . nextInt ( ) ; String st = s . substring ( l - 1 , r ) ; int c = l - 1 ; int lis = 0 , ini = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { char ch = s . charAt ( i ) ; if ( s . charAt ( c ) == ch ) { if ( c == l - 1 ) ini = i ; else lis = i ; if ( c != r - 1 ) c ++ ; } } if ( ini == l - 1 && lis == r - 1 ) System . out . println ( " NO " ) ; else System . out . println ( " YES " ) ; } } } }


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


import java . util . HashMap ; import java . util . Map ; import java . util . Scanner ; import java . util . Set ;   public class Problem1451B {   public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int t = s . nextInt ( ) ; while ( t -- > 0 ) { int n = s . nextInt ( ) ; int q = s . nextInt ( ) ; char arr [ ] = s . next ( ) . toCharArray ( ) ; while ( q -- > 0 ) { int l = s . nextInt ( ) ; int r = s . nextInt ( ) ; if ( ! checkLeft ( l , r , arr ) && ! checkRight ( l , r , arr , n ) ) { System . out . println ( " NO " ) ; continue ; } System . out . println ( " YES " ) ; } } }   private static boolean checkRight ( int l , int r , char [ ] arr , int n ) { char baseRightChar = arr [ r - 1 ] ; for ( int i = r ; i < n ; i ++ ) { if ( arr [ i ] == baseRightChar ) return true ; } return false ; }   private static boolean checkLeft ( int l , int r , char [ ] arr ) { char baseLeftChar = arr [ l - 1 ] ; for ( int i = 0 ; i < l - 1 ; i ++ ) { if ( arr [ i ] == baseLeftChar ) return true ; } return false ; }   }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ;


import java . io . * ; import java . util . StringTokenizer ;   public class C {   public static void main ( String [ ] args ) throws IOException {   Scanner sc = new Scanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ;   int a = sc . nextInt ( ) * 2 , b = sc . nextInt ( ) * 2 , x1 = sc . nextInt ( ) , y1 = sc . nextInt ( ) , x2 = sc . nextInt ( ) , y2 = sc . nextInt ( ) ; int d1 = Math . abs ( Math . floorDiv ( x1 - y1 , b ) - Math . floorDiv ( x2 - y2 , b ) ) ; int d2 = Math . abs ( Math . floorDiv ( x1 + y1 , a ) - Math . floorDiv ( x2 + y2 , a ) ) ; out . println ( Math . max ( d1 , d2 ) ) ; out . close ( ) ;   }    static class Scanner { StringTokenizer st ; BufferedReader br ;   public Scanner ( InputStream s ) { br = new BufferedReader ( new InputStreamReader ( s ) ) ; }   public String next ( ) throws IOException { while ( st == null || ! st . hasMoreTokens ( ) ) st = new StringTokenizer ( br . readLine ( ) ) ; return st . nextToken ( ) ; }   public int nextInt ( ) throws IOException { return Integer . parseInt ( next ( ) ) ; }   public long nextLong ( ) throws IOException { return Long . parseLong ( next ( ) ) ; }   public String nextLine ( ) throws IOException { return br . readLine ( ) ; }   public boolean ready ( ) throws IOException { return br . ready ( ) ; }    } }

a , b , x1 , y1 , x2 , y2 = map ( int , input ( ) . split ( ) ) X1 , Y1 = x1 + y1 , x1 - y1X2 , Y2 = x2 + y2 , x2 - y2A , B = 2 * a , 2 * b     def solve ( x , y , z ) : if x >= 0 > y or x < 0 <= y : x = max ( x , - x ) y = max ( y , - y ) tmp = x // z + y // z + 1 return tmp else : if x < y : x , y = y , x tmp = x // z - y // z return tmp     ans1 = solve ( X1 , X2 , A ) ans2 = solve ( Y1 , Y2 , B )   print ( max ( ans1 , ans2 ) ) NEW_LINE


a , b , x1 , y1 , x2 , y2 = map ( int , input ( ) . split ( ) ) X1 , Y1 = x1 + y1 , x1 - y1X2 , Y2 = x2 + y2 , x2 - y2A , B = 2 * a , 2 * b     def solve ( x , y , z ) : if x >= 0 > y or x < 0 <= y : x = max ( x , - x ) y = max ( y , - y ) tmp = x // z - ( x % z == 0 ) + y // z - ( y % z == 0 ) + 1 return tmp else : if x < y : x , y = y , x tmp = x // z - ( x % z == 0 ) - y // z - ( y % z == 0 ) return tmp     ans1 = solve ( X1 , X2 , A ) ans2 = solve ( Y1 , Y2 , B )   print ( max ( ans1 , ans2 ) ) NEW_LINE


import java . util . * ;    public class Practise {

ll = lambda : map ( int , input ( ) . split ( ) ) t = lambda : int ( input ( ) ) ss = lambda : input ( ) lx = lambda x : map ( int , input ( ) . split ( x ) ) NEW_LINE


t = int ( input ( ) ) for _ in range ( t ) : x , y = map ( int , input ( ) . split ( ) ) if x >= y : print ( ' YES ' ) else : if x == 2 and y == 3 or x >= 4 : print ( ' YES ' ) else : print ( ' NO ' ) NEW_LINE


t = int ( input ( ) ) for i in range ( t ) : s = input ( ) l = s . split ( ) x = int ( l [ 0 ] ) y = int ( l [ 1 ] ) if x >= 4 or x >= y or ( x == 2 and y == 3 ) : print ( ' YES ' ) else : print ( ' NO ' ) NEW_LINE


for _ in range ( int ( input ( ) ) ) : x , y = map ( int , input ( ) . split ( ) ) if x > 3 : print ( " YES " ) elif x == 1 : if y == 1 : print ( " YES " ) else : print ( " NO " ) else : if y <= 3 : print ( " YES " ) else : print ( " NO " ) NEW_LINE


import sysinput = sys . stdin . readline   for test in range ( int ( input ( ) ) ) : x , y = [ int ( i ) for i in input ( ) . split ( ) ] if x == 1 : print ( " YES " if y == 1 else " NO " ) elif x <= 3 : print ( " YES " if 1 <= y <= 3 else " NO " ) else : print ( " YES " ) NEW_LINE


import java . util . Scanner ;   public class _0643MagicSticks {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int cases = sc . nextInt ( ) ; while ( cases > 0 ) { int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; if ( x == 2 && y > 3 ) { System . out . println ( " NO " ) ; } else if ( x == 3 && y > 3 ) { System . out . println ( " NO " ) ; } else if ( x == 1 && y > 1 ) { System . out . println ( " NO " ) ; } else { System . out . println ( " YES " ) ; } cases -- ; } }   }


import java . util . * ;   public class Test { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int t = input . nextInt ( ) ;   while ( t -- > 0 ) {   int x = input . nextInt ( ) ; int y = input . nextInt ( ) ; boolean result = true ;   if ( ( x < 4 && y > 3 ) || ( x == 1 && y > x ) ) { result = false ; } System . out . println ( result ? " YES " : " NO " ) ; } } }


import java . util . Scanner ;   public class antonDigits {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k2 = sc . nextInt ( ) ; int k3 = sc . nextInt ( ) ; int k5 = sc . nextInt ( ) ; int k6 = sc . nextInt ( ) ;   int ans = 0 ; int temp = Math . min ( k2 , Math . min ( k5 , k6 ) ) ; k2 -= temp ; k5 -= temp ; k6 -= temp ; ans += temp * 256 ; temp = Math . min ( k3 , k2 ) ; ans += temp * 32 ; System . out . println ( ans ) ; }   }

a , b , c , d = map ( int , input ( ) . split ( ) ) k = min ( a , c , d ) a -= kt = min ( a , b ) print ( 256 * k + 32 * t ) NEW_LINE


k = list ( map ( int , input ( ) . split ( ) ) ) max_nums = ( min ( k [ 0 ] , k [ 2 ] , k [ 3 ] ) ) v = max_nums * 256 if k [ 0 ] - max_nums > k [ 1 ] : s = k [ 1 ] * 32 else : s = ( k [ 0 ] - max_nums ) * 32 print ( v + s ) NEW_LINE


import sysinput = sys . stdin . readline   '''   '''     k2 , k3 , k5 , k6 = map ( int , input ( ) . split ( ) ) num_256 = min ( k2 , min ( k5 , k6 ) ) k2 -= num_256num_32 = min ( k2 , k3 ) print ( num_256 * 256 + num_32 * 32 ) NEW_LINE


k2 , k3 , k5 , k6 = map ( int , input ( ) . split ( ) ) a = k2b = k3c = k5d = k6p = min ( a , c , d ) a -= pq = min ( a , b ) print ( ( p * 256 ) + ( q * 32 ) ) NEW_LINE


a = [ int ( x ) for x in input ( ) . split ( ) ] ans = 0 minimum = min ( a [ 0 ] , a [ 2 ] , a [ 3 ] ) ans += 256 * minimuma [ 0 ] -= minimuma [ 2 ] -= minimuma [ 3 ] -= minimumminimum = min ( a [ 0 ] , a [ 1 ] ) ans += 32 * minimumprint ( ans ) NEW_LINE


import java . util . * ; import java . io . * ; import java . lang . Math . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k2 = sc . nextInt ( ) ; int k3 = sc . nextInt ( ) ; int k5 = sc . nextInt ( ) ; int k6 = sc . nextInt ( ) ; int a = Math . min ( k2 , ( Math . min ( k5 , k6 ) ) ) ; k2 = k2 - a ; int b = Math . min ( k2 , k3 ) ; long val = 256 * a + 32 * b ; System . out . println ( val ) ; } }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class FindingBorders {   public static void main ( String [ ] args ) throws Exception {


import java . io . * ; import java . math . BigInteger ; import java . util . * ;   public class Train { static class InputReader { BufferedReader reader ; StringTokenizer tokenizer ;   public InputReader ( InputStream stream ) { reader = new BufferedReader ( new InputStreamReader ( stream ) , 32768 ) ; tokenizer = null ; }   String next ( ) { while ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ;   } }   return tokenizer . nextToken ( ) ; }   public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   public long nextLong ( ) { return Long . parseLong ( next ( ) ) ; }   public double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; }   }    static InputReader kb = new InputReader ( System . in ) ; static PrintWriter pw = new PrintWriter ( System . out ) ;   public static void main ( String [ ] args ) { int k2 = kb . nextInt ( ) ; int k3 = kb . nextInt ( ) ; int k5 = kb . nextInt ( ) ; int k6 = kb . nextInt ( ) ;   int n_5 = Math . min ( Math . min ( k2 , k5 ) , k6 ) ; int n_3 = Math . min ( k3 , k2 - n_5 ) ; System . out . println ( 256 * n_5 + n_3 * 32 ) ;   } }


import java . util . Scanner ;   public class AntonAndDigits { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ;   int n2 = scanner . nextInt ( ) ; int n3 = scanner . nextInt ( ) ; int n5 = scanner . nextInt ( ) ; int n6 = scanner . nextInt ( ) ;    int n256 = Math . min ( Math . min ( n2 , n5 ) , n6 ) ;   n2 -= n256 ; n5 -= n256 ; n6 -= n256 ;   int n32 = Math . min ( n2 , n3 ) ;   System . out . println ( 256 * n256 + 32 * n32 ) ; } }


# include < bits / stdc ++ . h >   const int MAXN = 1e5 + 5 ;   int m , q [ MAXN ] , n , a [ MAXN ] , f [ MAXN ] , exist [ MAXN ] , min = 0x7fffffff ; int sum [ MAXN ] ;   int main ( ) { scanf ( " % d " , & m ) ; for ( int i = 1 ; i <= m ; i ++ ) scanf ( " % d " , q + i ) , min = std :: min ( min , q [ i ] ) ; scanf ( " % d " , & n ) ; for ( int i = 1 ; i <= n ; i ++ ) scanf ( " % d " , a + i ) ; std :: sort ( a + 1 , a + n + 1 , [ ] ( int a , int b ) -> bool { return a > b ; } ) ; std :: sort ( q + 1 , q + m + 1 ) ; for ( int i = 1 ; i <= n ; i ++ ) sum [ i ] = sum [ i - 1 ] + a [ i ] ; f [ 0 ] = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { f [ i ] = f [ i - 1 ] + a [ i ] ; if ( i - min - 1 >= 0 ) f [ i ] = std :: min ( f [ i ] , f [ i - min - 1 ] - sum [ i - min - 1 ] + sum [ i - 1 ] ) ; if ( i - min - 2 >= 0 ) f [ i ] = std :: min ( f [ i ] , f [ i - min - 2 ] - sum [ i - min - 2 ] + sum [ i - 2 ] ) ; } printf ( " % d \n " , f [ n ] ) ; return 0 ; }

input ( ) I = lambda : map ( int , input ( ) . split ( ) ) q , n , a , r , k = min ( I ( ) ) , int ( input ( ) ) - 1 , sorted ( I ( ) ) , 0 , 0 while n > - 1 : r += a [ n ] k += 1 if k == q : n -= 3 ; k = 0 else : n -= 1 print ( r ) NEW_LINE


from sys import stdin , stdoutnmbr = lambda : int ( stdin . readline ( ) ) lst = lambda : list ( map ( int , stdin . readline ( ) . split ( ) ) ) for _ in range ( 1 ) : NEW_LINE


m = int ( input ( ) ) q = list ( map ( int , input ( ) . split ( ) ) ) c = min ( q ) n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) a . sort ( ) res = 0 for i in range ( n ) : if i % ( c + 2 ) < c : res += a [ n - 1 - i ] print ( res ) NEW_LINE


I = lambda : map ( int , input ( ) . split ( ) ) m , q , n , a , r , k = int ( input ( ) ) , min ( I ( ) ) , int ( input ( ) ) - 1 , sorted ( I ( ) ) , 0 , 0 while n > - 1 : r += a [ n ] k += 1 if k == q : n -= 3 ; k = 0 else : n -= 1 print ( r ) NEW_LINE


import java . util . * ; import java . lang . * ; import java . math . * ; import java . io . * ; import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ; import java . util . ArrayList ; import java . util . Collections ; import java . util . HashMap ; import java . util . Map ; import java . text . DecimalFormat ; import java . lang . Math ; import java . util . Iterator ; public class C47 { static class Pair implements Comparable < Pair > { int v ; int i ; public Pair ( int v , int i ) { this . v = v ; this . i = i ; } @ Override public int compareTo ( Pair o ) {


import java . io . BufferedReader ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . HashMap ; import java . util . StringTokenizer ; import java . util . TreeSet ; import java . io . InputStreamReader ; import java . io . IOException ; public class codeforces { public static void main ( String [ ] args ) { scanner in = new scanner ( ) ; int n = in . nextInt ( ) ; int k = in . nextInt ( ) ; ArrayList < Integer > no = new ArrayList < > ( ) ; for ( int i = 0 ; i < 4 ; i ++ ) no . add ( in . nextInt ( ) ) ; if ( n >= 5 && k >= n + 1 ) { System . out . print ( no . get ( 0 ) + " ▁ " + no . get ( 2 ) + " ▁ " ) ; for ( int i = 1 ; i <= n ; i ++ ) if ( ! no . contains ( i ) ) System . out . print ( i + " ▁ " ) ; System . out . println ( no . get ( 3 ) + " ▁ " + no . get ( 1 ) + " ▁ " ) ; System . out . print ( no . get ( 2 ) + " ▁ " + no . get ( 0 ) + " ▁ " ) ; for ( int i = 1 ; i <= n ; i ++ ) if ( ! no . contains ( i ) ) System . out . print ( i + " ▁ " ) ; System . out . println ( no . get ( 1 ) + " ▁ " + no . get ( 3 ) + " ▁ " ) ; } else System . out . println ( - 1 ) ; } } class scanner { BufferedReader br ; StringTokenizer st ; public scanner ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; st = null ; } public String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } public long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } }

n , k = map ( int , input ( ) . split ( ) ) a , b , c , d = input ( ) . split ( ) if n < 5 or k < n + 1 : print ( - 1 ) else : l = list ( set ( map ( str , range ( 1 , n + 1 ) ) ) - { a , b , c , d } ) print ( ' ▁ ' . join ( [ a , c ] + l + [ d , b ] + [ c , a ] + l + [ b , d ] ) ) NEW_LINE


f = lambda : map ( int , input ( ) . split ( ) ) n , k = f ( ) a , b , c , d = f ( ) s = list ( set ( range ( 1 , n + 1 ) ) . difference ( { a , b , c , d } ) ) d = [ a , c ] + s + [ d , b ] + [ c , a ] + s + [ b , d ] print ( ' ▁ ' . join ( map ( str , d ) ) if 4 < n < k else - 1 ) NEW_LINE


n , k = map ( int , input ( ) . split ( ) ) a , b , c , d = map ( int , input ( ) . split ( ) ) B = [ ] for i in range ( 1 , n + 1 ) : if i not in ( a , b , c , d ) : B . append ( i ) else : i -= 1 A = [ a , c ] + B + [ d , b ] C = [ c , a ] + B + [ b , d ] R = set ( ) for i in range ( n - 1 ) : R . add ( tuple ( sorted ( ( A [ i ] , A [ i + 1 ] ) ) ) ) R . add ( tuple ( sorted ( ( C [ i ] , C [ i + 1 ] ) ) ) ) if tuple ( sorted ( ( a , b ) ) ) in R : print ( - 1 ) exit ( ) if tuple ( sorted ( ( c , d ) ) ) in R : print ( - 1 ) exit ( ) if len ( R ) > k : print ( - 1 ) exit ( ) print ( * A ) print ( * C ) NEW_LINE


import sysprint = sys . stdout . writen , k = map ( int , input ( ) . split ( ) ) a , b , c , d = map ( int , input ( ) . split ( ) ) if n == 4 or k < n + 1 : print ( " - 1 \n " ) exit ( ) E = ( a , b , c , d ) print ( f " { a } ▁ { c } ▁ " ) for i in range ( 1 , n + 1 ) : if i not in E : print ( f " { i } ▁ " ) print ( f " { d } ▁ { b } \n " ) print ( f " { c } ▁ { a } ▁ " ) for i in range ( 1 , n + 1 ) : if i not in E : print ( f " { i } ▁ " ) print ( f " { b } ▁ { d } \n " ) NEW_LINE


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


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


import java . util . Scanner ;    public class Main {   public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ;   int n , k ; n = scanner . nextInt ( ) ; k = scanner . nextInt ( ) ; int [ ] arr = new int [ n ] ; int [ ] vis = new int [ n + 1 ] ; for ( int i = 0 ; i < 4 ; i ++ ) { arr [ i ] = scanner . nextInt ( ) ; vis [ arr [ i ] ] = 1 ; } if ( k < n + 1 || n == 4 ) { System . out . println ( - 1 ) ; return ; } int indx = 4 , vrtx = 1 ; while ( indx < n ) { while ( vis [ vrtx ] == 1 ) { vrtx ++ ; } arr [ indx ++ ] = vrtx ; vis [ vrtx ] = 1 ; }


import java . io . * ; import java . util . * ;    public class GFG { public static void main ( String [ ] args ) { FastReader fr = new FastReader ( ) ; int n = fr . nextInt ( ) , k = fr . nextInt ( ) ; int a = fr . nextInt ( ) , b = fr . nextInt ( ) , c = fr . nextInt ( ) , d = fr . nextInt ( ) ; if ( k < n + 1 || n == 4 ) { System . out . println ( " - 1" ) ; } else { StringBuilder sb = new StringBuilder ( ) ; for ( int i = 1 ; i <= n ; i ++ ) { if ( i != a && i != b && i != c && i != d ) { sb . append ( i + " ▁ " ) ; } } String first = a + " ▁ " + c + " ▁ " + sb . toString ( ) + d + " ▁ " + b ; String second = c + " ▁ " + a + " ▁ " + sb . toString ( ) + b + " ▁ " + d ; System . out . println ( first ) ; System . out . println ( second ) ; } } } class FastReader { BufferedReader bf ; StringTokenizer st ; public FastReader ( ) { bf = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( bf . readLine ( ) ) ; } catch ( Exception e ) { System . out . println ( e ) ; } } 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 = bf . readLine ( ) ; } catch ( Exception e ) { System . out . println ( e ) ; } return str ; } }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ;

def isRight ( a ) : x1 , y1 , x2 , y2 , x3 , y3 = a   if ( x1 == x2 and y1 == y2 ) or ( x1 == x3 and y1 == y3 ) or ( x2 == x3 and y2 == y3 ) : return False   A = ( y2 - y1 ) ** 2 + ( x2 - x1 ) ** 2 B = ( y3 - y1 ) ** 2 + ( x3 - x1 ) ** 2 C = ( y3 - y2 ) ** 2 + ( x3 - x2 ) ** 2   check = [ A , B , C ] check . sort ( )   return ( check [ 0 ] + check [ 1 ] == check [ 2 ] )   a = [ int ( x ) for x in input ( ) . split ( ) ]   if isRight ( a ) : print ( " RIGHT " ) else : isOk = False     for i in range ( 0 , 6 ) : a [ i ] += 1 isOk = isOk or isRight ( a ) a [ i ] -= 1   for i in range ( 0 , 6 ) : a [ i ] += - 1 isOk = isOk or isRight ( a ) a [ i ] -= - 1   if ( isOk ) : print ( " ALMOST " )   else : print ( " NEITHER " ) NEW_LINE


import sysdef check ( a1 , a2 , b1 , b2 , c1 , c2 ) : x = ( a1 - b1 ) ** 2 + ( a2 - b2 ) ** 2 y = ( b1 - c1 ) ** 2 + ( c2 - b2 ) ** 2 z = ( a1 - c1 ) ** 2 + ( c2 - a2 ) ** 2 l1 = [ x , y , z ] l1 . sort ( ) if l1 [ 0 ] + l1 [ 1 ] == l1 [ 2 ] and x != 0 and y != 0 and z != 0 : return True else : return Falsea1 , a2 , b1 , b2 , c1 , c2 = map ( int , input ( ) . split ( ) ) if check ( a1 , a2 , b1 , b2 , c1 , c2 ) : print ( " RIGHT " ) elif check ( a1 + 1 , a2 , b1 , b2 , c1 , c2 ) or check ( a1 - 1 , a2 , b1 , b2 , c1 , c2 ) : print ( " ALMOST " ) elif check ( a1 , a2 + 1 , b1 , b2 , c1 , c2 ) or check ( a1 , a2 - 1 , b1 , b2 , c1 , c2 ) : print ( " ALMOST " ) elif check ( a1 , a2 , b1 + 1 , b2 , c1 , c2 ) or check ( a1 , a2 , b1 - 1 , b2 , c1 , c2 ) : print ( " ALMOST " ) elif check ( a1 , a2 , b1 , b2 + 1 , c1 , c2 ) or check ( a1 , a2 , b1 , b2 - 1 , c1 , c2 ) : print ( " ALMOST " ) elif check ( a1 , a2 , b1 , b2 , c1 + 1 , c2 ) or check ( a1 , a2 , b1 , b2 , c1 - 1 , c2 ) : print ( " ALMOST " ) elif check ( a1 , a2 , b1 , b2 , c1 , c2 + 1 ) or check ( a1 , a2 , b1 , b2 , c1 , c2 - 1 ) : print ( " ALMOST " ) else : print ( " NEITHER " ) NEW_LINE


import java . util . Arrays ; import java . util . Scanner ;   public class Game { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int [ ] point = new int [ 6 ] ; for ( int i = 0 ; i < 6 ; i ++ ) point [ i ] = input . nextInt ( ) ;   if ( right ( point ) ) System . out . println ( " RIGHT " ) ; else if ( almostRight ( point ) ) System . out . println ( " ALMOST " ) ; else System . out . println ( " NEITHER " ) ; } public static boolean right ( int [ ] points ) { int [ ] sides = new int [ 3 ] ; Arrays . fill ( sides , 0 ) ; sides [ 0 ] = ( points [ 4 ] - points [ 2 ] ) * ( points [ 4 ] - points [ 2 ] ) + ( points [ 5 ] - points [ 3 ] ) * ( points [ 5 ] - points [ 3 ] ) ; sides [ 1 ] = ( points [ 4 ] - points [ 0 ] ) * ( points [ 4 ] - points [ 0 ] ) + ( points [ 5 ] - points [ 1 ] ) * ( points [ 5 ] - points [ 1 ] ) ; sides [ 2 ] = ( points [ 2 ] - points [ 0 ] ) * ( points [ 2 ] - points [ 0 ] ) + ( points [ 3 ] - points [ 1 ] ) * ( points [ 3 ] - points [ 1 ] ) ; Arrays . sort ( sides ) ; if ( sides [ 0 ] > 0 && sides [ 2 ] == sides [ 0 ] + sides [ 1 ] ) return true ; return false ; } public static boolean almostRight ( int [ ] points ) { for ( int i = 0 ; i < 6 ; i ++ ) { points [ i ] -- ; if ( right ( points ) ) return true ; points [ i ] ++ ; points [ i ] ++ ; if ( right ( points ) ) return true ; points [ i ] -- ; }   return false ; } }


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


import java . util . * ;   public class cf180 { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int i = 0 ; String s = sc . next ( ) ; int f [ ] = new int [ 26 ] ; for ( i = 0 ; i < n ; i ++ ) { char ch = s . charAt ( i ) ; f [ ch - ' a ' ] ++ ; } long ans = 0 ;

n , k = map ( int , input ( ) . split ( ) ) s = sorted ( input ( ) ) last = ord ( ' a ' ) - 2 ans , len = 0 , 0 for i in range ( 0 , n ) : if ord ( s [ i ] ) >= last + 2 : last = ord ( s [ i ] ) ans += ord ( s [ i ] ) - ord ( ' a ' ) + 1 len += 1 if ( len >= k ) : print ( ans ) exit ( )     print ( - 1 ) NEW_LINE


import mathn , k = map ( int , input ( ) . split ( ) ) s = str ( input ( ) )   s = sorted ( s ) NEW_LINE


stages , length = list ( map ( int , input ( ) . split ( ) ) )   s = list ( input ( ) ) s = list ( set ( s ) )   s . sort ( ) weight = 0 flag = 1 next_stage = s [ 0 ] start = 0 end = len ( s )   while length > 0 : length -= 1 if ( next_stage in s and flag == 1 ) : weight += ord ( next_stage ) - 96 flag = 1 if ( length > 0 ) : for each in range ( start , end ) : flag = 0 if ( ord ( s [ each ] ) - ord ( next_stage ) > 1 ) : start = each flag = 1 next_stage = s [ each ] break else : flag = 0 break   if ( flag == 1 ) : print ( weight ) else : print ( - 1 ) NEW_LINE


n , k = list ( map ( int , input ( ) . split ( ) ) ) s = sorted ( list ( str ( input ( ) ) ) ) r = 0 c = 0 m = sorted ( list ( set ( s ) ) ) for i in range ( len ( m ) ) : if i == 0 : r += ( ord ( m [ i ] ) - 96 ) c += 1 t = m [ i ] else : if ord ( m [ i ] ) - ord ( t ) != 1 : r += ( ord ( m [ i ] ) - 96 ) c += 1 t = m [ i ] if c == k : breakprint ( - 1 if c != k else r ) NEW_LINE


n , k = map ( int , input ( ) . split ( ) ) s = sorted ( input ( ) ) t = ' ' p = ' ▁ ' for c in s : if ord ( c ) > ord ( p ) + 1 : t += c p = c ans = - 1 if len ( t ) >= k : ans = sum ( map ( lambda x : ord ( x ) - 96 , t [ : k ] ) ) print ( ans ) NEW_LINE


import java . util . * ; import java . util . stream . * ;   public class Solution { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int k = scan . nextInt ( ) ; scan . nextLine ( ) ; String s = scan . nextLine ( ) ; Set < Character > sch = new HashSet < Character > ( ) ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { sch . add ( s . charAt ( i ) ) ; } List < Character > li = new ArrayList < Character > ( sch ) ; Collections . sort ( li ) ;


import java . util . * ; import java . io . * ; public class MyClass { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) , st = 0 , sum = 0 ; int arr [ ] = new int [ 26 ] ; String str = sc . next ( ) ; for ( int i = 0 ; i < n ; i ++ ) { arr [ str . charAt ( i ) - 97 ] += 1 ; } for ( int i = 0 ; i < 26 ; i ++ ) { if ( arr [ i ] > 0 ) { st += 1 ; sum += ( i + 1 ) ; if ( st == k ) break ; i += 1 ; } } if ( st == k ) System . out . println ( sum ) ; else System . out . println ( - 1 ) ; sc . close ( ) ; } }


import java . util . * ; public class Solution { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; int k = s . nextInt ( ) ; s . nextLine ( ) ; String s1 = s . nextLine ( ) ; char d [ ] = { ' a ' , ' b ' , ' c ' , ' d ' , ' e ' , ' f ' , ' g ' , ' h ' , ' i ' , ' j ' , ' k ' , ' l ' , ' m ' , ' n ' , ' o ' , ' p ' , ' q ' , ' r ' , ' s ' , ' t ' , ' u ' , ' v ' , ' w ' , ' x ' , ' y ' , ' z ' } ; String y [ ] = s1 . split ( " " ) ; Arrays . sort ( y ) ; String result = " " ; for ( String x : y ) result = result + x ; int count = 1 , found = 0 ; int weight = Arrays . binarySearch ( d , result . charAt ( 0 ) ) + 1 ;


import java . util . Scanner ;   public class B1153 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int R = in . nextInt ( ) ; int C = in . nextInt ( ) ; int H = in . nextInt ( ) ; int [ ] Rheight = new int [ R ] ; int [ ] Cheight = new int [ C ] ; for ( int c = 0 ; c < C ; c ++ ) { Cheight [ c ] = in . nextInt ( ) ; } for ( int r = 0 ; r < R ; r ++ ) { Rheight [ r ] = in . nextInt ( ) ; } StringBuilder answer = new StringBuilder ( ) ; for ( int r = 0 ; r < R ; r ++ ) { for ( int c = 0 ; c < C ; c ++ ) { int a = in . nextInt ( ) ; int h = ( a == 0 ) ? 0 : Math . min ( Rheight [ r ] , Cheight [ c ] ) ; answer . append ( h ) . append ( ' ▁ ' ) ; } answer . append ( ' \n ' ) ; } System . out . print ( answer ) ; }   }

n , m , h = list ( map ( int , input ( ) . split ( ) ) )     a = list ( map ( int , input ( ) . split ( ) ) ) b = list ( map ( int , input ( ) . split ( ) ) ) c = [ list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( n ) ]   for i in range ( n ) : for j in range ( m ) : if c [ i ] [ j ] == 1 : c [ i ] [ j ] = min ( a [ j ] , b [ i ] ) 	   for i in range ( n ) : print ( * c [ i ] ) NEW_LINE


n , m , h = list ( map ( int , input ( ) . split ( ) ) ) a_m = list ( map ( int , input ( ) . split ( ) ) ) b_n = list ( map ( int , input ( ) . split ( ) ) ) a_b = [ ] h = [ ] for i in range ( n ) : h . append ( list ( map ( int , input ( ) . split ( ) ) ) ) for j in range ( m ) : if ( h [ i ] [ j ] > 0 ) : if ( a_m [ j ] >= b_n [ i ] ) : h [ i ] [ j ] = b_n [ i ] else : h [ i ] [ j ] = a_m [ j ] a_b . append ( [ a_m [ j ] , b_n [ i ] , i , j ] )   for i in range ( n ) : h [ i ] = list ( map ( str , h [ i ] ) ) print ( " ▁ " . join ( h [ i ] ) )     NEW_LINE


n , m , h = list ( map ( int , input ( ) . split ( ) ) ) a_m = list ( map ( int , input ( ) . split ( ) ) ) b_n = list ( map ( int , input ( ) . split ( ) ) ) a_b = [ ] h = [ ] for i in range ( n ) : h . append ( list ( map ( int , input ( ) . split ( ) ) ) ) for j in range ( m ) : if ( h [ i ] [ j ] > 0 ) : if ( a_m [ j ] >= b_n [ i ] ) : h [ i ] [ j ] = b_n [ i ] else : h [ i ] [ j ] = a_m [ j ] h [ i ] = list ( map ( str , h [ i ] ) ) print ( " ▁ " . join ( h [ i ] ) )     NEW_LINE


import java . io . IOException ; import java . io . InputStreamReader ; import java . util . TreeSet ; import java . util . Scanner ; import java . util . Collections ; import java . util . HashSet ; import java . util . Arrays ; import java . lang . Math ; import java . io . BufferedReader ;   public class lottery { public static void main ( String [ ] args ) throws IOException { Scanner scan = new Scanner ( System . in ) ; int len = scan . nextInt ( ) ; int width = scan . nextInt ( ) ; int height = scan . nextInt ( ) ; int [ ] front = new int [ width ] ; int [ ] left = new int [ len ] ; int [ ] [ ] top = new int [ len ] [ width ] ; for ( int i = 0 ; i < width ; i ++ ) { front [ i ] = scan . nextInt ( ) ; } for ( int i = 0 ; i < len ; i ++ ) { left [ i ] = scan . nextInt ( ) ; } for ( int i = 0 ; i < len ; i ++ ) { for ( int j = 0 ; j < width ; j ++ ) { top [ i ] [ j ] = scan . nextInt ( ) ; } } int [ ] [ ] ans = new int [ len ] [ width ] ; for ( int i = 0 ; i < len ; i ++ ) { for ( int j = 0 ; j < width ; j ++ ) { if ( top [ i ] [ j ] == 1 ) { ans [ i ] [ j ] = Math . min ( front [ j ] , left [ i ] ) ; } } } for ( int i = 0 ; i < len ; i ++ ) { for ( int j = 0 ; j < width ; j ++ ) { System . out . print ( ans [ i ] [ j ] + " ▁ " ) ; } System . out . println ( ) ; } } }


import java . io . * ; import java . util . * ; import java . lang . * ;   public class c1 { public static MyScanner scan ; public static PrintWriter out ; public static void main ( String [ ] args ) { scan = new MyScanner ( ) ; out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ;   int t = 1 ;


import java . io . * ; import java . util . * ;   public class A implements Runnable { public static void main ( String [ ] args ) { new Thread ( null , new A ( ) , " _ cf " , 1 << 28 ) . start ( ) ; }   public void run ( ) { FastScanner fs = new FastScanner ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; System . err . println ( " Go ! " ) ;   int n = fs . nextInt ( ) ; long k = fs . nextLong ( ) ; long [ ] a = new long [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) a [ i ] = fs . nextLong ( ) ; BIT value = new BIT ( n + 1 ) ; BIT alive = new BIT ( n + 1 ) ; for ( int i = 1 ; i <= n ; i ++ ) { long sub = ( n - i ) * a [ i ] ; sub *= alive . sum ( i - 1 ) ; long add = value . sum ( i - 1 ) ; long di = add - sub ;

from sys import stdin , stdoutnmbr = lambda : int ( stdin . readline ( ) ) lst = lambda : list ( map ( int , stdin . readline ( ) . split ( ) ) ) for _ in range ( 1 ) : NEW_LINE


f = lambda : map ( int , input ( ) . split ( ) ) n , k = f ( ) s = j = 0 for i , q in enumerate ( f ( ) , 1 ) : if s - j * ( n - i ) * q < k : print ( i ) else : s += q * j j += 1 NEW_LINE


f = lambda : map ( int , input ( ) . split ( ) ) n , k = f ( ) j = 0 for i , q in enumerate ( f ( ) , 1 ) : if j * ( i - n ) * q < k : print ( i ) else : k -= q * j j += 1 NEW_LINE


n , k = map ( int , input ( ) . split ( ) ) arr = map ( int , input ( ) . split ( ) ) s , j , all_res = 0 , 0 , [ ] for i , q in enumerate ( arr , 1 ) : if s - j * ( n - i ) * q < k : all_res . append ( str ( i ) ) else : s += q * j j += 1 print ( ' \n ' . join ( all_res ) ) NEW_LINE


from sys import stdin , stdoutnmbr = lambda : int ( stdin . readline ( ) ) lst = lambda : list ( map ( int , stdin . readline ( ) . split ( ) ) ) def fn ( a ) : print ( ' a ' , a ) n = len ( a ) pos1 = [ 0 ] for i in range ( 1 , n ) : pos1 += [ pos1 [ - 1 ] + a [ i ] * i ] print ( ' pos1' , pos1 ) neg = [ ] for i in range ( n ) : neg += [ i * ( n - i - 1 ) * a [ i ] ] print ( ' neg ' , neg ) d = [ ] for i in range ( 1 , n + 1 ) : sm = 0 for j in range ( 1 , i ) : sm += a [ j - 1 ] * ( j - 1 ) - ( n - i ) * a [ i - 1 ] d += [ sm ] print ( ' d ' , d ) ; print ( ' = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = ' ) p = - 1 for i in range ( 1 , n ) : if pos1 [ i - 1 ] - neg [ i ] < k : p = i break if p == - 1 : return a . pop ( p ) fn ( a ) for _ in range ( 1 ) : NEW_LINE


import java . io . * ; import java . util . StringTokenizer ;   public class _314A implements Runnable { private BufferedReader in ; private StringTokenizer tok ;   private Object solve ( ) throws IOException { StringBuilder sb = new StringBuilder ( ) ; for ( long i = 2 , j = 2 , n = nextInt ( ) , k = nextInt ( ) , a = nextInt ( ) , m = 0 , l = n ; i <= n ; i ++ ) { long s = ( j - 2 ) * a , c = nextInt ( ) ; if ( m + s < k + ( j - 1 ) * ( l - j ) * c ) { sb . append ( i ) . append ( ' \n ' ) ; l -- ; } else { a = c ; m += s ; j ++ ; } } return sb ; }


import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ;   public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskA solver = new TaskA ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }   static class TaskA { public void solve ( int testNumber , InputReader in , PrintWriter out ) { int n = in . nextInt ( ) ; int k = in . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = in . nextInt ( ) ; } long d1 = 0 ; for ( int i = 0 , i2 = 0 ; i < n ; i ++ ) { long d2 = ( long ) i2 * ( n - i - 1 ) * a [ i ] ; if ( d1 - d2 < k ) { out . println ( i + 1 ) ; } else { d1 += i2 * a [ i ] ; i2 ++ ; } } }   }   static class InputReader { private StringTokenizer tokenizer ; private BufferedReader reader ;   public InputReader ( InputStream inputStream ) { reader = new BufferedReader ( new InputStreamReader ( inputStream ) ) ; }   private void fillTokenizer ( ) { if ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } } }   public String next ( ) { fillTokenizer ( ) ; return tokenizer . nextToken ( ) ; }   public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   } }


import java . util . Scanner ; import java . util . Arrays ;   public class Polikarp { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ;   int n = input . nextInt ( ) ;   int [ ] array = new int [ n ] ; int [ ] arr = new int [ n ] ; long sum = 0 ;   for ( int i = 0 ; i < n ; i ++ ) {   arr [ i ] = input . nextInt ( ) ; }   for ( int b = 0 ; b < n ; b ++ ) { sum = arr [ b ] + sum ; }   for ( int h = 0 ; h < n ; h ++ ) { array [ h ] = input . nextInt ( ) ; }   Arrays . sort ( array ) ;   if ( array [ n - 2 ] + array [ n - 1 ] >= sum ) { System . out . println ( " YES " ) ; }   else { System . out . println ( " NO " ) ; } } }

n = int ( input ( ) ) A = list ( map ( int , input ( ) . split ( ) ) ) B = list ( map ( int , input ( ) . split ( ) ) )   space = [ ] for i in range ( n ) : space . append ( B [ i ] ) NEW_LINE


def canFill ( cola_volumes , can_capacities ) : total_volume = sum ( cola_volumes ) can_capacities . sort ( ) if total_volume <= can_capacities [ - 1 ] + can_capacities [ - 2 ] : return " YES " return " NO "   no_of_cans = int ( input ( ) ) cola_volumes = list ( map ( int , input ( ) . split ( ) ) ) can_capacities = list ( map ( int , input ( ) . split ( ) ) ) print ( canFill ( cola_volumes , can_capacities ) ) NEW_LINE


import itertoolsimport bisectimport mathfrom collections import * import osimport sysfrom io import BytesIO , IOBase   ii = lambda : int ( input ( ) ) lmii = lambda : list ( map ( int , input ( ) . split ( ) ) ) slmii = lambda : sorted ( map ( int , input ( ) . split ( ) ) ) li = lambda : list ( input ( ) ) mii = lambda : map ( int , input ( ) . split ( ) ) msi = lambda : map ( str , input ( ) . split ( ) )     def main ( ) : NEW_LINE


n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) b = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE


try : n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) b = list ( map ( int , input ( ) . split ( ) ) ) z = [ ] b . sort ( ) r = sum ( a ) if ( b [ len ( b ) - 1 ] + b [ len ( b ) - 2 ] ) >= r : print ( " YES " ) else : print ( " NO " ) except : pass NEW_LINE


import java . util . * ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long [ ] b = new long [ n ] ; long rem = 0 ; for ( int i = 0 ; i < n ; i ++ ) { long a = sc . nextLong ( ) ; rem = rem + a ; } for ( int i = 0 ; i < n ; i ++ ) { b [ i ] = sc . nextLong ( ) ; } Arrays . sort ( b ) ; long cap = b [ n - 1 ] + b [ n - 2 ] ; if ( rem > cap ) { System . out . println ( " NO " ) ; } else { System . out . println ( " YES " ) ; } } }


import java . io . * ; import java . util . * ; import javax . print . attribute . standard . Finishings ;   import java . math . * ;   public class Exam { static final Random random = new Random ( ) ; static PrintWriter out = new PrintWriter ( ( System . out ) ) ; static Reader sc = new Reader ( ) ;   public static void main ( String args [ ] ) throws IOException {


import java . util . * ; import static java . lang . Math . max ; import static java . lang . Math . min ;   public class Test { 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 ( ) ;   for ( int i = 0 ; i < n ; i ++ ) b [ i ] = input . nextInt ( ) ;   long sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { sum += a [ i ] ; }   int first = max ( b [ 0 ] , b [ 1 ] ) , second = min ( b [ 0 ] , b [ 1 ] ) ; for ( int i = 2 ; i < n ; i ++ ) { if ( b [ i ] > first ) { second = first ; first = b [ i ] ; } else if ( b [ i ] > second ) { second = b [ i ] ; } } System . out . println ( first + second >= sum ? " YES " : " NO " ) ; } }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . ArrayList ; import java . util . StringTokenizer ;   public class Main { static ArrayList < Integer > adjList [ ] ; static double ans [ ] ; static int cnt [ ] ;   public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; int n = sc . nextInt ( ) ; adjList = new ArrayList [ n ] ; for ( int i = 0 ; i < n ; i ++ ) adjList [ i ] = new ArrayList < > ( ) ; for ( int i = 1 ; i < n ; i ++ ) adjList [ sc . nextInt ( ) - 1 ] . add ( i ) ; cnt = new int [ n ] ; preprocess ( 0 ) ; ans = new double [ n ] ; dfs ( 0 , 0 ) ; for ( double x : ans ) out . print ( x + " ▁ " ) ; out . flush ( ) ; out . close ( ) ; }   static void dfs ( int u , int p ) { if ( u == 0 ) ans [ u ] = 1 ; else ans [ u ] = ans [ p ] + 0.5 * ( 1 + cnt [ p ] - cnt [ u ] ) ; for ( int v : adjList [ u ] ) dfs ( v , u ) ; }   static void preprocess ( int u ) { cnt [ u ] = 1 ; for ( int v : adjList [ u ] ) { preprocess ( v ) ; cnt [ u ] += cnt [ v ] ; } }   static class Scanner { BufferedReader br ; StringTokenizer st ;   Scanner ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; }   String next ( ) throws IOException { while ( st == null || ! st . hasMoreTokens ( ) ) st = new StringTokenizer ( br . readLine ( ) ) ; return st . nextToken ( ) ; }   int nextInt ( ) throws IOException { return Integer . parseInt ( next ( ) ) ; } } }

class tree_node ( ) : def __init__ ( self ) : self . children = [ ] self . parent = None self . time = 0 self . downstream = 0   def addChild ( self , node ) : self . children . append ( node )   num_cities = int ( input ( ) )   if num_cities > 1 : other_cities = [ int ( x ) for x in input ( ) . split ( " ▁ " ) ] else : other_cities = [ ]   root = tree_node ( )   cities = [ root ]   for parent_city in other_cities : node = tree_node ( ) cities . append ( node ) parent = cities [ parent_city - 1 ] node . parent = parent parent . addChild ( node )   def calculate_downstream ( node ) : children = node . children if len ( children ) == 0 : return 1 return sum ( c . downstream for c in children ) + 1   def set_all_downstreams ( cities ) : for node in cities [ : : - 1 ] : node . downstream = calculate_downstream ( node )   def expected_starting_time ( node ) : parent = node . parent if parent == None : return 1.0 other_ds = parent . downstream - node . downstream - 1   return parent . time + other_ds / 2 + 1   def set_starting_times ( cities ) : for c in cities : c . time = expected_starting_time ( c )   set_all_downstreams ( cities ) set_starting_times ( cities )   for c in cities : print ( c . time ) NEW_LINE


n = int ( input ( ) ) pos , tree , ans , sz = list ( map ( int , input ( ) . split ( ) ) ) if n > 1 else [ ] , [ ] , [ ] , [ ] for i in range ( n ) : tree . append ( [ ] ) ans . append ( 0.0 ) sz . append ( 0 )   for i in range ( n - 1 ) : tree [ pos [ i ] - 1 ] . append ( i + 1 )   for i in range ( n ) [ : : - 1 ] : sz [ i ] = 1 for to in tree [ i ] : sz [ i ] += sz [ to ]   for i in range ( n ) : for to in tree [ i ] : ans [ to ] = ans [ i ] + 1 + ( sz [ i ] - 1 - sz [ to ] ) * 0.5   st = lambda i : str ( i + 1 ) print ( ' ▁ ' . join ( list ( map ( st , ans ) ) ) )       NEW_LINE


n = int ( input ( ) ) if n == 1 : print ( 1 ) exit ( 0 ) l = list ( map ( int , input ( ) . split ( ) ) ) w = [ [ ] for i in range ( n ) ] sz = [ 1 ] * nfor i in range ( n - 1 ) : w [ l [ i ] - 1 ] . append ( i + 1 ) for i in range ( n - 1 , - 1 , - 1 ) : for j in range ( len ( w [ i ] ) ) : sz [ i ] += sz [ w [ i ] [ j ] ] ans = [ 0 ] * nfor i in range ( n ) : for j in range ( len ( w [ i ] ) ) : ans [ w [ i ] [ j ] ] = ans [ i ] + 1 + ( sz [ i ] - 1 - sz [ w [ i ] [ j ] ] ) / 2 for i in range ( n ) : print ( ans [ i ] + 1 , end = " ▁ " ) NEW_LINE


import java . util . ArrayList ; import java . util . List ; import java . util . Locale ; import java . util . Scanner ;


import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . List ; import java . util . Scanner ; import java . util . ArrayList ;   public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskA solver = new TaskA ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }   static class TaskA { private int [ ] sub ; private List < List < Integer > > adj ; private int [ ] height ;   public void solve ( int testNumber , Scanner in , PrintWriter out ) { int n = in . nextInt ( ) ; adj = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { adj . add ( new ArrayList < > ( ) ) ; } for ( int i = 0 ; i < n - 1 ; i ++ ) { int u = in . nextInt ( ) ; adj . get ( u - 1 ) . add ( i + 1 ) ; } sub = new int [ n ] ; height = new int [ n ] ; dfs ( 0 , - 1 ) ; for ( int i = 0 ; i < n ; i ++ ) { double ans = ( n - sub [ i ] - height [ i ] ) / 2.0 + height [ i ] + 1 ; out . print ( ans + " ▁ " ) ; } }   private void dfs ( int u , int p ) { sub [ u ] += 1 ; height [ u ] = ( p == - 1 ) ? 0 : height [ p ] + 1 ; for ( int v : adj . get ( u ) ) { dfs ( v , u ) ; sub [ u ] += sub [ v ] ; } }   } }


import java . io . * ; import java . util . * ;   public class icpc { public static void main ( String [ ] args ) throws IOException { Reader in = new Reader ( ) ;


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ; public class Practice { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int t = Integer . parseInt ( br . readLine ( ) ) ; while ( ( t -- ) > 0 ) { PriorityQueue < Integer > heap = new PriorityQueue < Integer > ( Collections . reverseOrder ( ) ) ; String str = ( br . readLine ( ) ) ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) { if ( str . charAt ( i ) == '1' ) { int curr = 0 ; while ( i < str . length ( ) && str . charAt ( i ) == '1' ) { i ++ ; curr ++ ; } heap . add ( curr ) ; } } int ans = 0 ; while ( ! heap . isEmpty ( ) ) { ans += heap . remove ( ) ; if ( heap . size ( ) > 0 ) { heap . remove ( ) ; } } System . out . println ( ans ) ; } } }

for i in range ( int ( input ( ) ) ) : NEW_LINE INDENT s = input ( ) NEW_LINE a = sorted ( [ len ( i ) for i in s . split ( '0' ) ] , reverse = True ) NEW_LINE s = 0 NEW_LINE for i in range ( 0 , len ( a ) , 2 ) : NEW_LINE INDENT s += a [ i ] NEW_LINE DEDENT print ( s ) NEW_LINE DEDENT


t = int ( input ( ) ) NEW_LINE for i in range ( t ) : NEW_LINE INDENT s = input ( ) NEW_LINE l = list ( s ) NEW_LINE c = 0 NEW_LINE s = 0 NEW_LINE new = [ ] NEW_LINE for i in range ( len ( l ) ) : NEW_LINE INDENT if l [ i ] == "1" : NEW_LINE INDENT c += 1 NEW_LINE if i == len ( l ) - 1 : NEW_LINE INDENT new . append ( c ) NEW_LINE break NEW_LINE DEDENT DEDENT else : NEW_LINE INDENT new . append ( c ) NEW_LINE c = 0 NEW_LINE DEDENT DEDENT new . sort ( reverse = True ) NEW_LINE for i in range ( 0 , len ( new ) , 2 ) : NEW_LINE INDENT s += new [ i ] NEW_LINE DEDENT print ( s ) NEW_LINE DEDENT


for _ in range ( int ( input ( ) ) ) : NEW_LINE INDENT ans = 0 NEW_LINE S = input ( ) NEW_LINE l = sorted ( S . split ( "0" ) , reverse = True ) NEW_LINE for i in range ( len ( l ) ) : NEW_LINE INDENT if i % 2 == 0 : NEW_LINE INDENT ans += len ( l [ i ] ) NEW_LINE DEDENT DEDENT print ( ans ) NEW_LINE DEDENT


t = int ( input ( ) ) NEW_LINE for _ in range ( t ) : NEW_LINE INDENT s = input ( ) NEW_LINE q = " " NEW_LINE ali = [ ] NEW_LINE for i in range ( len ( s ) ) : NEW_LINE INDENT if ( s [ i ] != "1" ) : NEW_LINE INDENT if ( len ( q ) != 0 ) : NEW_LINE INDENT ali . append ( int ( q ) ) NEW_LINE DEDENT q = " " NEW_LINE DEDENT else : NEW_LINE INDENT q += "1" NEW_LINE DEDENT DEDENT if ( len ( q ) != 0 ) : NEW_LINE INDENT ali . append ( int ( q ) ) NEW_LINE DEDENT ali = sorted ( ali , reverse = True ) NEW_LINE ans = 0 NEW_LINE for i in range ( 0 , len ( ali ) , 2 ) : NEW_LINE INDENT q = str ( ali [ i ] ) NEW_LINE ans += len ( q ) NEW_LINE DEDENT print ( ans ) NEW_LINE DEDENT


testcases = int ( input ( ) ) NEW_LINE for i in range ( testcases ) : NEW_LINE INDENT sequence = input ( ) NEW_LINE sequence = sequence . split ( '0' ) NEW_LINE sequence = [ len ( item ) for item in sequence if len ( item ) > 0 ] NEW_LINE sequence . sort ( reverse = True ) NEW_LINE print ( sum ( sequence [ : : 2 ] ) ) NEW_LINE DEDENT


import java . util . * ; public class Test { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int t = input . nextInt ( ) ; while ( t -- > 0 ) { char [ ] s = input . next ( ) . toCharArray ( ) ; LinkedList < Integer > list = new LinkedList < > ( ) ; for ( int i = 0 ; i < s . length ; i ++ ) { int counter = 0 ; while ( i <= s . length - 1 && s [ i ] == '1' ) { counter ++ ; i ++ ; } if ( counter > 0 ) list . add ( counter ) ; } Collections . sort ( list , new Reverse ( ) ) ; int result = 0 ; for ( int i = 0 ; i < list . size ( ) ; i += 2 ) { result += list . get ( i ) ; } System . out . println ( result ) ; } } static class Reverse implements Comparator < Integer > { @ Override public int compare ( Integer a , Integer b ) { if ( a < b ) return 1 ; else if ( a > b ) return - 1 ; return 0 ; } } }


import java . util . ArrayList ; import java . util . Collections ; import java . util . Scanner ; public class SubstringRemovalGame { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int num = scan . nextInt ( ) ; ArrayList < String > cases = new ArrayList ( ) ; ArrayList < String > ones = new ArrayList ( ) ; ArrayList < Integer > score = new ArrayList ( ) ; int alice = 0 ; int gameCounter = 0 ; String one = " " ; for ( int i = 0 ; i < num ; i ++ ) cases . add ( scan . next ( ) ) ; for ( int i = 0 ; i < num ; i ++ ) { for ( int j = 0 ; j < cases . get ( i ) . length ( ) ; j ++ ) { if ( cases . get ( i ) . charAt ( j ) == '1' ) { one = one . concat ( "1" ) ; if ( ! one . equals ( " " ) && j == cases . get ( i ) . length ( ) - 1 ) ones . add ( one ) ; } else { if ( ! one . equals ( " " ) ) ones . add ( one ) ; one = " " ; } } while ( ! ones . isEmpty ( ) ) { if ( gameCounter % 2 == 0 ) { alice += Collections . max ( ones ) . length ( ) ; } gameCounter ++ ; ones . remove ( ones . indexOf ( ( Collections . max ( ones ) ) ) ) ; } score . add ( alice ) ; alice = 0 ; ones . clear ( ) ; one = " " ; gameCounter = 0 ; } for ( int i = 0 ; i < score . size ( ) ; i ++ ) System . out . println ( score . get ( i ) ) ; } }


import java . util . Scanner ; public class B { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) , q = sc . nextInt ( ) , k = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = sc . nextInt ( ) ; while ( q -- > 0 ) { int l = sc . nextInt ( ) , r = sc . nextInt ( ) ; int ans = k + a [ r - 1 ] - a [ l - 1 ] - 2 * ( r - l ) - 1 ; System . out . println ( ans ) ; } sc . close ( ) ; } }

R = lambda : map ( int , input ( ) . split ( ) ) NEW_LINE n , q , k = R ( ) NEW_LINE a = 0 , * R ( ) NEW_LINE for _ in [ 0 ] * q : l , r = R ( ) ; print ( a [ r ] - a [ l ] + ( l - r ) * 2 + k - 1 ) NEW_LINE


n , q , k = map ( int , input ( ) . split ( ) ) NEW_LINE a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE for i in range ( q ) : NEW_LINE INDENT l , r = map ( int , input ( ) . split ( ) ) NEW_LINE print ( a [ r - 1 ] - a [ l - 1 ] + ( l - r ) * 2 + k - 1 ) NEW_LINE DEDENT


n , q , k = map ( int , input ( ) . split ( ) ) ; NEW_LINE a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE for Q in range ( q ) : l , r = map ( int , input ( ) . split ( ) ) ; print ( a [ r - 1 ] - a [ l - 1 ] + ( l - r ) * 2 + k - 1 ) NEW_LINE


n , q , k = map ( int , input ( ) . split ( ) ) ; NEW_LINE a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE for _ in ' . ' * q : l , r = map ( int , input ( ) . split ( ) ) ; print ( a [ r - 1 ] - a [ l - 1 ] + ( l - r ) * 2 + k - 1 ) NEW_LINE


import java . util . * ; import java . math . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int q = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) arr [ i ] = sc . nextInt ( ) ; while ( q -- > 0 ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int out = 0 ; out = k + arr [ b - 1 ] - arr [ a - 1 ] - 2 * ( b - a ) - 1 ; System . out . println ( out ) ; } } }


import java . util . * ; import java . math . * ; public class ReplaceAndKeepSorted { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int q = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) arr [ i ] = sc . nextInt ( ) ; while ( q -- > 0 ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int out = 0 ; out = k + arr [ b - 1 ] - arr [ a - 1 ] - 2 * ( b - a ) - 1 ; System . out . println ( out ) ; } } }


import java . util . Scanner ; public class p1485B { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) , q = sc . nextInt ( ) , k = sc . nextInt ( ) , a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = sc . nextInt ( ) ; while ( q -- > 0 ) { int l = sc . nextInt ( ) - 1 , r = sc . nextInt ( ) - 1 ; System . out . println ( ( a [ r ] - a [ l ] + 1 - ( r - l + 1 ) ) * 2 + k - a [ r ] + a [ l ] - 1 ) ; } } }


import java . util . * ;    public class Practise {

import sysinput = sys . stdin . readlinefrom collections import defaultdict as dcfrom collections import Counterfrom bisect import bisect_right , bisect_leftimport mathfrom operator import itemgetterfrom heapq import heapify , heappop , heappushfrom queue import PriorityQueue as pqn , m = map ( int , input ( ) . split ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) x = dc ( int ) c = 0 p = 0 NEW_LINE


n , m = map ( int , input ( ) . split ( ) ) count = [ 0 ] * na = list ( map ( int , input ( ) . split ( ) ) ) for i in range ( m ) : count [ a [ i ] - 1 ] += 1 print ( min ( count ) ) NEW_LINE


n , m = map ( int , input ( ) . split ( ) ) A = list ( map ( int , input ( ) . split ( ) ) ) L = [ 0 ] * nfor i in range ( m ) : L [ A [ i ] - 1 ] += 1 print ( min ( L ) ) NEW_LINE


if __name__ == " _ _ main _ _ " : dic = { } n , m = map ( int , input ( ) . split ( ) ) li = list ( map ( int , input ( ) . split ( ) ) ) c = 0 for i in range ( n ) : dic . setdefault ( i + 1 , 0 ) for i in li : if 0 not in dic . values ( ) : c = c + 1 for j in range ( 1 , n + 1 ) : dic [ j ] = dic [ j ] - 1   dic [ i ] = dic [ i ] + 1 if 0 not in dic . values ( ) : c = c + 1 print ( c ) NEW_LINE


if __name__ == ' _ _ main _ _ ' : n , m = map ( int , input ( ) . split ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) d = dict ( ) if len ( set ( l ) ) < n : print ( 0 ) else : for i in range ( m ) : d . setdefault ( l [ i ] , 0 ) d [ l [ i ] ] += 1 min1 = 999999999 for i in d . values ( ) : if i < min1 : min1 = i print ( min1 ) NEW_LINE


import java . util . Scanner ;   public class Tetris { public static void main ( String [ ] args ) {   Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) , m = in . nextInt ( ) , i , a [ ] = new int [ n ] , o = 1000 ; for ( i = 0 ; i < m ; i ++ ) a [ in . nextInt ( ) - 1 ] ++ ;   in . close ( ) ; for ( i = 0 ; i < n ; i ++ ) o = Math . min ( o , a [ i ] ) ; System . out . println ( o ) ; } }


import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ;   public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; ATetris solver = new ATetris ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }   static class ATetris { int n ; int m ;   public void readInput ( Scanner sc ) { n = sc . nextInt ( ) ; m = sc . nextInt ( ) ; }   public void solve ( int testNumber , Scanner sc , PrintWriter pw ) { int q = 1 ; while ( q -- > 0 ) { readInput ( sc ) ; int [ ] count = new int [ n ] ; for ( int i = 0 ; i < m ; i ++ ) count [ sc . nextInt ( ) - 1 ] ++ ; int min = Integer . MAX_VALUE ; for ( int x : count ) min = Math . min ( min , x ) ; pw . println ( min ) ; } }   }   static class Scanner { StringTokenizer st ; BufferedReader br ;   public Scanner ( InputStream s ) { br = new BufferedReader ( new InputStreamReader ( s ) ) ; }   public String next ( ) { try { while ( st == null || ! st . hasMoreTokens ( ) ) st = new StringTokenizer ( br . readLine ( ) ) ; return st . nextToken ( ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } }   public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   } }


import java . util . Arrays ; import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) {   Scanner sc = new Scanner ( System . in ) ; while ( sc . hasNext ( ) ) { int n = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; } Arrays . sort ( arr ) ; int mid = n / 2 ; Long cost = 0L ; if ( arr [ mid ] < s ) { cost += s - arr [ mid ] ; for ( int i = mid + 1 ; i < n ; i ++ ) { if ( arr [ i ] < s ) { cost += s - arr [ i ] ; } } } else if ( arr [ mid ] > s ) { cost += arr [ mid ] - s ; for ( int i = mid - 1 ; i >= 0 ; i -- ) { if ( arr [ i ] > s ) { cost += arr [ i ] - s ; } } } else { cost = 0L ; }   System . out . println ( cost ) ;   } }   }

a , b = map ( int , input ( ) . split ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) l . sort ( ) low = [ ] eq = [ ] high = [ ] flag = Truenum = int ( ( a - 1 ) / 2 ) for i in l : if i < b : low . append ( i ) elif i > b : high . append ( i ) else : if flag : eq . append ( i ) flag = False else : high . append ( i )     if len ( low ) == len ( high ) : print ( 0 ) elif len ( low ) > len ( high ) : k = b t = len ( low ) - num r = 0 n = - 1 for _ in range ( t ) : r += k - low [ n ] n -= 1 print ( r ) else : k = b t = len ( high ) - num r = 0 n = 0 for _ in range ( t ) : r += high [ n ] - k n += 1 print ( r ) NEW_LINE


n , m = map ( int , input ( ) . split ( ) ) ar = list ( map ( int , input ( ) . split ( ) ) ) ar = sorted ( ar ) ; ans = 0 NEW_LINE


n , res = list ( map ( int , input ( ) . split ( ) ) ) s = list ( map ( int , input ( ) . split ( ) ) ) count = 0 s . sort ( )   for i in range ( n // 2 + 1 ) : if ( s [ i ] > res ) : count += s [ i ] - res   if ( s [ n - 1 - i ] < res ) : count += res - s [ n - 1 - i ]   print ( count ) NEW_LINE


n , s = map ( int , input ( ) . split ( ) ) l = sorted ( list ( map ( int , input ( ) . split ( ) ) ) ) cost = 0 boi0 = l [ : n // 2 ] boi1 = l [ n // 2 + 1 : ] for i in range ( n // 2 ) : if boi0 [ - 1 - i ] > s : cost += abs ( boi0 [ - 1 - i ] - s ) boi0 [ - 1 - i ] = s if boi1 [ i ] < s : cost += abs ( boi1 [ i ] - s ) boi1 [ i ] = scost += abs ( l [ n // 2 ] - s ) print ( cost ) NEW_LINE


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


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


import java . util . * ; import java . math . BigInteger ; public class asd { static Scanner s = new Scanner ( System . in ) ; public static void main ( String args [ ] ) throws Exception { int t = 1 ; while ( t -- > 0 ) { solve ( ) ; } } public static void solve ( ) { int n = s . nextInt ( ) ; int y = s . nextInt ( ) ; long arr [ ] = new long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) arr [ i ] = s . nextLong ( ) ; Arrays . sort ( arr ) ; long med = arr [ n / 2 ] ; if ( med < y ) { long sum = ( long ) ( y - med ) ; arr [ n / 2 ] = y ; for ( int i = n / 2 + 1 ; i < n ; i ++ ) { if ( arr [ i ] < y ) { sum += ( y - arr [ i ] ) ; } else break ; } System . out . println ( sum ) ; } else { long sum = med - y ; arr [ n / 2 ] = y ; for ( int i = n / 2 - 1 ; i >= 0 ; i -- ) { if ( arr [ i ] > y ) { sum += ( arr [ i ] - y ) ; } else break ; } System . out . println ( sum ) ; } } }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . ArrayList ; import java . util . HashMap ; import java . util . List ; import java . util . Map ; import java . util . StringTokenizer ; import java . util . TreeMap ;   public class Main implements Runnable { int n , m ; static boolean use_n_tests = true ; List < Integer > ls = generatePrimes ( 1000000 ) ;   void solve ( FastScanner in , PrintWriter out , int testNumber ) {

import sysinput = sys . stdin . readlinefrom NEW_LINE collections NEW_LINE import *     NEW_LINE class Fast_factorize : def NEW_LINE __init__ ( self , n ) : self . p = [ - 1 ] * ( n + 1 ) NEW_LINE for i in range ( 2 , n + 1 ) : if NEW_LINE self . p [ i ] == - 1 : NEW_LINE for j in range ( i , n + 1 , i ) : if NEW_LINE self . p [ j ] == - 1 : self . p [ j ] = i NEW_LINE def factorize ( self , n ) : res = [ ] NEW_LINE while n > 1 : res . append ( self . p [ n ] ) NEW_LINE n //= self . p [ n ] NEW_LINE return res NEW_LINE ff = Fast_factorize ( 10 ** 6 )   for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) NEW_LINE a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE cnt = defaultdict ( int ) NEW_LINE for ai in a : fct = Counter ( ff . factorize ( ai ) ) NEW_LINE key = 1 NEW_LINE for p , c in fct . items ( ) : if NEW_LINE c % 2 == 1 : key *= p NEW_LINE cnt [ key ] += 1 NEW_LINE a , b = 0 , 0 NEW_LINE for k , v in cnt . items ( ) : a = max ( a , v ) NEW_LINE if k == 1 or v % 2 == 0 : b += v NEW_LINE q = int ( input ( ) ) NEW_LINE for _ in range ( q ) : w = int ( input ( ) ) NEW_LINE if w == 0 : NEW_LINE INDENT print ( a ) else : NEW_LINE print ( max ( a , b ) ) NEW_LINE DEDENT


from sys import stdin , stdoutfrom NEW_LINE collections NEW_LINE import defaultdictimport NEW_LINE mathimport NEW_LINE os , sys , __pypy__     NEW_LINE def get_prime ( n ) : n = int ( math . sqrt ( n ) ) NEW_LINE prime = [ 2 ] NEW_LINE for x in range ( 3 , n + 1 , 2 ) : is_prime = False NEW_LINE for p in prime : if NEW_LINE p > int ( math . sqrt ( x ) ) : is_prime = True NEW_LINE break NEW_LINE if x % p == 0 : break NEW_LINE if is_prime : prime . append ( x ) NEW_LINE return prime     NEW_LINE def main ( ) : t = int ( stdin . readline ( ) ) NEW_LINE ans = __pypy__ . builders . StringBuilder ( ) NEW_LINE prime = get_prime ( 1000000 ) NEW_LINE for _ in range ( t ) : n = int ( stdin . readline ( ) ) NEW_LINE arr = list ( map ( int , stdin . readline ( ) . split ( ) ) ) NEW_LINE gp = defaultdict ( int ) NEW_LINE mx = - 1 NEW_LINE for a in arr : x = a NEW_LINE uniq_p = [ ] NEW_LINE for p in prime : while NEW_LINE x % p == 0 : NEW_LINE if len ( uniq_p ) > 0 and uniq_p [ - 1 ] == p : NEW_LINE INDENT uniq_p . pop ( ) else : NEW_LINE uniq_p . append ( p ) NEW_LINE DEDENT x = int ( x / p ) NEW_LINE if p > x : break NEW_LINE if x != 1 : uniq_p . append ( x ) NEW_LINE key = 1 NEW_LINE for x in uniq_p : key *= x NEW_LINE gp [ key ] += 1 NEW_LINE mx = max ( mx , gp [ key ] ) NEW_LINE mx_2 = 0 NEW_LINE for k , v in gp . items ( ) : if NEW_LINE v % 2 == 0 or k == 1 : mx_2 += v NEW_LINE q = int ( stdin . readline ( ) ) NEW_LINE for _ in range ( q ) : qq = int ( stdin . readline ( ) ) NEW_LINE if qq == 0 : NEW_LINE INDENT ans . append ( " % d \n " % ( mx ) ) else : NEW_LINE ans . append ( " % d \n " % ( max ( mx , mx_2 ) ) ) NEW_LINE DEDENT os . write ( 1 , ans . build ( ) . encode ( ) )       main ( ) NEW_LINE


import sysfrom NEW_LINE os NEW_LINE import environfrom NEW_LINE collections NEW_LINE import defaultdict     if environ [ ' USERNAME ' ] == ' kissz ' : inp = open ( ' in0 . txt ' , ' r ' ) . readline NEW_LINE def debug ( * args ) : print ( * args , file = sys . stderr ) NEW_LINE else : inp = sys . stdin . readline NEW_LINE def debug ( * args ) : pass NEW_LINE   NEW_LINE


import java . io . * ; import java . util . * ; import java . util . Map . Entry ;   public class Main { static int [ ] lp ; static void sieveLinear ( int N ) { ArrayList < Integer > primes = new ArrayList < Integer > ( ) ; lp = new int [ N + 1 ] ;


import java . util . * ; import java . io . * ;   public class Main { public static void main ( String args [ ] ) { new Main ( ) . run ( ) ; }   FastReader in = new FastReader ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; int [ ] rec = new int [ 1000001 ] ; void run ( ) { for ( int i = 0 ; i < 1000001 ; i ++ ) { rec [ i ] = i ; } for ( int i = 2 ; i * i < 1000001 ; i ++ ) { if ( rec [ i ] != i ) continue ; for ( int j = i ; j * i < 1000001 ; j ++ ) { rec [ i * j ] = i ; } } for ( int q = ni ( ) ; q > 0 ; q -- ) { work ( ) ; } out . flush ( ) ; } long mod = 1000000007 ; long gcd ( long a , long b ) { return a == 0 ? b : gcd ( b % a , a ) ; }   void work ( ) { int n = ni ( ) ; int [ ] A = nia ( n ) ; HashMap < Integer , Integer > map = new HashMap < > ( ) ; for ( int a : A ) { int v = 1 ; while ( rec [ a ] != 1 ) { int c = 0 ; int p = rec [ a ] ; while ( a % p == 0 ) { c ++ ; a /= p ; } if ( c % 2 == 1 ) { v *= p ; } } map . put ( v , map . getOrDefault ( v , 0 ) + 1 ) ; } int c1 = 0 , c2 = 0 ; for ( int key : map . keySet ( ) ) { int v = map . get ( key ) ; if ( v > c1 ) { c1 = v ; } if ( v % 2 == 0 || key == 1 ) { c2 += v ; } } for ( int t = ni ( ) ; t > 0 ; t -- ) { long w = nl ( ) ; if ( w == 0 ) { out . println ( c1 ) ; } else { out . println ( Math . max ( c1 , c2 ) ) ; } } }