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

n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) b = list ( map ( int , input ( ) . split ( ) ) ) backpack = set ( ) pos = 0 for x in b : if x in backpack : print ( 0 , end = ' ▁ ' ) else : cnt = 0 while True : backpack . add ( a [ pos ] ) cnt += 1 if a [ pos ] == x : break pos += 1 pos += 1 print ( cnt , end = ' ▁ ' ) NEW_LINE


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


n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) b = list ( map ( int , input ( ) . split ( ) ) ) backpack = set ( ) cur = 0 for x in b : if cur >= n or x in backpack : print ( 0 , end = ' ▁ ' ) else : cnt = 0 while a [ cur ] != x : backpack . add ( a [ cur ] ) cnt += 1 cur += 1 backpack . add ( a [ cur ] ) cur += 1 cnt += 1 print ( cnt , end = ' ▁ ' ) NEW_LINE


n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) b = list ( map ( int , input ( ) . split ( ) ) ) backpack = set ( ) cur = 0 for x in b : if cur >= n or x in backpack : print ( 0 , end = ' ▁ ' ) else : cnt = 0 while a [ cur + cnt ] != x : backpack . add ( a [ cur + cnt ] ) cnt += 1 backpack . add ( a [ cur + cnt ] ) cnt += 1 cur += cnt print ( cnt , end = ' ▁ ' ) NEW_LINE


import java . util . HashMap ; import java . util . Scanner ;   public class VasyaAndBooks2 { public static void main ( String [ ] args ) {   Scanner entrada = new Scanner ( System . in ) ; String n ;


import java . util . Scanner ;   public class VasyaBooks { public static void main ( String [ ] args ) {   Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) , i , a [ ] = new int [ n + 1 ] , l = - 1 ; StringBuilder sb = new StringBuilder ( ) ;   for ( i = 0 ; i < n ; i ++ ) a [ in . nextInt ( ) ] = i ; for ( i = 0 ; i < n ; i ++ ) { int b = in . nextInt ( ) ;   if ( a [ b ] <= l ) { sb . append ( "0 ▁ " ) ; } else { sb . append ( ( a [ b ] - l ) + " ▁ " ) ; l = a [ b ] ; } } in . close ( ) ; System . out . println ( sb . toString ( ) ) ; } }


import java . util . * ;   public class Check2 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; for ( int i = 0 ; i < t ; i ++ ) { int a1 = sc . nextInt ( ) ; int b1 = sc . nextInt ( ) ;   int a2 = sc . nextInt ( ) ; int b2 = sc . nextInt ( ) ;   boolean check = false ;   if ( a1 == a2 ) { if ( b1 + b2 == a1 ) { check = true ; } } if ( a1 == b2 ) { if ( b1 + a2 == a1 ) { check = true ; } } if ( b1 == a2 ) { if ( a1 + b2 == b1 ) { check = true ; } } if ( b1 == b2 ) { if ( a1 + a2 == b1 ) { check = true ; } }    if ( check ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } }   }   public static boolean strive ( String s ) { Stack < Character > stack = new Stack < > ( ) ; stack . push ( s . charAt ( 0 ) ) ; for ( int i = 1 ; i < s . length ( ) ; i ++ ) { char ch1 = s . charAt ( i ) ; if ( ch1 == ' ) ' ) { if ( ! stack . isEmpty ( ) && stack . peek ( ) == ' ( ' ) { stack . pop ( ) ; } else { return false ; } } else { stack . push ( ' ( ' ) ; } } return stack . size ( ) == 0 ; }   public static int getAns ( int [ ] ar , int bigger , int [ ] [ ] dp , int i , int j ) {   if ( i < 0 || j < 0 ) { return 0 ; }    if ( dp [ i ] [ j ] != - 1 ) { return dp [ i ] [ j ] ; } int ans1 = 0 , ans2 = 0 , ans3 = 0 ;   if ( ar [ i ] < bigger ) { ans1 = 1 + getAns ( ar , ar [ i ] , dp , i - 1 , j ) ;

cases = int ( input ( ) ) while cases : cases -= 1 a , b = map ( int , input ( ) . split ( ) ) c , d = map ( int , input ( ) . split ( ) )   if max ( a , b ) == max ( c , d ) == min ( a , b ) + min ( c , d ) : print ( " YES " ) else : print ( " NO " ) NEW_LINE


t = int ( input ( ) )   for test in range ( t ) : a = list ( sorted ( map ( int , input ( ) . split ( ) ) ) ) b = list ( sorted ( map ( int , input ( ) . split ( ) ) ) ) if a [ 0 ] + b [ 0 ] == a [ 1 ] and a [ 0 ] + b [ 0 ] == b [ 1 ] : print ( " YES " ) else : print ( " NO " ) NEW_LINE


for _ in range ( int ( input ( ) ) ) : a1 , b1 = map ( int , input ( ) . split ( ) ) a2 , b2 = map ( int , input ( ) . split ( ) ) m1 = max ( a1 , b1 ) m2 = max ( a2 , b2 ) n1 = a1 if b1 == m1 else b1 n2 = a2 if b2 == m2 else b2 if m1 == m2 and m1 == n1 + n2 : print ( " YES " ) else : print ( " NO " ) NEW_LINE


import sysdef get_list ( ) : return list ( map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ) ) ) for i in range ( int ( input ( ) ) ) : a = get_list ( ) a1 = get_list ( ) if max ( a ) == max ( a1 ) : if min ( a ) + min ( a1 ) == max ( a ) : print ( ' Yes ' ) else : print ( ' NO ' )   else : print ( ' NO ' )     NEW_LINE


import java . util . * ;    public class Practise {


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int a1 = sc . nextInt ( ) ; int b1 = sc . nextInt ( ) ; int a2 = sc . nextInt ( ) ; int b2 = sc . nextInt ( ) ; if ( a1 == a2 && ( b1 + b2 ) == a1 ) { System . out . println ( " YES " ) ; } else if ( b1 == b2 && ( a1 + a2 ) == b1 ) { System . out . println ( " YES " ) ; } else if ( b1 == a2 && ( a1 + b2 ) == b1 ) { System . out . println ( " YES " ) ; } else if ( a1 == b2 && ( a2 + b1 ) == a1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } }


import static java . lang . Math . max ; import static java . lang . Math . min ; import static java . lang . Math . abs ; import java . util . * ; import java . io . * ;   public class x954B { public static void main ( String hi [ ] ) throws Exception { BufferedReader infile = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( infile . readLine ( ) ) ; int N = Integer . parseInt ( st . nextToken ( ) ) ; char [ ] arr = infile . readLine ( ) . toCharArray ( ) ; int best = 1 ; for ( int len = 1 ; len <= N / 2 ; len ++ ) { boolean works = true ; for ( int i = 0 ; i < len ; i ++ ) if ( arr [ i ] != arr [ i + len ] ) works = false ; if ( works ) best = len ; } System . out . println ( N - best + 1 ) ; } public static int [ ] readArr ( int N , BufferedReader infile , StringTokenizer st ) throws Exception { int [ ] arr = new int [ N ] ; st = new StringTokenizer ( infile . readLine ( ) ) ; for ( int i = 0 ; i < N ; i ++ ) arr [ i ] = Integer . parseInt ( st . nextToken ( ) ) ; return arr ; } }

n = int ( input ( ) ) s = input ( ) ans = 1 for i in range ( 1 , n // 2 + 1 ) : if s [ : i ] == s [ i : 2 * i ] : ans = iprint ( n - ans + 1 ) NEW_LINE


n = int ( input ( ) ) s = input ( )   word = ' ' biggest_repetition = 1   for i in range ( len ( s ) ) : word += s [ i ]   if word in s [ i + 1 : i + len ( word ) + 1 ] : biggest_repetition = max ( biggest_repetition , len ( word ) )   print ( len ( s ) - biggest_repetition + 1 ) NEW_LINE


n = int ( input ( ) ) s = input ( )   best = nfor i in range ( 2 , n // 2 + 1 ) : if s [ : i ] == s [ i : 2 * i ] : cur = i + 1 + n - 2 * i best = min ( best , cur ) print ( best ) NEW_LINE


n = int ( input ( ) ) s = input ( ) ans = nfor i in range ( n - 1 , - 1 , - 1 ) : if ( s [ : i // 2 + 1 ] * 2 == s [ : i + 1 ] ) : ans = min ( ans , n - ( ( i + 1 ) // 2 ) + 1 ) breakprint ( ans )   NEW_LINE


n = int ( input ( ) ) st = input ( ) i = n // 2 - 1 ; j = 0 for j in range ( i , - 1 , - 1 ) : if st [ 0 : j + 1 ] == st [ j + 1 : 2 * j + 2 ] : breakprint ( n - j ) NEW_LINE


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


import java . io . BufferedReader ; import java . io . File ; import java . io . FileWriter ; import java . io . IOException ; import java . io . InputStreamReader ; import java . math . BigInteger ; import java . util . * ;   import javafx . util . Pair ;   public class Main { public static void main ( String args [ ] ) { FastScanner input = new FastScanner ( ) ; int n = input . nextInt ( ) ; String s = " ▁ " + input . next ( ) ; int i = 1 ; int maxcount = 0 ; while ( i * 2 <= n ) { int stop = i ; int k = stop + 1 ; boolean check = true ; for ( int j = 1 ; j <= stop ; j ++ , k ++ ) { if ( s . charAt ( j ) != s . charAt ( k ) ) { check = false ; } } if ( check ) maxcount = Math . max ( maxcount , i ) ; i ++ ; } System . out . println ( maxcount + ( n - maxcount * 2 ) + ( ( maxcount > 0 ) ? 1 : 0 ) ) ; }   static class FastScanner {   BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( " " ) ;   String next ( ) { while ( ! st . hasMoreTokens ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   long nextLong ( ) {   return Long . parseLong ( next ( ) ) ; }   double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; }   String nextLine ( ) throws IOException { return br . readLine ( ) ; } }   }


import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner s = new Scanner ( System . in ) ; int t = s . nextInt ( ) ; while ( t -- != 0 ) { int g = gcd ( s . nextInt ( ) , s . nextInt ( ) ) ; if ( g > 1 ) { System . out . println ( " Infinite " ) ; } else { System . out . println ( " Finite " ) ; } } } public static int gcd ( int a , int b ) { if ( b == 0 ) { return a ; } return gcd ( b , a % b ) ; } }

import math   t = int ( input ( ) )   for tc in range ( t ) : a , b = map ( int , input ( ) . split ( ) )   if math . gcd ( a , b ) == 1 : print ( " Finite " ) else : print ( " Infinite " )     NEW_LINE


import mathfor i in range ( int ( input ( ) ) ) : a , b = map ( int , input ( ) . split ( ) ) print ( " Finite " ) if ( math . gcd ( a , b ) == 1 ) else print ( " infinite " ) NEW_LINE


import math   def solve ( ) : a , b = map ( int , input ( ) . split ( ) ) if math . gcd ( a , b ) > 1 : print ( ' Infinite ' ) else : print ( ' Finite ' )   t = int ( input ( ) ) for _ in range ( t ) : solve ( ) NEW_LINE


I = lambda : map ( int , input ( ) . split ( ) ) INT = lambda : int ( input ( ) )   def gcd ( x , y ) : return x if y == 0 else gcd ( y , x % y )   T = INT ( ) NEW_LINE


import mathfor _ in range ( int ( input ( ) ) ) : a , b = map ( int , input ( ) . split ( ) ) if math . gcd ( a , b ) != 1 : print ( " INFINITE " ) else : print ( " FINITE " ) NEW_LINE


import java . util . Scanner ;   public class _0682GoodolNumbersColoring {   static int gcd ( int n1 , int n2 ) {   while ( n1 != n2 ) { if ( n1 > n2 ) n1 -= n2 ; else n2 -= n1 ; } return n1 ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int q = sc . nextInt ( ) ; while ( q > 0 ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; if ( gcd ( a , b ) == 1 ) { System . out . println ( " Finite " ) ; } else { System . out . println ( " Infinite " ) ; } q -- ; } }   }


import java . util . Scanner ;   public class GoodNumbersColoring {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- != 0 ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; if ( gcd ( a , b ) == 1 ) System . out . println ( " Finite " ) ; else System . out . println ( " Infinite " ) ; } } static int gcd ( int a , int b ) { if ( b == 0 ) return a ; return gcd ( b , a % b ) ; } }


import java . util . * ;   public class ICPC { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; boolean [ ] [ ] ar = new boolean [ n ] [ m ] ; for ( int i = 0 ; i < n ; i ++ ) {   for ( int j = 0 ; j < m ; j ++ ) { ar [ i ] [ j ] = false ; } } List < Integer > list = new ArrayList < > ( ) ; List < Integer > list1 = new ArrayList < > ( ) ;   for ( int i = 0 ; i < k ; i ++ ) { int n1 = sc . nextInt ( ) - 1 ; int n2 = sc . nextInt ( ) - 1 ; list . add ( n1 ) ; list1 . add ( n2 ) ;    } for ( int i = 0 ; i < k ; i ++ ) { int n1 = list . get ( i ) ; int n2 = list1 . get ( i ) ;   ar [ n1 ] [ n2 ] = true ; int x1 = n1 ; int y1 = n2 + 1 ;   int x2 = n1 + 1 ; int y2 = n2 ;   int x3 = n1 + 1 ; int y3 = n2 + 1 ;

def check ( board , n , m , i , j ) : if i < n - 1 and j < m - 1 and board [ i ] [ j ] and board [ i ] [ j + 1 ] and board [ i + 1 ] [ j ] and board [ i + 1 ] [ j + 1 ] : return True if i < n - 1 and j > 0 and board [ i ] [ j ] and board [ i ] [ j - 1 ] and board [ i + 1 ] [ j ] and board [ i + 1 ] [ j - 1 ] : return True if i > 0 and j < m - 1 and board [ i ] [ j ] and board [ i ] [ j + 1 ] and board [ i - 1 ] [ j ] and board [ i - 1 ] [ j + 1 ] : return True if i > 0 and j > 0 and board [ i ] [ j ] and board [ i ] [ j - 1 ] and board [ i - 1 ] [ j ] and board [ i - 1 ] [ j - 1 ] : return True return False   n , m , k = [ int ( s ) for s in input ( ) . split ( ) ] board = [ [ False ] * m for _ in range ( n ) ] ans = 0 for r in range ( k ) : i , j = [ int ( s ) - 1 for s in input ( ) . split ( ) ] board [ i ] [ j ] = True if check ( board , n , m , i , j ) : ans = r + 1 breakprint ( ans ) NEW_LINE


n , m , k = map ( int , input ( ) . split ( ) ) l = [ [ 0 for i in range ( m + 2 ) ] for j in range ( n + 2 ) ]   def check ( r , c ) : return l [ r ] [ c ] and l [ r ] [ c + 1 ] and l [ r + 1 ] [ c ] and l [ r + 1 ] [ c + 1 ] for i in range ( k ) : x , y = map ( int , input ( ) . split ( ) ) l [ x ] [ y ] = 1 ans = check ( x , y ) or check ( x , y - 1 ) or check ( x - 1 , y - 1 ) or check ( x - 1 , y ) if ans : print ( i + 1 ) breakelse : print ( 0 ) NEW_LINE


import sysimport mathimport bisect   def query ( A , x , y ) : n = len ( A ) m = len ( A [ 0 ] ) if x >= 0 and x + 1 < n and y >= 0 and y + 1 < m : cnt = 0 if A [ x ] [ y ] == 1 : cnt += 1 if A [ x ] [ y + 1 ] == 1 : cnt += 1 if A [ x + 1 ] [ y ] == 1 : cnt += 1 if A [ x + 1 ] [ y + 1 ] == 1 : cnt += 1 if cnt == 4 : return True return False   def main ( ) : n , m , q = map ( int , input ( ) . split ( ) ) A = [ ] for i in range ( n ) : A . append ( [ 0 ] * m ) ans = 0 for i in range ( q ) : x , y = map ( int , input ( ) . split ( ) ) x -= 1 y -= 1 if A [ x ] [ y ] == 0 : A [ x ] [ y ] = 1 if query ( A , x - 1 , y - 1 ) : ans = i + 1 break if query ( A , x - 1 , y ) : ans = i + 1 break if query ( A , x , y - 1 ) : ans = i + 1 break if query ( A , x , y ) : ans = i + 1 break ''' ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( ' x : ▁ % d , ▁ y : ▁ % d ' ▁ % ▁ ( x , ▁ y ) ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ for ▁ j ▁ in ▁ range ( n ) : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( ' A [ % d ] : ▁ % s ' ▁ % ▁ ( j , ▁ str ( A [ j ] ) ) ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ''' print ( ans )   if __name__ == " _ _ main _ _ " : main ( ) NEW_LINE


R = lambda : map ( int , input ( ) . split ( ) ) n , m , k = R ( ) N = 1024 g = [ [ 0 ] * N for _ in range ( N ) ]   def T ( r , c ) : return g [ r ] [ c ] and g [ r + 1 ] [ c ] and g [ r ] [ c + 1 ] and g [ r + 1 ] [ c + 1 ] for i in range ( k ) : r , c = R ( ) g [ r ] [ c ] = 1 if T ( r - 1 , c - 1 ) or T ( r - 1 , c ) or T ( r , c - 1 ) or T ( r , c ) : print ( i + 1 ) breakelse : print ( 0 )     NEW_LINE


n , m , k = map ( int , input ( ) . split ( ) ) flag = 0 d = set ( ) for i in range ( k ) : x , y = map ( int , input ( ) . split ( ) ) d . add ( ( x , y ) ) for j in [ - 1 , 0 ] : for k in [ - 1 , 0 ] : if all ( ( x + j + a , y + k + b ) in d for a in [ 0 , 1 ] for b in [ 0 , 1 ] ) : if not flag : print ( i + 1 ) flag = 1 if not flag : print ( 0 ) NEW_LINE


import java . io . * ; import java . util . * ; import java . util . stream . * ;   public class ACM { public static void main ( String args [ ] ) throws FileNotFoundException , IOException { Scanner x = new Scanner ( System . in ) ; Stack < Character > s = new Stack < Character > ( ) ; String str = x . next ( ) ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) { if ( s . empty ( ) ) s . push ( str . charAt ( i ) ) ; else if ( s . peek ( ) . equals ( str . charAt ( i ) ) ) s . pop ( ) ; else s . push ( str . charAt ( i ) ) ; }

import sys , os , ioimport math , bisect , operatorinf , mod = float ( ' inf ' ) , 10 ** 9 + 7 NEW_LINE


secuencia = input ( ) plus = secuencia . count ( " + " ) minus = secuencia . count ( " - " )   if len ( secuencia ) % 2 == 0 : if ( secuencia == secuencia [ : : - 1 ] ) : print ( " Yes " ) else : if plus % 2 == 0 and minus % 2 == 0 : largo = len ( secuencia ) // 2 if ( " + + " in secuencia ) or ( " - - " in secuencia ) : for i in range ( 0 , largo ) : NEW_LINE


secuencia = input ( ) plus = secuencia . count ( " + " ) minus = secuencia . count ( " - " )   if len ( secuencia ) % 2 == 0 : if ( secuencia == secuencia [ : : - 1 ] ) : print ( " Yes " ) else : if plus % 2 == 0 and minus % 2 == 0 : largo = len ( secuencia ) // 2 if ( " + + " in secuencia ) or ( " - - " in secuencia ) : for i in range ( 0 , largo ) : try : secuencia = secuencia . replace ( " + + " , " " ) secuencia = secuencia . replace ( " - - " , " " ) continue except : continue if secuencia == " " : print ( " Yes " ) else : print ( " No " ) else : print ( " No " ) else : print ( " No " ) else : print ( " No " ) NEW_LINE


secuencia = input ( ) plus = secuencia . count ( " + " ) minus = secuencia . count ( " - " )   if len ( secuencia ) % 2 == 0 : if ( secuencia == secuencia [ : : - 1 ] ) : print ( " Yes " ) else : if plus % 2 == 0 and minus % 2 == 0 : largo = len ( secuencia ) // 2 if " + + " in secuencia or " - - " in secuencia : for i in range ( 0 , largo ) : NEW_LINE


import java . io . * ; import java . util . * ; import java . util . stream . * ;   public class ACM { public static void main ( String args [ ] ) throws FileNotFoundException , IOException { Scanner x = new Scanner ( System . in ) ; String s = x . next ( ) ; StackDynamicArray < Character > sd = new StackDynamicArray < Character > ( ) ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( sd . isEmpty ( ) ) sd . push ( s . charAt ( i ) ) ; else if ( sd . topp ( ) . equals ( s . charAt ( i ) ) ) sd . pop ( ) ; else sd . push ( s . charAt ( i ) ) ; }


import java . util . * ;   public class BAlternatingCurrent { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; int n = s . length ( ) ; if ( n % 2 == 0 ) { int stk = 0 ; for ( int i = 0 ; i < n ; i += 2 ) { if ( s . charAt ( i ) == ' - ' && s . charAt ( i + 1 ) == ' + ' ) stk ++ ; if ( s . charAt ( i ) == ' + ' && s . charAt ( i + 1 ) == ' - ' ) stk -- ; } if ( stk == 0 ) { System . out . println ( " Yes " ) ; return ; } } System . out . println ( " No " ) ; } }


import java . util . Stack ; public class p343B { public static void main ( String [ ] args ) { Stack < Character > st = new Stack < > ( ) ; char pre = ' ▁ ' ; for ( char c : new java . util . Scanner ( System . in ) . next ( ) . toCharArray ( ) ) { if ( c == pre ) st . pop ( ) ; else st . add ( c ) ; if ( ! st . isEmpty ( ) ) pre = st . peek ( ) ; else pre = ' ▁ ' ; } System . out . println ( st . empty ( ) ? " Yes " : " No " ) ; } }


import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . io . IOException ; import java . util . Stack ; 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 ) ; TaskB solver = new TaskB ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }   static class TaskB { public void solve ( int testNumber , InputReader in , PrintWriter out ) {


import java . util . * ; public class Solution { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; int m = s . nextInt ( ) ; s . nextLine ( ) ; String a [ ] = new String [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = s . nextLine ( ) ; int b [ ] = new int [ m ] ; for ( int j = 0 ; j < m ; j ++ ) b [ j ] = s . nextInt ( ) ; HashMap < Character , Integer > h1 = new HashMap < > ( ) ; h1 . put ( ' A ' , 0 ) ; h1 . put ( ' B ' , 1 ) ; h1 . put ( ' C ' , 2 ) ; h1 . put ( ' D ' , 3 ) ; h1 . put ( ' E ' , 4 ) ; int r [ ] = new int [ 5 ] ; int r1 [ ] = new int [ m ] ; int p = 0 ; for ( int k = 0 ; k < m ; k ++ ) { for ( int k1 = 0 ; k1 < n ; k1 ++ ) { int u = h1 . get ( a [ k1 ] . charAt ( k ) ) ; r [ u ] = r [ u ] + 1 ; } r1 [ k ] = max ( r ) ; for ( int g = 0 ; g < 5 ; g ++ ) r [ g ] = 0 ; } int sum = 0 ; for ( p = 0 ; p < m ; p ++ ) { sum = sum + ( r1 [ p ] * b [ p ] ) ; } System . out . println ( sum ) ; } public static int max ( int r [ ] ) { int max = 0 ; for ( int i = 0 ; i < r . length ; i ++ ) { if ( r [ i ] > max ) max = r [ i ] ; } return max ; } }

import collectionscases , n = map ( int , input ( ) . split ( ) ) marks = [ ] while cases : cases -= 1 s = list ( input ( ) ) marks . append ( s ) arr = list ( map ( int , input ( ) . split ( ) ) ) traverse = [ [ marks [ i ] [ j ] for i in range ( len ( marks ) ) ] for j in range ( len ( marks [ 0 ] ) ) ]   ans = 0 for n , m in zip ( arr , traverse ) : count = collections . Counter ( m ) mx = max ( count . values ( ) ) ans += mx * n   print ( ans )                 NEW_LINE


n , k = map ( int , input ( ) . split ( ) ) s = [ ] for i in range ( n ) : s . append ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) ans = 0 for i in range ( k ) : b = [ 0 ] * 5 for j in range ( n ) : b [ ord ( s [ j ] [ i ] ) - ord ( ' A ' ) ] += 1 tmp = 0 for j in range ( 5 ) : tmp = max ( tmp , b [ j ] ) ans += tmp * a [ i ] print ( ans ) NEW_LINE


students , question = map ( int , input ( ) . split ( ) ) final_list = [ ] for each in range ( 0 , students ) : final_list . append ( input ( ) ) value = list ( map ( int , input ( ) . split ( ) ) )   i = 0 score = 0 for each in range ( 0 , question ) : count_list = [ 0 ] * 5 for ans_student in final_list : count_list [ ord ( ans_student [ i ] ) - 65 ] += value [ i ] score = score + max ( count_list ) i += 1 print ( score )   NEW_LINE


n , m = map ( int , input ( ) . split ( ) ) s = [ ] ans = 0 for i in range ( n ) : l = input ( ) s . append ( l ) marks = list ( map ( int , input ( ) . split ( ) ) ) t = { ' A ' : 0 , ' B ' : 1 , ' C ' : 2 , ' D ' : 3 , ' E ' : 4 } for i in range ( m ) : d = [ 0 , 0 , 0 , 0 , 0 ] for j in range ( n ) : d [ t . get ( s [ j ] [ i ] ) ] += 1 ans += max ( d ) * marks [ i ] print ( ans ) NEW_LINE


import java . util . * ;   public class M_Round_1 {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; String ans [ ] = new String [ n ] ; for ( int i = 0 ; i < n ; i ++ ) ans [ i ] = sc . next ( ) ; int points [ ] = new int [ m ] ; for ( int i = 0 ; i < m ; i ++ ) points [ i ] = sc . nextInt ( ) ; int sum = 0 ; for ( int i = 0 ; i < m ; i ++ ) { int count [ ] = new int [ 5 ] ; for ( int j = 0 ; j < n ; j ++ ) count [ ans [ j ] . charAt ( i ) - ' A ' ] ++ ; int max = 0 ; for ( int j = 0 ; j < 5 ; j ++ ) max = Math . max ( max , count [ j ] ) ; sum += points [ i ] * max ; } System . out . println ( sum ) ; } }


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


import java . util . * ; import java . lang . * ; import java . io . * ;   public class Codechef { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner sc = new Scanner ( System . in ) ;   int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; char mat [ ] [ ] = new char [ n ] [ m ] ; for ( int i = 0 ; i < n ; ++ i ) { String temp = sc . next ( ) ; for ( int j = 0 ; j < m ; ++ j ) { mat [ i ] [ j ] = temp . charAt ( j ) ; } } int arr [ ] = new int [ m ] ; for ( int i = 0 ; i < m ; ++ i ) { arr [ i ] = sc . nextInt ( ) ; } int ans = 0 ; for ( int i = 0 ; i < m ; ++ i ) { int ash [ ] = new int [ 5 ] ; for ( int j = 0 ; j < n ; ++ j ) { if ( mat [ j ] [ i ] == ' A ' ) { ash [ 0 ] = ash [ 0 ] + 1 ; } if ( mat [ j ] [ i ] == ' B ' ) { ash [ 1 ] = ash [ 1 ] + 1 ; } if ( mat [ j ] [ i ] == ' C ' ) { ash [ 2 ] = ash [ 2 ] + 1 ; } if ( mat [ j ] [ i ] == ' D ' ) { ash [ 3 ] = ash [ 3 ] + 1 ; } if ( mat [ j ] [ i ] == ' E ' ) { ash [ 4 ] = ash [ 4 ] + 1 ; } } int maxi = 0 ; for ( int k = 0 ; k < 5 ; ++ k ) { maxi = Math . max ( maxi , ash [ k ] ) ; } ans = ans + maxi * arr [ i ] ; } System . out . println ( ans ) ;   } }


import java . util . * ; public class important_exam { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int A [ ] = new int [ m ] ; String S [ ] = new String [ n ] ; sc . nextLine ( ) ; for ( int i = 0 ; i < n ; i ++ ) { S [ i ] = sc . nextLine ( ) ; } for ( int i = 0 ; i < m ; i ++ ) { A [ i ] = sc . nextInt ( ) ; } int score = 0 ; for ( int i = 0 ; i < m ; i ++ ) { int frequency = 0 ; int acount = 0 , bcount = 0 , ccount = 0 , dcount = 0 , ecount = 0 ; for ( int j = 0 ; j < n ; j ++ ) { char ch = S [ j ] . charAt ( i ) ; switch ( ch ) { case ' A ' : acount ++ ; break ; case ' B ' : bcount ++ ; break ; case ' C ' : ccount ++ ; break ; case ' D ' : dcount ++ ; break ; case ' E ' : ecount ++ ; break ; default : frequency = 0 ; } } frequency = Math . max ( acount , Math . max ( bcount , Math . max ( ccount , Math . max ( dcount , ecount ) ) ) ) ; score += A [ i ] * frequency ; } System . out . println ( score ) ; } }


import java . util . * ;   public class A {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ;   int tc = sc . nextInt ( ) ;   for ( ; tc > 0 ; tc -- ) { int n = sc . nextInt ( ) ; int zero = 0 ; int sum = 0 ;   for ( int i = 0 ; i < n ; ++ i ) { int x = sc . nextInt ( ) ; if ( x == 0 ) zero ++ ; sum += x ; }   if ( zero == 0 && sum != 0 ) { System . out . println ( 0 ) ; continue ; }   if ( zero == 0 && sum == 0 ) { System . out . println ( 1 ) ; continue ; }   sum += zero ; if ( sum == 0 ) zero ++ ;   System . out . println ( zero ) ; } }     }

I = inputexec ( int ( I ( ) ) * " I ( ) ; a = [ * map ( int , I ( ) . split ( ) ) ] ; s = a . count ( 0 ) ; print ( s + ( s + sum ( a ) = = 0 ) ) ; " ) NEW_LINE


''' ▁ 1300a ▁ Non ▁ zero ''' for _ in range ( int ( input ( ) ) ) : input ( ) arr = [ int ( x ) for x in input ( ) . split ( ) ] ch = 0 for i , x in enumerate ( arr ) : ch += x == 0 arr [ i ] += x == 0 print ( ch + int ( sum ( arr ) == 0 ) ) NEW_LINE


def string_to_list ( s , char ) : collector = " " output_list = [ ] for i in range ( len ( s ) ) : if s [ i ] != char : collector += s [ i ] if i == len ( s ) - 1 : output_list . append ( int ( collector ) ) else : output_list . append ( int ( collector ) ) collector = " " return output_list     NEW_LINE


def q1300a ( ) : n = int ( input ( ) ) for _ in range ( n ) : arr_len = int ( input ( ) ) arr = [ int ( num ) for num in input ( ) . split ( ) ] subproblem ( arr_len , arr )   def subproblem ( arr_len , arr ) : zero_count = 0 for i in range ( len ( arr ) ) : if ( arr [ i ] == 0 ) : zero_count += 1 arr [ i ] = 1 if ( sum ( arr ) == 0 ) : zero_count += 1 print ( zero_count )   q1300a ( ) NEW_LINE


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


import java . util . * ; import java . io . * ; import java . math . * ;     public class A {   private static long INF = 2000000000000000000L , M = 1000000007 , MM = 998244353 ; private static int N = 0 ;   public static void process ( ) throws IOException {   int n = sc . nextInt ( ) ; int arr [ ] = sc . readArray ( n ) ; int zero = 0 ; int sum = 0 ; for ( int e : arr ) { if ( e == 0 ) zero ++ ; sum += e ; } if ( zero > 0 ) { sum += zero ; } if ( sum == 0 ) { System . out . println ( zero + 1 ) ; } else { System . out . println ( zero ) ; } }


import java . math . * ; import java . util . * ; import java . io . * ;   public class CFA { BufferedReader br ; PrintWriter out ; StringTokenizer st ; boolean eof ; private static final long MOD = 1000L * 1000L * 1000L + 7 ; private static final int [ ] dx = { 0 , - 1 , 0 , 1 } ; private static final int [ ] dy = { 1 , 0 , - 1 , 0 } ; private static final String yes = " Yes " ; private static final String no = " No " ;   void solve ( ) { int T = nextInt ( ) ;


import java . io . * ;   public class CF2 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter pw = new PrintWriter ( new OutputStreamWriter ( System . out ) ) ;   Task solver = new Task ( ) ; solver . solve ( br , pw ) ;   pw . close ( ) ; }   static class Task { public void solve ( BufferedReader br , PrintWriter pw ) throws IOException { int n = Integer . parseInt ( br . readLine ( ) ) ; if ( n % 2 == 1 ) { pw . println ( - 1 ) ; return ; }   int rowLen = 2 ; StringBuilder layer = new StringBuilder ( " bb \n " + " bb \n " ) ;   int numRows = 2 ; boolean black = false ; int end = ( n - 2 ) / 2 ; for ( int i = 0 ; i < end ; i ++ ) { char c = black ? ' b ' : ' w ' ;   int start = 0 ; for ( int j = 0 ; j < numRows ; j ++ ) { layer . insert ( start , c ) ; start += rowLen + 1 ; layer . insert ( start , c ) ; start += 2 ; }   rowLen += 2 ; numRows += 2 ;   StringBuilder row = new StringBuilder ( ) ; for ( int j = 0 ; j < rowLen ; j ++ ) { row . append ( c ) ; } row . append ( " \n " ) ; layer . insert ( 0 , row ) ; layer . append ( row ) ;   black = ! black ; }   StringBuilder layer2 = new StringBuilder ( ) ; for ( int i = 0 ; i < layer . length ( ) ; i ++ ) { if ( layer . charAt ( i ) == ' b ' ) { layer2 . append ( ' w ' ) ; } else if ( layer . charAt ( i ) == ' w ' ) { layer2 . append ( ' b ' ) ; } else { layer2 . append ( layer . charAt ( i ) ) ; } }    for ( int i = 0 ; i < n ; i ++ ) { if ( i % 2 == 0 ) { pw . println ( layer ) ; } else { pw . println ( layer2 ) ; } } } } }

import sys , mathreadline = sys . stdin . readline   k = int ( readline ( ) )   if k % 2 : print ( - 1 ) else : for i in range ( k ) : for j in range ( k ) : s = ' ' if ( i // 2 + j ) & 1 : s = ' wwbb ' * ( k // 4 ) if k % 4 != 0 : s += ' ww ' else : s = ' bbww ' * ( k // 4 ) if k % 4 != 0 : s += ' bb ' print ( s ) NEW_LINE


class CodeforcesTask323ASolution : def __init__ ( self ) : self . result = ' ' self . k = 0   def read_input ( self ) : self . k = int ( input ( ) )   def process_task ( self ) : if self . k % 2 : self . result = " - 1" elif self . k == 2 : self . result = " bb \n ww \n \n bb \n ww " else : level = " b " cube = [ [ [ None for y in range ( self . k ) ] for x in range ( self . k ) ] for z in range ( self . k ) ] for z in range ( self . k ) : level = " w " if z % 2 else " b " for k in range ( self . k // 2 ) : NEW_LINE


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


import java . io . * ; import java . util . * ; public class code implements Runnable {

def li ( ) : return list ( map ( int , input ( ) . split ( " ▁ " ) ) ) NEW_LINE for _ in range ( int ( input ( ) ) ) : a , b = li ( ) NEW_LINE if b != 0 and a != 0 : s = ( max ( 0 , a - 4 * b ) + a ) / 2 NEW_LINE s *= min ( ( a / 4 ) , b ) NEW_LINE ans = 1 / 2 + s / ( 2 * a * b ) NEW_LINE print ( " { : . 8f } " . format ( ans ) ) elif b == 0 : print ( 1 ) else : print ( 0.5 ) NEW_LINE


from fractions import Fractiont = int ( input ( ) ) NEW_LINE for _ in range ( t ) : a , b = map ( lambda x : Fraction ( x ) , input ( ) . split ( ' ▁ ' ) ) NEW_LINE if b == 0 : print ( 1 ) NEW_LINE continue elif a == 0 : print ( 0.5 ) NEW_LINE continue   up = a * ( b + b + a / 4 ) / 2 - max ( 0 , a - 4 * b ) * ( a / 4 - b ) / 2 NEW_LINE down = a * 2 * b NEW_LINE print ( float ( up / down ) ) NEW_LINE


for i in range ( int ( input ( ) ) ) : a , b = map ( int , input ( ) . split ( ) ) NEW_LINE print ( 0.5 + a / ( b << 4 ) if 4 * b > a else 1 - b / a if a else 1 ) NEW_LINE


t = int ( input ( ) ) NEW_LINE for _ in range ( t ) : a , b = map ( float , input ( ) . split ( ) ) NEW_LINE if b == 0.0 : NEW_LINE INDENT print ( 1.0 ) elif a == 0.0 : NEW_LINE print ( 0.5 ) elif a / 4.0 <= b : NEW_LINE print ( ( a + 8.0 * b ) / 16.0 / b ) else : NEW_LINE print ( 1.0 - b / a ) NEW_LINE DEDENT


# include < iostream > # include < cstdio > # include < cmath >   using namespace std ;   typedef long long ll ;   const int maxn = 300005 ;


for i in range ( int ( input ( ) ) ) : a , b = map ( int , input ( ) . split ( ) ) print ( 0.5 + a / ( b << 4 ) if 4 * b > a else 1 - b / a if a else 1 )


import java . io . IOException ; import java . io . InputStream ; import java . io . OutputStream ; import java . io . PrintWriter ; import java . math . BigInteger ; import java . util . * ;     public class FallingAnvils {   public static void main ( String [ ] args ) {   InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader sc = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; Solver solver = new Solver ( ) ; int t = sc . nextInt ( ) ;


import java . io . * ; import java . util . ArrayList ; import java . util . Collections ; import java . util . StringTokenizer ;

try : n = input ( ) length = len ( n ) ans = ( 1 << length ) - 2 count = 0 for i in range ( length - 1 , - 1 , - 1 ) : if n [ i ] == "7" : ans += ( 1 << count ) count += 1 print ( ans + 1 ) except EOFError as e : print ( " ▁ " ) NEW_LINE


def answer ( n ) : l = len ( str ( n ) ) lst = [ ] mask = 0 NEW_LINE


s = input ( ) n = len ( s ) base = 0 for i in range ( 0 , n ) : base = base + 2 ** inews = " " for c in s : if c == '4' : news = news + '0' else : news = news + '1' news = '0b ' + newsprint ( int ( news , 2 ) + base ) NEW_LINE


s = input ( ) ans = 0 n = len ( s ) for i in range ( 1 , n ) : ans += pow ( 2 , i ) for i in range ( 0 , n ) : if ( s [ i ] == '7' ) : ans += pow ( 2 , n - 1 - i ) print ( ans + 1 ) NEW_LINE


import java . util . * ;   public class Absolutezero { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int size = 0 ; int cop = n ; while ( cop != 0 ) { cop /= 10 ; size ++ ; } if ( size != 1 ) { long h = ( long ) ( 2 * ( Math . pow ( 2 , size - 1 ) - 1 ) ) ; int c1 = 0 ; long g = 0 ; while ( n != 0 ) { int d = n % 10 ; if ( d == 7 ) { g = ( long ) ( g + Math . pow ( 2 , c1 ) ) ; } n /= 10 ; c1 ++ ; }


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


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class Vova_and_Train { static class RealScanner { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( " " ) ;   String next ( ) { while ( ! st . hasMoreTokens ( ) ) try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   int [ ] readArray ( int n ) { int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextInt ( ) ; return a ; }   long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } } public static void main ( String [ ] args ) { RealScanner sc = new RealScanner ( ) ; int n = sc . nextInt ( ) ; while ( n -- > 0 ) { int a , b , c , d ; a = sc . nextInt ( ) ; b = sc . nextInt ( ) ; c = sc . nextInt ( ) ; d = sc . nextInt ( ) ; int divVal = a / b ; int fast = ( c - 1 ) / b ; int preFast = d / b ; System . out . println ( divVal - ( preFast - fast ) ) ;

t = int ( input ( ) ) for _ in range ( 0 , t ) : L , v , l , r = map ( int , input ( ) . split ( ) ) s = l // v + L // v - r // v if ( l % v == 0 ) : s -= 1 print ( s ) NEW_LINE


t = int ( input ( ) ) while t > 0 : t = t - 1 a = list ( map ( int , input ( ) . split ( ) ) ) L = a [ 0 ] v = a [ 1 ] l = a [ 2 ] r = a [ 3 ] ans = int ( 0 ) ans = int ( L / v ) - ( int ( r / v ) - int ( ( l - 1 ) / v ) ) print ( ans ) NEW_LINE


t = int ( input ( ) ) while t >= 1 : t = t - 1 a = list ( map ( int , input ( ) . split ( ) ) ) L = a [ 0 ] v = a [ 1 ] l = a [ 2 ] r = a [ 3 ] ans = int ( 0 ) ans = int ( L / v ) - ( int ( r / v ) - int ( ( l - 1 ) / v ) ) print ( ans ) NEW_LINE


from math import ceilfor _ in range ( int ( input ( ) ) ) : L , v , l , r = map ( int , input ( ) . split ( ) ) c = ceil ( l / v ) - 1 c += ( L // v ) - ceil ( r // v ) print ( c ) NEW_LINE


import sysimport bisectdef gcd ( a , b ) : if ( a == 0 ) : return b return gcd ( b % a , a ) def input ( ) : return sys . stdin . readline ( ) . strip ( ) def iinput ( ) : return int ( input ( ) ) def minput ( ) : return map ( int , input ( ) . split ( ) ) def listinput ( ) : return list ( map ( str , input ( ) . split ( ) ) ) for _ in range ( iinput ( ) ) : L , v , l , r = minput ( ) print ( L // v + ( l - 1 ) // v - r // v ) NEW_LINE


import java . util . * ; import java . math . * ; public class VovaAndTrain { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int runs = sc . nextInt ( ) ; while ( runs -- > 0 ) { long l1 = sc . nextLong ( ) ; long v = sc . nextLong ( ) ; long l2 = sc . nextLong ( ) ; long r = sc . nextLong ( ) ; long first = l1 / v ; long second = ( r / v ) - ( ( l2 - 1 ) / v ) ; System . out . println ( first - second ) ; } } }


import java . util . * ; import java . io . * ; import java . math . BigInteger ; import java . text . * ; public class Main { static long mod = 1000_000_007 ; static long mod1 = 998244353 ; static boolean fileIO = false ; static boolean memory = true ; static FastScanner f ; static PrintWriter pw ; static double eps = ( double ) 1e-6 ; static long oo = ( long ) 1e12 ;   static int get ( int a , int b , int m ) { if ( a % m == 0 ) return ( b / m ) - ( a / m ) + 1 ; return ( b / m ) - ( a / m ) ; }   public static void solve ( ) throws Exception { int l = f . ni ( ) ; int v = f . ni ( ) ; int a = f . ni ( ) ; int b = f . ni ( ) ;   int cnt1 = get ( 1 , l , v ) ; int cnt2 = get ( a , b , v ) ;   int ans = cnt1 - cnt2 ; pn ( ans ) ; } public static void main ( String [ ] args ) throws Exception { if ( memory ) new Thread ( null , new Runnable ( ) { public void run ( ) { try { new Main ( ) . run ( ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; System . exit ( 1 ) ; } } } , " " , 1 << 28 ) . start ( ) ; else new Main ( ) . run ( ) ; } void run ( ) throws Exception { if ( System . getProperty ( " ONLINE _ JUDGE " ) == null ) { f = new FastScanner ( " " ) ; pw = new PrintWriter ( System . out ) ; } else { f = new FastScanner ( ) ; pw = new PrintWriter ( System . out ) ;


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . Scanner ; import java . util . StringTokenizer ;   import static java . lang . Math . max ; import java . util . HashSet ;   public class Test {


h , m = [ int ( x ) for x in input ( ) . split ( ' : ' ) ] a = int ( input ( ) ) hrs = a // 60 h += hrsa = a - ( 60 * hrs ) m += aif m >= 60 : m -= 60 h += 1 t = str ( h % 24 ) . zfill ( 2 ) + ' : ' + str ( m ) . zfill ( 2 ) print ( t ) NEW_LINE


import java . util . Scanner ;   public class Polikarp { public static void main ( String [ ] args ) {   Scanner input = new Scanner ( System . in ) ;   String s = input . next ( ) ; int a = input . nextInt ( ) ; char c = s . charAt ( 0 ) ; char t = s . charAt ( 1 ) ; char g = s . charAt ( 3 ) ; char f = s . charAt ( 4 ) ; String h = c + " " + t ; String v = g + " " + f ; int n = Integer . parseInt ( h ) ; int y = Integer . parseInt ( v ) ; int b = ( ( n * 60 + y + a ) % 1440 ) ;   if ( b / 60 < 10 && b % 60 >= 10 ) { System . out . println ( "0" + b / 60 + " : " + b % 60 ) ; }   if ( b / 60 >= 10 && b % 60 < 10 ) { System . out . println ( b / 60 + " : " + "0" + b % 60 ) ; }   if ( b / 60 >= 10 && b % 60 >= 10 ) { System . out . println ( b / 60 + " : " + b % 60 ) ; }   if ( b / 60 < 10 && b % 60 < 10 ) { System . out . println ( "0" + b / 60 + " : " + "0" + b % 60 ) ; } } }


import java . util . Scanner ;   public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; String m = sc . next ( ) ; int n = sc . nextInt ( ) ;   String input [ ] = m . split ( " : " ) ; int hour = Integer . parseInt ( input [ 0 ] ) ; int min = Integer . parseInt ( input [ 1 ] ) ; hour += n / 60 ; min += n % 60 ;   if ( min >= 60 ) { hour ++ ; min %= 60 ; } hour %= 24 ; String hour1 = String . valueOf ( hour ) ; String min1 = String . valueOf ( min ) ; if ( hour < 10 ) hour1 = "0" + hour1 ; if ( min < 10 ) min1 = "0" + min1 ;   System . out . println ( hour1 + " : " + min1 ) ; } }


import java . util . * ; import java . io . * ; import java . math . BigInteger ; import java . text . * ; public class Main { static long mod = 1000_000_007 ; static long mod1 = 998244353 ; static boolean fileIO = true ; static boolean memory = true ; static FastScanner f ; static PrintWriter pw ; static double eps = ( double ) 1e-6 ; static long oo = ( long ) 1e18 ;   public static void solve ( ) throws Exception { String inp [ ] = f . next ( ) . split ( " : " ) ; int h = Integer . parseInt ( inp [ 0 ] ) ; int m = Integer . parseInt ( inp [ 1 ] ) ;   int a = f . ni ( ) ; for ( int i = 0 ; i < a ; ++ i ) { ++ m ; if ( m == 60 ) { m = 0 ; ++ h ; if ( h == 24 ) h = 0 ; } }    if ( h < 10 ) p ( "0" + h + " : " ) ; else p ( h + " : " ) ;   if ( m < 10 ) p ( "0" + m ) ; else p ( m ) ;    } public static void main ( String [ ] args ) throws Exception { if ( memory ) new Thread ( null , new Runnable ( ) { public void run ( ) { try { new Main ( ) . run ( ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; System . exit ( 1 ) ; } } } , " " , 1 << 28 ) . start ( ) ; else new Main ( ) . run ( ) ; } void run ( ) throws Exception { if ( System . getProperty ( " ONLINE _ JUDGE " ) == null ) { f = new FastScanner ( " " ) ; pw = new PrintWriter ( System . out ) ; } else { f = new FastScanner ( ) ; pw = new PrintWriter ( System . out ) ;


import java . util . * ;   public class CF102 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; int n = sc . nextInt ( ) ; int index = s . indexOf ( " : " ) ; int h = Integer . parseInt ( s . substring ( 0 , index ) ) ; int m = Integer . parseInt ( s . substring ( index + 1 ) ) ; int givenmtoh = n / 60 ; h = ( h + givenmtoh ) % 24 ; int minl = n % 60 ; int fm = ( m + minl ) ; h = ( h + fm / 60 ) % 24 ; m = fm % 60 ; String h1 = h + " " ; String m1 = m + " " ; if ( h >= 0 && h <= 9 ) { h1 = "0" + h1 ; } if ( m >= 0 && m <= 9 ) { m1 = "0" + m1 ; } System . out . println ( h1 + " : " + m1 ) ;      }    public static void minDfs ( boolean [ ] visited , int num , List < List < Integer > > lists ) { visited [ num ] = true ;


import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . OutputStream ; import java . io . PrintWriter ; import java . io . BufferedWriter ; import java . io . Writer ; import java . io . OutputStreamWriter ; import java . util . InputMismatchException ; import java . io . IOException ; import java . io . InputStream ;   public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; OutputWriter out = new OutputWriter ( outputStream ) ; Task_random_1 solver = new Task_random_1 ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }   static class Task_random_1 { public void solve ( int testNumber , InputReader in , OutputWriter out ) {   int x = in . nextInt ( ) , y = in . nextInt ( ) ;

from math import sqrtx , y = list ( map ( int , input ( ) . split ( ) ) ) l = sqrt ( x ** 2 + y ** 2 ) if x * y > 0 : if l % 2 > 1 : print ( ' white ' ) else : print ( ' black ' ) else : if 1 > l % 2 > 0 : print ( ' white ' ) else : print ( ' black ' ) NEW_LINE


def findcolor ( x , p ) : i = 0 while i * i < x * x + p * p : i += 1 l = 0 if ( i * i == x * x + p * p ) or ( x * p >= 0 ) != ( i % 2 == 0 ) : l = 1 print ( " black " ) if l else print ( " white " ) x , p = map ( int , input ( ) . split ( ) ) findcolor ( x , p ) NEW_LINE


from math import sqrt , floorx , y = map ( int , input ( ) . split ( ) ) rmin = floor ( sqrt ( x ** 2 + y ** 2 ) ) if x ** 2 + y ** 2 == rmin ** 2 : print ( " black " ) else : if x >= 0 and y >= 0 or x <= 0 and y <= 0 : print ( " white " if rmin % 2 else " black " ) else : print ( " white " if rmin % 2 == 0 else " black " ) NEW_LINE


import mathimport sys   x , y = map ( int , input ( ) . split ( ) )   is_right = ( x * y >= 0 ) r = ( x ** 2 + y ** 2 ) ** 0.5   if r % 1 == 0 : print ( " black " ) else : if is_right : if r % 2 > 1 : print ( " white " ) else : print ( " black " ) else : if r % 2 > 1 : print ( " black " ) else : print ( " white " )   NEW_LINE


import java . util . * ; import java . lang . * ; import java . math . * ; import java . awt . image . ConvolveOp ; import java . io . * ; import java . text . DecimalFormat ; import java . lang . reflect . Array ; import java . io . BufferedOutputStream ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . math . BigDecimal ; import java . util . * ; public class Codeforces { public static PrintWriter out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ; static long MOD = ( long ) ( 1e9 + 7 ) ; static FastReader sc = new FastReader ( ) ; static int pInf = Integer . MAX_VALUE ; static int nInf = Integer . MIN_VALUE ; public static void main ( String [ ] args ) { int test = 1 ;


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class FindColor {   public static void main ( String [ ] args ) throws IOException { BufferedReader entrada = new BufferedReader ( new InputStreamReader ( System . in ) ) ;   int x , y ;   StringTokenizer linea = new StringTokenizer ( entrada . readLine ( ) ) ; x = Integer . parseInt ( linea . nextToken ( ) ) ; y = Integer . parseInt ( linea . nextToken ( ) ) ; calcColor ( x , y ) ;   }   public static void calcColor ( int x , int y ) { double ratio = calcRatio ( x , y ) , aux = Math . floor ( ratio ) ;


import java . util . * ; public class A1490 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int n = sc . nextInt ( ) ; int ar [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { ar [ i ] = sc . nextInt ( ) ; } int min = 0 , max = 0 , c = 0 ; for ( int i = 0 ; i < n - 1 ; i ++ ) { min = ( int ) Math . min ( ar [ i ] , ar [ i + 1 ] ) ; max = ( int ) Math . max ( ar [ i ] , ar [ i + 1 ] ) ; while ( min * 2 < max ) { c ++ ; if ( max % 2 == 0 ) max = max / 2 ; else max = ( max / 2 ) + 1 ; } } System . out . println ( c ) ; } } }

for s in [ * open ( 0 ) ] [ 2 : : 2 ] : a = * map ( int , s . split ( ) ) , ; print ( sum ( len ( bin ( - 1 - y // - x ) ) - 3 for x , y in map ( sorted , zip ( a , a [ 1 : ] ) ) ) ) NEW_LINE


import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; int [ ] a = new int [ 55 ] ; while ( t -- > 0 ) { int n = sc . nextInt ( ) ; for ( int i = 1 ; i <= n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } int res = 0 ; for ( int i = 2 ; i <= n ; i ++ ) { int max = Math . max ( a [ i ] , a [ i - 1 ] ) ; int min = Math . min ( a [ i ] , a [ i - 1 ] ) ; while ( max / ( min * 1.0 ) > 2 ) { min *= 2 ; res ++ ; } } System . out . println ( res ) ; } } }


import java . util . Scanner ; public class Problem1490A { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int n = sc . nextInt ( ) ; int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } int count = 0 ; for ( int i = 0 ; i < n - 1 ; i ++ ) { int max = Math . max ( a [ i ] , a [ i + 1 ] ) ; int min = Math . min ( a [ i ] , a [ i + 1 ] ) ; while ( max > min * 2 ) { min = min * 2 ; count ++ ; } } System . out . println ( count ) ; } } }


import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int t = s . nextInt ( ) ; for ( int i = 0 ; i < t ; i ++ ) { int n = s . nextInt ( ) ; int [ ] arr = new int [ n ] ; for ( int j = 0 ; j < n ; j ++ ) { arr [ j ] = s . nextInt ( ) ; } int ans = 0 ; for ( int j = 1 ; j < n ; j ++ ) { int max = Math . max ( arr [ j ] , arr [ j - 1 ] ) ; int min = Math . min ( arr [ j ] , arr [ j - 1 ] ) ; min = 2 * min ; while ( min < max ) { min = min * 2 ; ans ++ ; } } System . out . println ( ans ) ; } } }


import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int n = sc . nextInt ( ) ; int last = sc . nextInt ( ) ; int ans = 0 ; for ( int i = 1 ; i < n ; i ++ ) { int nw = sc . nextInt ( ) ; int a = Math . min ( last , nw ) ; int b = Math . max ( last , nw ) ; while ( a * 2 < b ) { ans ++ ; a *= 2 ; } last = nw ; } System . out . println ( ans ) ; } } }


import java . io . * ; import java . util . * ; import java . math . * ;   public class B { static int cc = 1 ;   public static void main ( String [ ] args ) throws IOException { FastScanner fs = new FastScanner ( ) ; PrintWriter out = new PrintWriter ( System . out ) ;

''' Jana ▁ Goodman6 7B ▁ Memory ▁ Manager  ''' import re   SPACE = ' ▁ ' ALLOC = ' alloc ' ERASE = ' erase ' DEFRAG = ' defragment ' ALLOC_ERR = ' NULL ' ERASE_ERR = ' ILLEGAL _ ERASE _ ARGUMENT ' FREE = 0   class Memory : def __init__ ( self , size ) : self . size = size self . next_id = 0 self . bytes = [ FREE ] * size   def is_free ( self , block ) : return all ( byte == FREE for byte in block )   def is_allocated ( self , id ) : return id in self . bytes   def free_block ( self , n ) : block_len , start = None , None for i , byte in enumerate ( self . bytes ) : if byte == FREE : if block_len is None : start = i block_len = 1 else : block_len += 1 if block_len == n : return start else : block_len = None return None   def fill ( self , start , n , x ) : if start == 78 and start + n == 90 : debug = 1 for i in range ( start , start + n ) : self . bytes [ i ] = x   def alloc ( self , n ) : start = self . free_block ( n ) if start is None : print ( ALLOC_ERR ) else : self . next_id += 1 self . fill ( start , n , self . next_id ) print ( self . next_id )   def erase ( self , x ) : if x == 0 : print ( ERASE_ERR ) elif self . is_allocated ( x ) : self . fill ( self . bytes . index ( x ) , self . bytes . count ( x ) , FREE ) else : print ( ERASE_ERR )   def defragment ( self ) : new_bytes = list ( ) if FREE in self . bytes : n = 0 for byte in self . bytes : if byte > FREE : new_bytes . append ( byte ) n += 1 new_bytes += [ FREE ] * ( self . size - len ( new_bytes ) ) self . bytes = [ _ for _ in new_bytes ]   NEW_LINE


commands , bytes = map ( int , input ( ) . split ( ) ) s = [ 0 ] * bytesc = 0   for i in range ( commands ) : op = input ( ) . split ( ) if op [ 0 ] == ' alloc ' : NEW_LINE


import reclass Memory : def __init__ ( self , bytes ) : self . memory = [ 0 for x in range ( bytes ) ] self . identifier = 1 def out ( self ) : print ( self . memory ) def alloc ( self , bytes ) : avail = False for i in range ( len ( self . memory ) - ( bytes - 1 ) ) : if max ( self . memory [ i : i + bytes ] ) == 0 : print ( self . identifier ) for j in range ( i , i + bytes ) : self . memory [ j ] = self . identifier self . identifier += 1 avail = True if avail : break if not avail : print ( " NULL " ) def erase ( self , x ) : if x in self . memory and x != 0 : for i in range ( self . memory . count ( x ) ) : self . memory [ self . memory . index ( x ) ] = 0 else : print ( " ILLEGAL _ ERASE _ ARGUMENT " ) def defrag ( self ) : zeroCount = self . memory . count ( 0 ) for i in range ( zeroCount ) : self . memory . remove ( 0 ) self . memory . append ( 0 )     t , m = map ( int , input ( ) . split ( ) ) memory = Memory ( m ) for i in range ( t ) : operation = input ( ) if operation . startswith ( " alloc " ) : aN = re . findall ( r ' \b\d + \b ' , operation ) memory . alloc ( int ( aN [ 0 ] ) ) elif operation . startswith ( " erase " ) : aE = re . findall ( r ' \b\d + \b ' , operation ) memory . erase ( int ( aE [ 0 ] ) ) else : memory . defrag ( ) NEW_LINE


import java . io . * ; import java . util . * ; public class Ishu { static Scanner scan = new Scanner ( System . in ) ; static int block = 0 ; static int [ ] meme = new int [ 1 ] ; static void alloc ( ) { int m = meme . length ; int n = scan . nextInt ( ) ; int i ; int ctr = 0 ; boolean exist = false ; for ( i = 0 ; i < m ; ++ i ) { if ( meme [ i ] == 0 ) ++ ctr ; else ctr = 0 ; if ( ctr == n ) { exist = true ; break ; } } if ( ! exist ) System . out . println ( " NULL " ) ; else { ++ block ; ctr = i - n + 1 ; for ( i = 0 ; i < n ; ++ i ) meme [ ctr + i ] = block ; System . out . println ( block ) ; } } static void erase ( ) { int m = meme . length ; int x = scan . nextInt ( ) ; boolean exist = false ; int i ; for ( i = 0 ; i < m ; ++ i ) if ( meme [ i ] == x && meme [ i ] > 0 ) { exist = true ; meme [ i ] = 0 ; } if ( ! exist ) System . out . println ( " ILLEGAL _ ERASE _ ARGUMENT " ) ; } static void defragment ( ) { int m = meme . length ; int i = 0 , j = 0 ; for ( i = 0 ; i < m ; ++ i ) if ( meme [ i ] > 0 ) { int data = meme [ i ] ; meme [ i ] = 0 ; meme [ j ++ ] = data ; } } static void tc ( ) { int t , m ; t = scan . nextInt ( ) ; m = scan . nextInt ( ) ; meme = new int [ m ] ; while ( t -- > 0 ) { String query = scan . next ( ) ; if ( query . equals ( " alloc " ) ) alloc ( ) ; else if ( query . equals ( " erase " ) ) erase ( ) ; else defragment ( ) ; } } public static void main ( String [ ] args ) { int t = 1 ;


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . LinkedList ; import java . util . StringTokenizer ;   public class CF7B { public static void main ( String [ ] args ) throws IOException { solve ( ) ; }   private static void solve ( ) throws IOException { int n = IN . nextInt ( ) , max = IN . nextInt ( ) - 1 ; LinkedList < int [ ] > list = new LinkedList < > ( ) ;


import java . util . * ;   public class Solution { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int t = s . nextInt ( ) ; int m = s . nextInt ( ) ; int [ ] memory = new int [ m ] ; int allocIdx = 0 ;   for ( int j = 0 ; j < t ; j ++ ) { switch ( s . next ( ) ) { case " alloc " : int n = s . nextInt ( ) ; int len = 0 ; boolean canAlloc = false ; for ( int i = 0 ; i < m ; i ++ ) { if ( memory [ i ] == 0 ) len ++ ; else len = 0 ; if ( len == n ) { canAlloc = true ; len = i - n + 1 ; break ; } } if ( canAlloc ) { allocIdx ++ ; for ( int i = len ; i < len + n ; i ++ ) memory [ i ] = allocIdx ; System . out . println ( allocIdx ) ; } else System . out . println ( " NULL " ) ; break ; case " erase " : int x = s . nextInt ( ) ; if ( x <= 0 ) { System . out . println ( " ILLEGAL _ ERASE _ ARGUMENT " ) ; break ; } boolean hasErased = false ; for ( int i = 0 ; i < m ; i ++ ) { if ( memory [ i ] == x ) { memory [ i ] = 0 ; hasErased = true ; } } if ( ! hasErased ) System . out . println ( " ILLEGAL _ ERASE _ ARGUMENT " ) ; break ; case " defragment " : int d = 0 ;


import java . util . * ; import java . io . * ; import java . text . DecimalFormat ;    public class hiking {    static DecimalFormat df1 = new DecimalFormat ( " # .000000" ) ; static DecimalFormat df = new DecimalFormat ( " # . # # # # # # " ) ; static boolean printing = false ;   static int N ;   static long total = 0L ; static int ret = 0 ;   public static void main ( String [ ] args ) throws Exception { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ;

n = int ( input ( ) ) NEW_LINE array = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE leftToRight = [ 0 for i in range ( n ) ] NEW_LINE rightToLeft = [ 0 for i in range ( n ) ]   for i in range ( 1 , n ) : if NEW_LINE array [ i - 1 ] < array [ i ] : leftToRight [ i ] = leftToRight [ i - 1 ] + 1   for i in range ( n - 2 , - 1 , - 1 ) : if NEW_LINE array [ i + 1 ] < array [ i ] : rightToLeft [ i ] = rightToLeft [ i + 1 ] + 1   maxVal = max ( max ( leftToRight ) , max ( rightToLeft ) ) NEW_LINE maxCount = 0 NEW_LINE maxOnSameIdx = 0 NEW_LINE for i in range ( n ) : if NEW_LINE leftToRight [ i ] == maxVal : maxCount += 1 NEW_LINE if rightToLeft [ i ] == maxVal : maxCount += 1 NEW_LINE if leftToRight [ i ] == maxVal and rightToLeft [ i ] == maxVal : maxOnSameIdx += 1   if maxCount == 2 and maxOnSameIdx == 1 and maxVal % 2 == 0 : NEW_LINE INDENT print ( 1 ) else : NEW_LINE print ( 0 )   NEW_LINE DEDENT


import arrayimport NEW_LINE collectionsfrom NEW_LINE collections NEW_LINE import defaultdictimport NEW_LINE math   mxN = 2e5 + 10 NEW_LINE n = int ( input ( ) ) NEW_LINE a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE Rs = [ 0 ] * ( n + 10 ) NEW_LINE Ls = [ 0 ] * ( n + 10 ) NEW_LINE for i in range ( 1 , n ) : if NEW_LINE a [ i ] > a [ i - 1 ] : Ls [ i ] = Ls [ i - 1 ] + 1 NEW_LINE for i in range ( n - 2 , - 1 , - 1 ) : if NEW_LINE a [ i + 1 ] < a [ i ] : Rs [ i ] = Rs [ i + 1 ] + 1 NEW_LINE mx = max ( * Rs , * Ls ) NEW_LINE c = 0 NEW_LINE for i in range ( 0 , n ) : if NEW_LINE mx == Rs [ i ] : c += 1 NEW_LINE if mx == Ls [ i ] : c += 1 NEW_LINE


import sysimport NEW_LINE mathfrom NEW_LINE math NEW_LINE import factorial , inf , gcdfrom NEW_LINE heapq NEW_LINE import * from functools NEW_LINE import * from itertools NEW_LINE import * from collections NEW_LINE import * from typing NEW_LINE import NEW_LINE * sys . setrecursionlimit ( 10 ** 5 ) NEW_LINE


import java . util . * ;   import javax . swing . RowFilter . Entry ; import javax . swing . text . AbstractDocument . BranchElement ; import javax . swing . text . html . parser . Entity ;   import java . io . * ;   public class C { static PrintWriter pw ; static BufferedReader br ; static int inf = ( int ) 1e9 ; static long mod = ( long ) 1e9 + 7 ; static int [ ] [ ] memo ; static boolean [ ] vis ; static boolean [ ] [ ] ok ; static int [ ] a ; static int n , m ; static ArrayList < Integer > [ ] adj ; static ArrayList < Integer > primes ; static int [ ] isComposite ;   static void sieve ( int N )

n , m = map ( int , input ( ) . split ( ) ) a , d = [ 1e9 ] , [ 1e9 ] for x in range ( n ) : p , s = input ( ) . split ( ) [ d , a ] [ p < ' B ' ] . append ( int ( s ) ) v = [ int ( input ( ) ) for y in range ( m ) ] for q in [ a , d , v ] : q . sort ( ) s = sum ( v ) i = j = 0 for t in v : if t > d [ i ] : s , i = s - t , i + 1 elif t >= a [ j ] : s , j = s - a [ j ] , j + 1 if i + j - n : s = 0 print ( max ( s , sum ( max ( 0 , y - x ) for x , y in zip ( a , v [ : : - 1 ] ) ) ) ) NEW_LINE


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


import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; for ( int t = sc . nextInt ( ) ; t -- > 0 ; ) { int n = sc . nextInt ( ) , a [ ] = new int [ n ] ; boolean x = true , y = false , z = y ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; if ( i > 0 && a [ i - 1 ] > a [ i ] ) x = false ; } for ( int i = 0 ; i < n ; i ++ ) if ( sc . nextInt ( ) > 0 ) y = true ; else z = true ; System . out . println ( ( x || ( y && z ) ) ? " Yes " : " No " ) ; } } }

from copy import deepcopyfor _ in range ( int ( input ( ) ) ) : a = int ( input ( ) ) l3 = [ ] l1 = list ( map ( int , input ( ) . split ( ) ) ) l2 = list ( map ( int , input ( ) . split ( ) ) ) l = deepcopy ( l1 ) l . sort ( ) if l1 == l : print ( ' Yes ' ) elif l2 . count ( 0 ) == a or l2 . count ( 1 ) == a : print ( ' No ' ) else : print ( ' Yes ' )   NEW_LINE


from collections import * from itertools import * from string import * from bisect import * from queue import * from heapq import * from math import * from sys import * from re import * def fast ( ) : return stdin . readline ( ) . strip ( ) def zzz ( ) : return [ int ( i ) for i in fast ( ) . split ( ) ]     z , zz = input , lambda : list ( map ( int , z ( ) . split ( ) ) ) szz , graph , mod , szzz = lambda : sorted ( zz ( ) ) , { } , 10 ** 9 + 7 , lambda : sorted ( zzz ( ) )     def lcd ( xnum1 , xnum2 ) : return ( xnum1 * xnum2 // gcd ( xnum1 , xnum2 ) ) def output ( answer ) : stdout . write ( str ( answer ) )     dx = [ - 1 , 1 , 0 , 0 , 1 , - 1 , 1 , - 1 ] dy = [ 0 , 0 , 1 , - 1 , 1 , - 1 , - 1 , 1 ]   NEW_LINE


t = int ( input ( ) ) for _ in range ( t ) : n = int ( input ( ) ) li = list ( map ( int , input ( ) . split ( " ▁ " ) ) ) indexes = list ( map ( int , input ( ) . split ( " ▁ " ) ) )   if 0 in indexes and 1 in indexes : print ( " YES " ) else : if list ( sorted ( li ) ) == li : print ( " YES " ) else : print ( " NO " )     NEW_LINE


t = int ( input ( ) ) for _ in range ( t ) : n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) b = list ( map ( int , input ( ) . split ( ) ) ) if a == sorted ( a ) : print ( " YES " ) continue if b . count ( 1 ) > 0 and b . count ( 0 ) > 0 : print ( ' YES ' ) else : print ( ' NO ' ) NEW_LINE


def answer ( n , a , b ) : if b . count ( 0 ) >= 1 and b . count ( 1 ) >= 1 : return ' Yes ' a_s = sorted ( a ) if a_s == a : return ' Yes '           return ' No '   def main ( ) : t = int ( input ( ) ) while t : n = int ( input ( ) ) a = [ int ( i ) for i in input ( ) . split ( ) ] b = [ int ( i ) for i in input ( ) . split ( ) ] print ( answer ( n , a , b ) ) t -= 1 returnmain ( ) NEW_LINE


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


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


import java . util . * ;   public class Main { public static boolean IsSorted ( int [ ] a , int n ) { if ( n == 0 || n == 1 ) return true ; else if ( a [ n - 1 ] < a [ n - 2 ] ) return false ; else return IsSorted ( a , n - 1 ) ; } public static boolean IsQ ( int [ ] b , int n ) { for ( int i = n - 1 ; i > 0 ; i -- ) if ( b [ 0 ] != b [ i ] ) return false ; return true ; } public static Scanner ayat = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int t = ayat . nextInt ( ) ; int [ ] a = new int [ 1000000 ] ; int [ ] b = new int [ 1000000 ] ; while ( t > 0 ) { int n = ayat . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = ayat . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) b [ i ] = ayat . nextInt ( ) ; if ( IsSorted ( a , n ) ) System . out . println ( " YES " ) ; else if ( IsQ ( b , n ) ) System . out . println ( " NO " ) ; else System . out . println ( " YES " ) ; t -- ; } } }


import java . util . * ; public class Arena { public static void main ( String args [ ] ) { Scanner e = new Scanner ( System . in ) ; int t = e . nextInt ( ) ; while ( t > 0 ) { int n = e . nextInt ( ) ; int a [ ] = new int [ n ] ; int x = 100 ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = e . nextInt ( ) ; if ( a [ i ] < x ) x = a [ i ] ; } int b = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] > x ) b ++ ; } System . out . println ( b ) ; t -- ; } } }

for s in [ * open ( 0 ) ] [ 2 : : 2 ] : a = * map ( int , s . split ( ) ) , ; print ( len ( a ) - a . count ( min ( a ) ) ) NEW_LINE


for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) ; a = [ int ( i ) for i in input ( ) . split ( ) ] ; print ( n - a . count ( min ( a ) ) ) NEW_LINE


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


import java . util . * ; public class A1487 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int n = sc . nextInt ( ) ; int ar [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { ar [ i ] = sc . nextInt ( ) ; } Arrays . sort ( ar ) ; int k = ar [ 0 ] ; int c = 1 ; for ( int i = 1 ; i < n ; i ++ ) { if ( ar [ i ] == k ) c ++ ; else break ; } System . out . println ( n - c ) ; } } }


import java . util . * ; public class Solution { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int n = sc . nextInt ( ) ; int A [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) A [ i ] = sc . nextInt ( ) ; int min = Arrays . stream ( A ) . min ( ) . getAsInt ( ) ; int cnt = 0 ; for ( int x : A ) { if ( x > min ) cnt ++ ; } System . out . println ( cnt ) ; } sc . close ( ) ; } }


import java . lang . * ; import java . util . * ; import java . util . stream . Collectors ; import java . io . * ;   public class absolute { static int [ ] I = new int [ ] { 0 , - 1 , 0 , 1 } ; static int [ ] J = new int [ ] { - 1 , 0 , 1 , 0 } ; static int [ ] [ ] mat ; public static void main ( String [ ] args ) {

for _ in range ( int ( input ( ) ) ) : n , m = map ( int , input ( ) . split ( ) ) g = [ ] for _ in range ( n ) : g . append ( list ( map ( int , input ( ) . split ( ) ) ) ) f = 0 for i in range ( n ) : for j in range ( m ) : maxx = 4 if j in ( 0 , m - 1 ) : maxx -= 1 if i in ( 0 , n - 1 ) : maxx -= 1 if g [ i ] [ j ] > maxx : print ( " NO " ) f = 1 break if f : break if not f : print ( " YES " ) for i in range ( n ) : for j in range ( m ) : maxx = 4 if j in ( 0 , m - 1 ) : maxx -= 1 if i in ( 0 , n - 1 ) : maxx -= 1 print ( maxx , end = ' ▁ ' ) print ( ) NEW_LINE


for _ in range ( int ( input ( ) ) ) : m , n = map ( int , input ( ) . split ( ) ) l = [ [ int ( i ) for i in input ( ) . split ( ) ] for k in range ( m ) ] f = 0 for i in range ( m ) : for j in range ( n ) : ct = 0 if i - 1 >= 0 : ct += 1 if i + 1 < m : ct += 1 if j - 1 >= 0 : ct += 1 if j + 1 < n : ct += 1 if l [ i ] [ j ] > ct : f = 1 break else : l [ i ] [ j ] = ct if f == 1 : break if f == 1 : print ( ' NO ' ) else : print ( ' YES ' ) for i in l : print ( * i ) NEW_LINE


from collections import dequeimport sysinf = float ( ' inf ' ) input = sys . stdin . readline """ n ▁ = ▁ int ( input ( ) ) n , k ▁ = ▁ map ( int , input ( ) . split ( ) ) arr ▁ = ▁ list ( map ( int , input ( ) . split ( ) ) ) """   for _ in range ( int ( input ( ) ) ) : Row , Col = map ( int , input ( ) . split ( ) ) matt = [ ] for i in range ( Row ) : matt . append ( list ( map ( int , input ( ) . split ( ) ) ) ) flag = True for row in range ( Row ) : for col in range ( Col ) : if ( row == 0 or row == Row - 1 ) and ( col == 0 or col == Col - 1 ) : if matt [ row ] [ col ] > 2 : flag = False elif ( row == 0 or row == Row - 1 ) or ( col == 0 or col == Col - 1 ) : if matt [ row ] [ col ] > 3 : flag = False else : if matt [ row ] [ col ] > 4 : flag = False   if not flag : print ( ' NO ' ) else : print ( ' YES ' ) for row in range ( Row ) : for col in range ( Col ) : if ( row == 0 or row == Row - 1 ) and ( col == 0 or col == Col - 1 ) : matt [ row ] [ col ] = 2 elif ( row == 0 or row == Row - 1 ) or ( col == 0 or col == Col - 1 ) : matt [ row ] [ col ] = 3 else : matt [ row ] [ col ] = 4 for i in matt : print ( * i ) NEW_LINE


import sysimport mathfrom math import factorial , inf , gcdfrom heapq import * from functools import * from itertools import * from collections import * from typing import * sys . setrecursionlimit ( 10 ** 5 ) NEW_LINE


import sys   def answer ( n , m , a ) : NEW_LINE


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


import java . io . BufferedReader ; import java . io . File ; import java . io . FileWriter ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . math . BigInteger ; import java . util . * ;   public class Main { public static long GCD ( long n1 , long n2 ) { if ( n1 == 0 ) { return n2 ; } return GCD ( n2 % n1 , n1 ) ; }   public static void main ( String [ ] args ) { FastScanner input = new FastScanner ( ) ; int n = input . nextInt ( ) ; long sum = 0 ; for ( int i = 2 ; i < n ; i ++ ) { int temp = n ; while ( temp != 0 ) { sum += temp % i ; temp /= i ; } } long gc = GCD ( sum , n - 2 ) ; System . out . println ( ( sum / gc ) + " / " + ( ( n - 2 ) / gc ) ) ;    }   static class FastScanner {   BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( " " ) ;   String next ( ) { while ( ! st . hasMoreTokens ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   long nextLong ( ) {   return Long . parseLong ( next ( ) ) ; }   double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } }   }

from math import gcd   def base ( n , b ) : c = 0 while n : c += n % b n //= b return c       n = int ( input ( ) ) x = 0   for i in range ( 2 , int ( n ) ) : x += base ( int ( n ) , i )     n -= 2 hcf = gcd ( x , n )     x //= hcfn //= hcfprint ( f " { x } / { n } " )   NEW_LINE


from math import gcdn , s = int ( input ( ) ) , 0 for i in range ( 2 , n ) : k = n while k != 0 : s += k % i k //= ip = gcd ( s , n - 2 ) print ( f ' { s / / p } / { ( n - 2 ) / / p } ' ) NEW_LINE


from math import gcd   n = int ( input ( ) ) s = 0 for i in range ( 2 , n ) : copy = n while copy > 0 : s += copy % i copy //= i   a = sb = n - 2 g = gcd ( a , b ) print ( f " { a ▁ / / ▁ g } / { b ▁ / / ▁ g } " ) NEW_LINE


a = int ( input ( ) ) s = 0 for i in range ( 2 , a ) : x = a while x : s += x % i x //= ib = a - 2 for i in range ( 2 , 1001 ) : while s % i == 0 and b % i == 0 : s //= i b //= iprint ( s , ' / ' , b , sep = ' ' ) NEW_LINE


import java . util . * ; import java . lang . Math . * ; import java . io . * ;   public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; long sum = 0 ; int d = 0 ; int b = a ; for ( int i = 2 ; i < b ; i ++ ) { int x = 0 ; while ( a != 0 ) { x = x + a % i ; a = a / i ; } sum = sum + x ; a = b ; d ++ ; } for ( int j = 2 ; j < d ; j ++ ) { if ( ( sum % j == 0 ) && ( d % j == 0 ) ) { sum = sum / j ; d = d / j ; j -- ; } } System . out . println ( sum + " / " + d ) ; } }


import java . util . Scanner ;   public class Main {   public static int getGcd ( int num1 , int num2 ) { if ( num2 == 0 ) { return num1 ; } else { return getGcd ( num2 , num1 % num2 ) ; } }   public static int sumsOfDigits ( int num ) { int result = 0 ; for ( int i = 2 ; i < num ; i ++ ) { int tmp = num ; while ( tmp != 0 ) { result += tmp % i ; tmp = tmp / i ; } }   return result ; }   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ;   int num = in . nextInt ( ) ;   int result = sumsOfDigits ( num ) ;   int divisor = num - 2 ;   int gcd = getGcd ( result , divisor ) ;   System . out . println ( ( result / gcd ) + " / " + ( divisor / gcd ) ) ;   in . close ( ) ; } }


import java . util . * ; import java . io . * ; import java . math . BigInteger ; import java . text . * ; public class Main { static long mod = 1000_000_007 ; static long mod1 = 998244353 ; static boolean fileIO = true ; static boolean memory = true ; static FastScanner f ; static PrintWriter pw ; static double eps = ( double ) 1e-6 ; static int oo = ( int ) 2e9 ;

arr = [ int ( x ) for x in input ( ) . split ( ) ] n , k = arr [ 0 ] , arr [ 1 ] if ( k < n // 2 ) : print ( - 1 ) elif ( n == 1 ) : if ( k > 0 ) : print ( - 1 ) else : print ( 1 ) else : ans = [ ] if ( n % 2 == 0 ) : temp = n // 2 temp -= 1 k -= temp i = 1 print ( k , 2 * k , end = " ▁ " ) while ( temp > 0 ) : if ( i != k and i != 2 * k and i + 1 != k and i + 1 != 2 * k ) : print ( i , i + 1 , end = " ▁ " ) temp -= 1 i += 2 else : temp = n // 2 temp -= 1 k -= temp i = 1 print ( k , 2 * k , end = " ▁ " ) while ( temp > 0 ) : if ( i != k and i != 2 * k and i + 1 != k and i + 1 != 2 * k ) : print ( i , i + 1 , end = " ▁ " ) temp -= 1 i += 2 print ( i + 17 ) NEW_LINE


n , k = map ( int , input ( ) . split ( ) ) a = n // 2 z = k - a + 1 ans = [ 10 ** 9 - i for i in range ( 1 , n + 1 ) ]   if z == 1 : print ( * ans ) elif z < 1 or n == 1 : print ( - 1 ) else : if n == 1 : print ( 99 ) else : ans [ 0 ] , ans [ 1 ] = z , z * 2 print ( * ans ) NEW_LINE


n , m = map ( int , input ( ) . split ( ) )   if m < n // 2 and n != 1 or ( n == 1 and m >= n ) : print ( - 1 )   else : if m : k = ( n - 2 ) // 2 print ( ( m - k ) , end = " ▁ " ) print ( ( m - k ) * 2 , end = " ▁ " ) n -= 2 c = ( m - k ) * 2 + 1   if n != 1 : for i in range ( c , c + n ) : print ( i , end = " ▁ " ) else : print ( 1 )   NEW_LINE


import java . util . * ; public class _240_A_Mashmokh_and_numbers { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int pairs = n / 2 ; if ( n == 1 ) { if ( k == 0 ) System . out . println ( 1 ) ; else System . out . println ( - 1 ) ; System . exit ( 0 ) ; } if ( k < pairs ) { System . out . println ( - 1 ) ; System . exit ( 0 ) ; } HashSet < Integer > hset = new HashSet < > ( ) ; int t = k - pairs + 1 ; System . out . print ( t + " ▁ " + ( 2 * t ) + " ▁ " ) ; hset . add ( t ) ; hset . add ( t * 2 ) ; int j = 1 ; if ( hset . contains ( j ) || hset . contains ( 1 + j ) ) j = j + 2 ; for ( int i = 1 ; i < pairs ; i ++ ) { while ( hset . contains ( j ) || hset . contains ( j + 1 ) ) j ++ ; System . out . print ( j + " ▁ " + ( 1 + j ) + " ▁ " ) ; hset . add ( j ) ; hset . add ( j + 1 ) ; } if ( pairs * 2 != n ) { while ( hset . contains ( j ) ) j ++ ; System . out . print ( j ) ; } } }


import java . io . * ; import java . math . BigDecimal ; import java . math . BigInteger ; import java . math . RoundingMode ; import java . util . * ; import java . util . concurrent . LinkedBlockingDeque ;   import java . util . ArrayList ; import java . util . HashMap ; import java . util . LinkedList ;

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


n , m = map ( int , input ( ) . split ( ) ) l = [ ] for i in range ( n ) : l . append ( " " . join ( list ( map ( str , input ( ) . split ( ) ) ) ) ) while not n % 2 : if l [ : n // 2 ] != l [ n // 2 : n ] [ : : - 1 ] : break n //= 2 print ( n ) NEW_LINE


n , m = map ( int , input ( ) . split ( ) ) l = [ ] for i in range ( n ) : l . append ( " " . join ( list ( map ( str , input ( ) . split ( ) ) ) ) ) while not n % 2 and l [ : n // 2 ] == l [ n // 2 : n ] [ : : - 1 ] : n //= 2 print ( n ) NEW_LINE


n , m = map ( int , input ( ) . split ( ) ) l = [ ] for i in range ( n ) : l . append ( list ( map ( str , input ( ) . split ( ) ) ) ) while not n % 2 and l [ : n // 2 ] == l [ n // 2 : n ] [ : : - 1 ] : n //= 2 print ( n ) NEW_LINE


from math import log row , col = map ( int , input ( ) . split ( " ▁ " ) ) if row % 2 == 1 : print ( row ) else : matrix = [ ] for _ in range ( row ) : matrix . append ( input ( ) . split ( " ▁ " ) ) minimum = row for _ in range ( int ( log ( row , 2 ) ) ) : if matrix [ 0 : minimum // 2 ] == matrix [ minimum - 1 : minimum // 2 - 1 : - 1 ] : minimum //= 2 else : break print ( minimum ) NEW_LINE


import java . io . * ; import java . util . * ;    public class CodeForce { static BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; static StringBuilder sb = new StringBuilder ( ) ;   public static int checkreverse ( int [ ] [ ] arr , int n ) { if ( n % 2 == 1 ) return n ; for ( int i = n / 2 - 1 ; i >= 0 ; i -- ) { for ( int j = 0 ; j < arr [ 0 ] . length ; j ++ ) { if ( arr [ i ] [ j ] != arr [ n - i - 1 ] [ j ] ) return n ; } }   return checkreverse ( arr , n / 2 ) ;   }   static boolean flag = false ; static int next ( String [ ] sr , int ind ) { return Integer . parseInt ( sr [ ind ] ) ; }   public static void main ( String [ ] args ) throws IOException {   String [ ] sr = br . readLine ( ) . split ( " ▁ " ) ;   int n = next ( sr , 0 ) ; int m = next ( sr , 1 ) ; int [ ] [ ] arr = new int [ n ] [ m ] ; for ( int i = 0 ; i < n ; i ++ ) { sr = br . readLine ( ) . split ( " ▁ " ) ; for ( int j = 0 ; j < m ; j ++ ) arr [ i ] [ j ] = next ( sr , j ) ; }   System . out . println ( checkreverse ( arr , n ) ) ;    } }


import java . io . * ; import java . util . * ;   public class Main { public static void main ( String [ ] args ) throws InterruptedException { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; MyScanner in = new MyScanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; solve ( in , out ) ; out . close ( ) ; }   static void solve ( MyScanner in , PrintWriter out ) { int n , m ; n = in . nextInt ( ) ; m = in . nextInt ( ) ; int [ ] [ ] mt = new int [ n ] [ m ] ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { mt [ i ] [ j ] = in . nextInt ( ) ; } } int ans = n ; while ( ans % 2 == 0 && isSym ( mt , ans ) ) { ans /= 2 ; } out . println ( ans ) ; }   static boolean isSym ( int [ ] [ ] mt , int len ) { int up = len / 2 - 1 ; int down = len / 2 ; int m = mt [ 0 ] . length ; while ( up >= 0 ) { for ( int i = 0 ; i < m ; i ++ ) { if ( mt [ up ] [ i ] != mt [ down ] [ i ] ) { return false ; } } up -- ; down ++ ; } return true ; }   static class MyScanner { BufferedReader br ; StringTokenizer st ;   public MyScanner ( InputStream io ) { br = new BufferedReader ( new InputStreamReader ( io ) ) ; }   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 ( ) ) ; } } }


import java . util . * ; public class chess { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String s = sc . next ( ) ; int c = 0 , d = 0 ; for ( int i = 0 ; i < n ; i ++ ) { char x = s . charAt ( i ) ; if ( x == ' D ' ) d ++ ; else c ++ ; } if ( c > d ) System . out . println ( " Anton " ) ; else if ( c < d ) System . out . println ( " Danik " ) ; else System . out . println ( " Friendship " ) ; } }

n = input ( ' ' ) x = input ( ' ' ) a = x . count ( ' A ' ) d = x . count ( ' D ' ) if a > d : print ( ' Anton ' ) elif d > a : print ( ' Danik ' ) else : print ( ' Friendship ' ) NEW_LINE


n = int ( input ( ) ) s = input ( ) if s . count ( ' A ' ) > s . count ( ' D ' ) : print ( " Anton " ) elif s . count ( ' D ' ) > s . count ( ' A ' ) : print ( " Danik " ) else : print ( " Friendship " ) NEW_LINE


n = input ( ) l = list ( input ( ) ) an = l . count ( ' A ' ) dn = l . count ( ' D ' ) if ( an > dn ) : print ( " Anton " ) elif ( dn > an ) : print ( " Danik " ) else : print ( " Friendship " ) NEW_LINE


n = int ( input ( ) ) s = input ( ) a = len ( s ) c = 0 d = 0 for i in range ( a ) : if ( s [ i ] == ' A ' ) : c = c + 1 elif ( s [ i ] == ' D ' ) : d = d + 1 if ( c > d ) : print ( " Anton " ) elif ( d > c ) : print ( " Danik " ) elif ( c == d ) : print ( " Friendship " ) NEW_LINE


import java . util . * ;   public class test { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String test = scanner . nextLine ( ) ; String str = scanner . nextLine ( ) ; int test1 = Integer . parseInt ( test ) ; int a = 0 ; int d = 0 ;   for ( int i = 0 ; i < test1 ; i ++ ) { char ch = str . charAt ( i ) ; if ( ch == ' A ' ) { a ++ ; } else d ++ ; } if ( a > d ) { System . out . println ( " Anton " ) ; } else if ( d > a ) { System . out . println ( " Danik " ) ; } else System . out . println ( " Friendship " ) ; }   }


import java . util . Scanner ;   public class AntonAndDanik { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int t = scanner . nextInt ( ) ; String b = scanner . next ( ) ;   int anton = 0 ; int danik = 0 ;   for ( int i = 0 ; i < b . length ( ) ; i ++ ) { if ( b . charAt ( i ) == ' A ' ) { anton ++ ; } else { danik ++ ; } } if ( anton > danik ) { System . out . println ( " Anton " ) ; } else if ( danik > anton ) { System . out . println ( " Danik " ) ; } else System . out . println ( " Friendship " ) ;    } }


import java . util . Scanner ;   public class AntonAndDanik { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String num = scanner . nextLine ( ) ; String str = scanner . nextLine ( ) ; System . out . println ( solve ( str ) ) ; }   public static String solve ( String str ) { int anton = 0 ; int danik = 0 ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) { if ( str . charAt ( i ) == ' A ' ) { anton ++ ; } else if ( str . charAt ( i ) == ' D ' ) { danik ++ ; } } if ( anton > danik ) { return " Anton " ; } else if ( danik > anton ) { return " Danik " ; } return " Friendship " ; } }


import java . util . Scanner ;   public class Main {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int l = in . nextInt ( ) ; int d = 0 , a = 0 ; String s = in . next ( ) ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { char c = s . charAt ( i ) ; if ( c == ' A ' ) { a ++ ; } else { d ++ ; } } if ( a > d ) { System . out . println ( " Anton " ) ; } else if ( a < d ) { System . out . println ( " Danik " ) ; } else { System . out . println ( " Friendship " ) ; } }   }


import java . util . * ;   public class Tell_Your_World { static final double E = 0.0000001 ;   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ;   int n = sc . nextInt ( ) ; int [ ] arr = new int [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) arr [ i ] = sc . nextInt ( ) ;   boolean thereIsAnswer = false ; outer : for ( int i = 1 ; i < 4 ; i ++ ) { for ( int j = i ; j < 4 ; j ++ ) { if ( j == i ) continue ;   line src = new line ( i , arr [ i ] , j , arr [ j ] ) ; for ( int k = 1 ; k <= n ; k ++ ) {   line other = src . getParallel ( k , arr [ k ] ) ;    for ( int l = 1 ; l <= n && ! other . identical ( src ) ; l ++ ) { if ( ( src . passThroughPoint ( l , arr [ l ] ) || other . passThroughPoint ( l , arr [ l ] ) ) ) { thereIsAnswer = true ; } else { thereIsAnswer = false ; break ;   } } if ( thereIsAnswer && ! other . identical ( src ) ) break outer ;   }    } } System . out . println ( thereIsAnswer ? " YES " : " NO " ) ;    }   public static int gcd ( int a , int b ) { return b == 0 ? a : gcd ( b , a % b ) ; }   static class line implements Comparable < line > {   int a ; int b ;

n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) flag = 0 for i in range ( 1 , n ) : k = set ( ) xdif = i ydif = a [ i ] - a [ 0 ] k . add ( a [ 0 ] * xdif ) for j in range ( n ) : k . add ( a [ j ] * xdif - ( ydif * j ) ) if len ( k ) == 2 : flag = 1 breakxdif = 1 ydif = a [ 2 ] - a [ 1 ] k = set ( ) k . add ( a [ 1 ] * xdif - ydif ) for j in range ( n ) : k . add ( a [ j ] * xdif - ( ydif * j ) )   if len ( k ) == 2 : flag = 1 if flag : print ( ' Yes ' ) else : print ( ' No ' ) NEW_LINE


n = int ( input ( ) ) y = list ( map ( int , input ( ) . split ( ) ) ) for i in range ( 1 , n ) : a = [ ] for j in range ( n ) : NEW_LINE


from decimal import * getcontext ( ) . prec = 16 from math import sqrt   n = int ( input ( ) )   liste = list ( map ( int , input ( ) . split ( " ▁ " ) ) )   perm = [ ( 0 , 1 , 2 ) , ( 0 , 2 , 1 ) , ( 1 , 2 , 0 ) ]   bool = Falsefor element in perm : i0 , i1 , i2 = element count = 2 slope = ( liste [ i1 ] - liste [ i0 ] ) / ( i1 - i0 ) rest = [ ] for i in range ( 3 , n ) : if slope == ( liste [ i1 ] - liste [ i ] ) / ( i1 - i ) : count += 1 else : rest . append ( i ) if slope == ( liste [ i2 ] - liste [ i1 ] ) / ( i2 - i1 ) : count += 1 else : rest . append ( i2 ) if rest != [ ] : count += 1 for i in range ( 1 , len ( rest ) ) : if slope == ( liste [ rest [ 0 ] ] - liste [ rest [ i ] ] ) / ( rest [ 0 ] - rest [ i ] ) : count += 1 if count == n and rest != [ ] : print ( " YES " ) break   else : print ( " NO " ) NEW_LINE


import java . io . File ; import java . io . IOException ; import java . io . OutputStream ; import java . io . PrintWriter ; import java . lang . reflect . Array ; import java . math . BigInteger ; import java . util . * ; import java . io . DataInputStream ; import java . io . InputStream ; import java . util . InputMismatchException ;   import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . math . BigDecimal ; import java . math . BigInteger ; import java . util . StringTokenizer ;    public class Main { public static void main ( String [ ] argv ) { Task t = new Task ( ) ;

n , T , c = input ( ) . split ( ) n = int ( n ) T = int ( T ) c = float ( c ) a = list ( map ( int , input ( ) . split ( ) ) ) m = int ( input ( ) ) q = list ( map ( int , input ( ) . split ( ) ) ) res_a = 0 real = 0 maxi_q = max ( q ) q_n = 0 for i in range ( q [ - 1 ] ) : res_a = ( res_a + a [ i ] / T ) / c real += a [ i ] if i >= T : real -= a [ i - T ] if q [ q_n ] == i + 1 : q_n += 1 r = real / T print ( r , res_a , abs ( r - res_a ) / r ) NEW_LINE


def main ( ) : s = input ( ) . split ( ) n , T , c = int ( s [ 0 ] ) , int ( s [ 1 ] ) , float ( s [ 2 ] ) a = list ( map ( int , input ( ) . split ( ) ) ) m = int ( input ( ) ) q = list ( map ( int , input ( ) . split ( ) ) ) sumA , approx , mean = [ 0 ] , [ ] , 0. for i in range ( 1 , n + 1 ) : mean = ( mean + a [ i - 1 ] / T ) / c approx . append ( mean ) sumA . append ( a [ i - 1 ] + sumA [ i - 1 ] ) ans = [ ( sumA [ q [ i ] ] - sumA [ q [ i ] - T ] ) / T for i in range ( m ) ] for i in range ( m ) : print ( ' % .6f ' % ans [ i ] , ' % .6f ' % approx [ q [ i ] - 1 ] , ' % .6f ' % ( abs ( approx [ q [ i ] - 1 ] - ans [ i ] ) / ans [ i ] ) ) if __name__ == ' _ _ main _ _ ' : main ( ) NEW_LINE


a = list ( input ( ) . split ( ) ) n , T , c = int ( a [ 0 ] ) , int ( a [ 1 ] ) , float ( a [ 2 ] ) a = list ( map ( int , input ( ) . split ( ) ) ) m = int ( input ( ) ) p = list ( map ( int , input ( ) . split ( ) ) )   sum_a = sum ( a [ : T - 1 ] ) mean = 0 for t in range ( T - 1 ) : mean = ( mean + a [ t ] / T ) / c   i = 0 for t in range ( T - 1 , p [ - 1 ] ) : sum_a += a [ t ] mean = ( mean + a [ t ] / T ) / c if t == p [ i ] - 1 : real = sum_a / T print ( ' % 0.6f ▁ % 0.6f ▁ % 0.6f ' % ( real , mean , abs ( real - mean ) / real ) ) i += 1 if i == len ( p ) : break sum_a -= a [ t - T + 1 ] NEW_LINE


__author__ = ' ruckus ' n , T , c = input ( ) . split ( ) n = int ( n ) T = int ( T ) c = float ( c ) a = list ( map ( int , input ( ) . split ( ) ) ) m = int ( input ( ) ) q = list ( map ( int , input ( ) . split ( ) ) ) res_a = 0 real = 0 maxi_q = max ( q ) q_n = 0 for i in range ( q [ - 1 ] ) : res_a = ( res_a + a [ i ] / T ) / c real += a [ i ] if i >= T : real -= a [ i - T ] if q [ q_n ] == i + 1 : q_n += 1 r = real / T print ( r , res_a , abs ( r - res_a ) / r ) NEW_LINE


import java . io . * ; import java . util . * ;   public class main { public static void solucion ( String strPalabra ) { List < String > ans = new ArrayList < > ( ) ;

string = input ( ) s = set ( ) finded = { } import syssys . setrecursionlimit ( 900000000 )   def get_substr ( string , start , parent ) : NEW_LINE


if __name__ == ' _ _ main _ _ ' :     word = input ( )   suffixes = set ( ) possible = set ( ) my_set = set ( ) not_poss = set ( )   possible . add ( ( len ( word ) , 2 ) )   while possible : tam , x = possible . pop ( ) a = tam + x for i in [ x , 5 - x ] : root = tam - i new_pos = ( root , i )   if root < 5 or new_pos in my_set or ( word [ root : tam ] == word [ tam : a ] ) : not_poss . add ( word [ root : tam ] ) else : suffixes . add ( word [ root : tam ] ) possible . add ( new_pos ) my_set . add ( new_pos )   suffixes_alph = sorted ( suffixes )   print ( len ( suffixes ) ) for i in suffixes_alph : print ( i ) NEW_LINE


import syssys . setrecursionlimit ( 10000 )   s = input ( ) s = s [ 5 : ] + " ▁ " res = set ( ) aux = set ( )   def getWords ( x , y ) : if ( x , y ) in aux : return aux . add ( ( x , y ) ) if x > 1 and s [ x : y ] != s [ x - 2 : x ] : res . add ( s [ x - 2 : x ] ) getWords ( x - 2 , x ) if x > 2 and s [ x : y ] != s [ x - 3 : x ] : res . add ( s [ x - 3 : x ] ) getWords ( x - 3 , x )   getWords ( len ( s ) - 1 , len ( s ) )   print ( len ( res ) ) for word in sorted ( list ( res ) ) : print ( word ) NEW_LINE


lectura = input ( ) sufix = set ( ) comb = { ( len ( lectura ) , 2 ) } setPrueba = set ( ) while comb : x , y = comb . pop ( ) pos3 = x + y for i in [ y , 5 - y ] : posIni = x - i stringActual = ( posIni , i ) if ( stringActual in setPrueba or ( posIni < 5 ) or ( lectura [ posIni : x ] == lectura [ x : pos3 ] ) ) : NEW_LINE


import sys   value = input ( ) if ( len ( value ) < 7 ) : print ( 0 ) sys . exit ( 0 )   res = set ( ) possible = { } possible [ len ( value ) ] = set ( [ 2 ] ) if ( len ( value ) > 7 ) : possible [ len ( value ) ] . add ( 3 ) possibleLen = [ 2 , 3 ]   for i in reversed ( range ( 7 , len ( value ) + 1 ) ) : possibleVal = possible . get ( i , set ( ) ) for length in possibleVal : nextI = i - length val = value [ nextI : i ] res . add ( val ) for posLen in possibleLen : if ( nextI >= 5 + posLen and value [ nextI - posLen : nextI ] != val ) : setNextI = possible . setdefault ( nextI , set ( ) ) setNextI . add ( posLen )   print ( len ( res ) ) for val in sorted ( res ) : print ( val ) NEW_LINE


import java . util . Scanner ; import java . util . TreeSet ;    public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; TreeSet < String > suffixes = new TreeSet < > ( ) ;   String word = sc . nextLine ( ) ; sc . close ( ) ;   String tempSubstring ;   boolean doubleStepIsPossible [ ] = new boolean [ word . length ( ) ] ; boolean tripleStepIsPossible [ ] = new boolean [ word . length ( ) ] ;   if ( word . length ( ) <= 6 ) { System . out . println ( "0" ) ; return ; }   int wordLength = word . length ( ) ;   doubleStepIsPossible [ wordLength - 2 ] = true ; suffixes . add ( word . substring ( wordLength - 2 , wordLength ) ) ;   if ( wordLength > 7 ) { tripleStepIsPossible [ wordLength - 3 ] = true ; suffixes . add ( word . substring ( wordLength - 3 , wordLength ) ) ; }   for ( int i = wordLength - 4 ; i >= 5 ; i -- ) { tempSubstring = word . substring ( i , i + 2 ) ; if ( tripleStepIsPossible [ i + 2 ] || ( doubleStepIsPossible [ i + 2 ] && ( ! tempSubstring . equals ( word . substring ( i + 2 , i + 4 ) ) ) ) ) { doubleStepIsPossible [ i ] = true ; suffixes . add ( tempSubstring ) ; }   tempSubstring = word . substring ( i , i + 3 ) ; if ( doubleStepIsPossible [ i + 3 ] || ( tripleStepIsPossible [ i + 3 ] && ( ! tempSubstring . equals ( word . substring ( i + 3 , i + 6 ) ) ) ) ) { tripleStepIsPossible [ i ] = true ; suffixes . add ( tempSubstring ) ; }   }   System . out . println ( suffixes . size ( ) ) ; suffixes . forEach ( System . out :: println ) ;   } }


import java . util . * ; public class linguistics { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String in = sc . nextLine ( ) ; char [ ] ch = in . toCharArray ( ) ; int n = ch . length ; TreeSet < String > ans = new TreeSet < > ( ) ; boolean [ ] dp2 = new boolean [ n + 1 ] ; boolean [ ] dp3 = new boolean [ n + 1 ] ; dp2 [ n ] = true ; dp3 [ n ] = true ; dp3 [ n - 3 ] = true ; dp2 [ n - 2 ] = true ; boolean s2 , s3 ; for ( int i = n - 1 ; i >= 5 ; i -- ) {


import java . util . Scanner ;   public class A722 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int type = in . nextInt ( ) ; String input = in . next ( ) ; int hStart ; int hEnd ; if ( type == 12 ) { hStart = 1 ; hEnd = 12 ; } else { hStart = 0 ; hEnd = 23 ; } int minDiff = 5 ; String answer = null ; for ( int h = hStart ; h <= hEnd ; h ++ ) { for ( int m = 0 ; m <= 59 ; m ++ ) { String S = String . format ( " % 02d : %02d " , h , m ) ; int diff = 0 ; for ( int i = 0 ; i < 5 ; i ++ ) { if ( input . charAt ( i ) != S . charAt ( i ) ) { diff ++ ; } } if ( diff < minDiff ) { minDiff = diff ; answer = S ; } } } System . out . println ( answer ) ; }   }


def solve ( ) : t = int ( input ( ) ) time = list ( input ( ) ) h , m = map ( int , " " . join ( time ) . split ( ' : ' ) )   if t == 12 : NEW_LINE


import java . util . * ; import java . lang . * ;   public class Main { public static void main ( String args [ ] ) { Scanner scanner = new Scanner ( System . in ) ; int format = scanner . nextInt ( ) ; String s = scanner . next ( ) ; int a = s . charAt ( 0 ) - '0' ; int b = s . charAt ( 1 ) - '0' ; int c = s . charAt ( 3 ) - '0' ; int d = s . charAt ( 4 ) - '0' ;   if ( c > 5 ) c = 0 ;   if ( format == 24 && a > 2 ) a = 0 ; if ( format == 24 && a == 2 && b >= 4 ) a = 0 ;   if ( format == 12 && a == 0 && b == 0 ) b = 1 ; else if ( format == 12 && a == 1 && b > 2 ) b = 1 ; else if ( format == 12 && a > 1 && b > 2 ) a = 0 ; else if ( format == 12 && a > 1 ) a = 1 ;   System . out . println ( a + " " + b + " : " + c + " " + d ) ; }   }


import java . util . Scanner ; import java . util . stream . IntStream ;   public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ;   int format = sc . nextInt ( ) ; String time = sc . next ( ) ; System . out . println ( solve ( format , time ) ) ;   sc . close ( ) ; }   static String solve ( int format , String time ) { int minHour ; int maxHour ; if ( format == 12 ) { minHour = 1 ; maxHour = 12 ; } else { minHour = 0 ; maxHour = 23 ; }   int minDiffNum = Integer . MAX_VALUE ; String result = null ; for ( int hour = minHour ; hour <= maxHour ; hour ++ ) { for ( int minute = 0 ; minute <= 59 ; minute ++ ) { String t = String . format ( " % 02d : %02d " , hour , minute ) ; int diffNum = ( int ) IntStream . range ( 0 , time . length ( ) ) . filter ( i -> time . charAt ( i ) != t . charAt ( i ) ) . count ( ) ; if ( diffNum < minDiffNum ) { minDiffNum = diffNum ; result = t ; } } }   return result ; } }


import java . util . * ; import java . io . * ; import java . math . * ;   public class Main   { static FastReader sc = new FastReader ( ) ; static int dp [ ] [ ] ;

N = 1000 hy , ay , dy = map ( int , input ( ) . split ( ) ) hm , am , dm = map ( int , input ( ) . split ( ) ) h , a , d = map ( int , input ( ) . split ( ) ) res , c = 2e9 , 0 if ay <= dm : c = ( dm - ay + 1 ) * a ay = dm + 1 for i in range ( N ) : for j in range ( N ) : for k in range ( N ) : if am <= dy + k : res = min ( res , h * i + a * j + d * k ) break x = hy + i - am + dy + k - 1 y = am - dy - k z = hm - ay - j + dm - 1 w = ay + j - dm if x // y > z / w : res = min ( res , h * i + a * j + d * k ) breakprint ( res + c ) NEW_LINE