import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int x [ ] = new int [ n ] ; int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { x [ i ] = scan . nextInt ( ) ; sum += x [ i ] ; } int a = 0 ; int b = 0 ; int count = 0 ; float norm = ( ( float ) sum ) / n ; for ( int i = 0 ; i < n && count < 3 ; i ++ ) { if ( x [ i ] < norm ) { count ++ ; a = i + 1 ; } else if ( x [ i ] > norm ) { count ++ ; b = i + 1 ; } } if ( count == 3 || norm != ( int ) norm ) { System . out . println ( " Unrecoverable ▁ configuration . " ) ; } else if ( a == 0 ) { System . out . println ( " Exemplary ▁ pages . " ) ; } else { System . out . println ( ( int ) ( x [ b - 1 ] - norm ) + " ▁ ml . ▁ from ▁ cup ▁ # " + a + " ▁ to ▁ cup ▁ # " + b + " . " ) ; } } }

import java . io . * ; import java . util . * ; import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ; import java . util . ArrayList ; import java . util . Collections ; import java . util . HashMap ; import java . util . Map ; import java . text . DecimalFormat ; import java . lang . Math ; import java . util . Iterator ; public class b88 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; float avg = 0 ; ArrayList < Integer > A = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { A . add ( sc . nextInt ( ) ) ; avg += ( float ) A . get ( i ) ; } avg = ( float ) avg / n ; int count = 0 ; for ( int i = 0 ; i < A . size ( ) ; i ++ ) { if ( ( float ) A . get ( i ) != avg ) { count ++ ; } } if ( count > 2 ) { System . out . println ( " Unrecoverable ▁ configuration . " ) ; } else if ( count == 0 ) { System . out . println ( " Exemplary ▁ pages . " ) ; } else if ( count == 2 ) { ArrayList < Integer > B = new ArrayList < Integer > ( A ) ; Collections . sort ( B ) ; if ( B . get ( B . size ( ) - 1 ) - ( int ) avg == ( int ) avg - B . get ( 0 ) ) { System . out . println ( ( B . get ( B . size ( ) - 1 ) - ( int ) avg ) + " ▁ ml . ▁ from ▁ cup ▁ # " + ( A . indexOf ( B . get ( 0 ) ) + 1 ) + " ▁ to ▁ cup ▁ # " + ( A . indexOf ( B . get ( B . size ( ) - 1 ) ) + 1 ) + " . " ) ; } else { System . out . println ( " Unrecoverable ▁ configuration . " ) ; } } } }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; import java . util . * ; public class Main { public static void ans ( int [ ] arr , int sum , int n ) { if ( sum % n != 0 ) { System . out . println ( " Unrecoverable ▁ configuration . " ) ; return ; } int equal = sum / n ; int inc = 0 , dec = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] > equal ) inc ++ ; else if ( arr [ i ] < equal ) dec ++ ; } if ( inc == 0 && dec == 0 ) { System . out . println ( " Exemplary ▁ pages . " ) ; return ; } else if ( inc == 1 && dec == 1 ) { int a = 0 , b = 0 , ia = 0 , ib = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] > equal ) { a = arr [ i ] - equal ; ia = i ; } else if ( arr [ i ] < equal ) { b = equal - arr [ i ] ; ib = i ; } } if ( a == b ) { System . out . println ( a + " ▁ ml . ▁ from ▁ cup ▁ # " + ( ib + 1 ) + " ▁ to ▁ cup ▁ # " + ( ia + 1 ) + " . " ) ; return ; } else { System . out . println ( " Unrecoverable ▁ configuration . " ) ; return ; } } else { System . out . println ( " Unrecoverable ▁ configuration . " ) ; return ; } } public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( br . readLine ( ) ) ; int arr [ ] = new int [ n ] ; int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = Integer . parseInt ( br . readLine ( ) ) ; sum = sum + arr [ i ] ; } ans ( arr , sum , n ) ; } }

import java . util . * ; import java . math . * ; public class Main { public static void main ( String args [ ] ) { Scanner cin = new Scanner ( System . in ) ; int n = cin . nextInt ( ) ; int [ ] juice = new int [ 1006 ] ; int x = 0 ; for ( int i = 0 ; i != n ; ++ i ) { x += ( juice [ i ] = cin . nextInt ( ) ) ; } int ave = x / n ; int plus_pos = 0 , minus_pos = 0 , plus_cnt = 0 , minus_cnt = 0 ; for ( int i = 0 ; i != n ; ++ i ) { if ( juice [ i ] > ave ) { plus_pos = i ; plus_cnt ++ ; } if ( juice [ i ] < ave ) { minus_pos = i ; minus_cnt ++ ; } } if ( plus_cnt == 1 && minus_cnt == 1 && ave - juice [ minus_pos ] == juice [ plus_pos ] - ave ) { System . out . printf ( " % d ▁ ml . ▁ from ▁ cup ▁ # % d ▁ to ▁ cup ▁ # % d . \n " , ave - juice [ minus_pos ] , minus_pos + 1 , plus_pos + 1 ) ; } else if ( plus_cnt == 0 && minus_cnt == 0 ) { System . out . println ( " Exemplary ▁ pages . " ) ; } else { System . out . println ( " Unrecoverable ▁ configuration . " ) ; } cin . close ( ) ; } }

a = int ( input ( ) ) NEW_LINE summa = 0 NEW_LINE s = [ ] NEW_LINE for i in range ( a ) : NEW_LINE INDENT h = int ( input ( ) ) NEW_LINE summa += h NEW_LINE s . append ( h ) NEW_LINE DEDENT if ( summa / a ) != int ( summa / a ) : NEW_LINE INDENT print ( " Unrecoverable ▁ configuration . " ) NEW_LINE DEDENT else : NEW_LINE INDENT v = summa // a NEW_LINE c = 0 NEW_LINE r = 0 NEW_LINE ans = [ ] NEW_LINE for i in range ( a ) : NEW_LINE INDENT if s [ i ] != v : NEW_LINE INDENT c += 1 NEW_LINE DEDENT DEDENT if c > 2 : NEW_LINE INDENT print ( " Unrecoverable ▁ configuration . " ) NEW_LINE exit ( 0 ) NEW_LINE DEDENT c = 0 NEW_LINE for i in range ( a ) : NEW_LINE INDENT if s [ i ] != v : NEW_LINE INDENT if c == 0 : NEW_LINE INDENT c += 1 NEW_LINE r = v - s [ i ] NEW_LINE ans . append ( i + 1 ) NEW_LINE DEDENT elif c == 1 : NEW_LINE INDENT c += 1 NEW_LINE if abs ( v - s [ i ] ) != abs ( r ) : NEW_LINE INDENT print ( " Unrecoverable ▁ configuration . " ) NEW_LINE exit ( 0 ) NEW_LINE DEDENT else : NEW_LINE INDENT if r > 0 : NEW_LINE INDENT print ( str ( r ) + " ▁ ml . ▁ from ▁ cup ▁ # " + str ( ans [ 0 ] ) + " ▁ to ▁ cup ▁ # " + str ( i + 1 ) + " . " ) NEW_LINE exit ( 0 ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( str ( abs ( r ) ) + " ▁ ml . ▁ from ▁ cup ▁ # " + str ( i + 1 ) + " ▁ to ▁ cup ▁ # " + str ( ans [ 0 ] ) + " . " ) NEW_LINE exit ( 0 ) NEW_LINE DEDENT DEDENT DEDENT else : NEW_LINE INDENT print ( " Unrecoverable ▁ configuration . " ) NEW_LINE exit ( 0 ) NEW_LINE DEDENT DEDENT DEDENT if not c : NEW_LINE INDENT print ( " Exemplary ▁ pages . " ) NEW_LINE DEDENT DEDENT

n = int ( input ( ) ) NEW_LINE q = [ int ( input ( ) ) for i in range ( n ) ] NEW_LINE w = sorted ( q ) NEW_LINE if w [ 0 ] == w [ - 1 ] : NEW_LINE INDENT print ( ' Exemplary ▁ pages . ' ) NEW_LINE exit ( ) NEW_LINE DEDENT if ( w [ 0 ] + w [ - 1 ] ) % 2 or ( n > 2 and ( w [ n - 2 ] != w [ 1 ] or w [ 1 ] != ( w [ 0 ] + w [ - 1 ] ) // 2 ) ) : NEW_LINE INDENT print ( ' Unrecoverable ▁ configuration . ' ) NEW_LINE exit ( ) NEW_LINE DEDENT x , y = q . index ( min ( w ) ) , q . index ( max ( w ) ) NEW_LINE print ( ( q [ y ] - q [ x ] ) // 2 , ' ▁ ml . ▁ from ▁ cup ▁ # ' , x + 1 , ' ▁ to ▁ cup ▁ # ' , y + 1 , ' . ' , sep = ' ' ) NEW_LINE

n = int ( input ( ) ) NEW_LINE d = { } NEW_LINE for i in range ( n ) : NEW_LINE INDENT s = int ( input ( ) ) NEW_LINE if s in d : NEW_LINE INDENT d [ s ] += [ i + 1 ] NEW_LINE DEDENT else : NEW_LINE INDENT d [ s ] = [ i + 1 ] NEW_LINE DEDENT DEDENT mx = max ( d ) NEW_LINE mn = min ( d ) NEW_LINE l = len ( d ) NEW_LINE if l == 1 : NEW_LINE INDENT print ( " Exemplary ▁ pages . " ) NEW_LINE exit ( ) NEW_LINE DEDENT elif l == 2 : NEW_LINE INDENT if len ( d [ mx ] ) != 1 or len ( d [ mn ] ) != 1 : NEW_LINE INDENT print ( ' Unrecoverable ▁ configuration . ' ) NEW_LINE exit ( ) NEW_LINE DEDENT if ( mx + mn ) % 2 : NEW_LINE INDENT print ( " Unrecoverable ▁ configuration . " ) NEW_LINE exit ( ) NEW_LINE DEDENT DEDENT elif l == 3 : NEW_LINE INDENT if len ( d [ mx ] ) != 1 or len ( d [ mn ] ) != 1 : NEW_LINE INDENT print ( ' Unrecoverable ▁ configuration . ' ) NEW_LINE exit ( ) NEW_LINE DEDENT md = ( set ( d ) - { mx , mn } ) . pop ( ) NEW_LINE if ( mx + mn ) / 2 != md : NEW_LINE INDENT print ( " Unrecoverable ▁ configuration . " ) NEW_LINE exit ( ) NEW_LINE DEDENT DEDENT else : NEW_LINE INDENT print ( " Unrecoverable ▁ configuration . " ) NEW_LINE exit ( ) NEW_LINE DEDENT print ( ( mx - mn ) // 2 , ' ▁ ml . ▁ from ▁ cup ▁ # ' , * d [ mn ] , ' ▁ to ▁ cup ▁ # ' , * d [ mx ] , ' . ' , sep = ' ' ) NEW_LINE


import java . io . * ; import java . util . * ; public class Solution { static Scanner sc = new Scanner ( System . in ) ; static PrintWriter out = new PrintWriter ( System . out ) ;

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

def count ( balls ) : stop = False ans = len ( balls ) m = len ( balls ) while ( not stop and m > 0 ) : elms2remove = set ( ) i = 2 stop = True m = len ( balls ) while i < len ( balls ) : if balls [ i ] == balls [ i - 1 ] == balls [ i - 2 ] : elms2remove |= { i , i - 1 , i - 2 } stop = False while i + 1 < m and balls [ i + 1 ] == balls [ i ] : elms2remove . add ( i + 1 ) i += 1   balls = [ b for i , b in enumerate ( balls ) if i not in elms2remove ] break   i += 1   return ans - len ( balls ) - 1     def main ( ) : n , _k , x = map ( int , input ( ) . split ( ) ) balls = [ int ( c ) for c in input ( ) . split ( ) ]   ans = 0 i = 0 while i < n - 1 : if balls [ i ] == x and balls [ i + 1 ] == x : conf = balls [ : i ] conf . append ( x ) conf += balls [ i : ] ans = max ( ans , count ( conf ) ) while i < n - 1 and balls [ i ] == x : i += 1   i += 1   print ( ans )     if __name__ == " _ _ main _ _ " : main ( ) NEW_LINE

import osimport sysfrom io import BytesIO , IOBase   BUFSIZE = 8192     class FastIO ( IOBase ) : newlines = 0   def __init__ ( self , file ) : self . _fd = file . fileno ( ) self . buffer = BytesIO ( ) self . writable = " x " in file . mode or " r " not in file . mode self . write = self . buffer . write if self . writable else None   def read ( self ) : while True : b = os . read ( self . _fd , max ( os . fstat ( self . _fd ) . st_size , BUFSIZE ) ) if not b : break ptr = self . buffer . tell ( ) self . buffer . seek ( 0 , 2 ) , self . buffer . write ( b ) , self . buffer . seek ( ptr ) self . newlines = 0 return self . buffer . read ( )   def readline ( self ) : while self . newlines == 0 : b = os . read ( self . _fd , max ( os . fstat ( self . _fd ) . st_size , BUFSIZE ) ) self . newlines = b . count ( b " \n " ) + ( not b ) ptr = self . buffer . tell ( ) self . buffer . seek ( 0 , 2 ) , self . buffer . write ( b ) , self . buffer . seek ( ptr ) self . newlines -= 1 return self . buffer . readline ( )   def flush ( self ) : if self . writable : os . write ( self . _fd , self . buffer . getvalue ( ) ) self . buffer . truncate ( 0 ) , self . buffer . seek ( 0 )     class IOWrapper ( IOBase ) : def __init__ ( self , file ) : self . buffer = FastIO ( file ) self . flush = self . buffer . flush self . writable = self . buffer . writable self . write = lambda s : self . buffer . write ( s . encode ( " ascii " ) ) self . read = lambda : self . buffer . read ( ) . decode ( " ascii " ) self . readline = lambda : self . buffer . readline ( ) . decode ( " ascii " )     sys . stdin , sys . stdout = IOWrapper ( sys . stdin ) , IOWrapper ( sys . stdout ) input = lambda : sys . stdin . readline ( ) . rstrip ( " \n " ) NEW_LINE


import java . io . * ; import java . util . * ;   public class CF685A { static int digits ( int n ) { return n == 0 ? 0 : 1 + digits ( n / 7 ) ; } static int power ( int k ) { return k == 0 ? 1 : 7 * power ( k - 1 ) ; } static boolean [ ] used = new boolean [ 7 ] ; static boolean valid ( int n , int k ) { for ( int d = 0 ; d < 7 ; d ++ ) used [ d ] = false ; for ( int i = 0 ; i < k ; i ++ ) { int d = n % 7 ; if ( used [ d ] ) return false ; used [ d ] = true ; n /= 7 ; } return true ; } public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; int n = Integer . parseInt ( st . nextToken ( ) ) ; int m = Integer . parseInt ( st . nextToken ( ) ) ; int kn = n == 1 ? 1 : digits ( n - 1 ) ; int km = m == 1 ? 1 : digits ( m - 1 ) ; int k = kn + km ; if ( k > 7 ) { System . out . println ( 0 ) ; return ; } int M = power ( km ) ; int cnt = 0 ; for ( int n_ = 0 ; n_ < n ; n_ ++ ) for ( int m_ = 0 ; m_ < m ; m_ ++ ) { int nm = n_ * M + m_ ; if ( valid ( nm , k ) ) cnt ++ ; } System . out . println ( cnt ) ; } }

from itertools import permutations   n , m = map ( int , input ( ) . split ( ) )   def S ( x ) : if x == 0 : return 1 res = 0 while x > 0 : x //= 7 res += 1 return res     a , b = S ( n - 1 ) , S ( m - 1 )   if a + b > 7 : print ( 0 ) exit ( )   D = list ( range ( 7 ) )   res = 0   for v in permutations ( D , a ) :   x = 0 for i in range ( a ) : x = 7 * x + v [ i ]   if x >= n : continue   R = [ d for d in D if d not in v ]   for u in permutations ( R , b ) : y = 0 for i in range ( b ) : y = 7 * y + u [ i ]   res += y < m   print ( res ) NEW_LINE

from itertools import permutationsdef findPow ( num ) : ans = 1 num = num // 7 while num > 0 : num //= 7 ans += 1 return ansa , b = [ int ( x ) for x in input ( ) . split ( ' ▁ ' ) ] x = findPow ( a - 1 ) y = findPow ( b - 1 ) ans = 0 if ( x + y ) > 7 : ans = 0 else : for i in permutations ( '0123456' , x + y ) : s = ' ' . join ( list ( i ) ) p , q = int ( s [ : x ] , 7 ) , int ( s [ x : ] , 7 ) if p <= a - 1 and q <= b - 1 : ans += 1   print ( ans ) NEW_LINE

import mathimport sysfrom bisect import bisect_right , bisect_left , insort_rightfrom collections import Counter , defaultdictfrom heapq import heappop , heappushfrom itertools import accumulate , permutations , combinationsfrom sys import stdout   R = lambda : map ( int , input ( ) . split ( ) ) n , m = R ( ) nc , mc = n , mn -= 1 m -= 1 a = b = 0 while n : n //= 7 a += 1 while m : m //= 7 b += 1 a , b = max ( 1 , a ) , max ( 1 , b ) if a + b > 7 : print ( 0 ) else : res = 0 bs = [ 1 ] whole = [ 0 , 1 , 2 , 3 , 4 , 5 , 6 ] for i in range ( 10 ) : bs . append ( bs [ - 1 ] * 7 ) for pa in permutations ( whole , a ) : if sum ( x * y for x , y in zip ( bs , pa ) ) < nc : for pb in permutations ( [ x for x in whole if x not in pa ] , b ) : if sum ( x * y for x , y in zip ( bs , pb ) ) < mc : res += 1 print ( res ) NEW_LINE

from itertools import permutations as p     def length_base_7 ( ele , arr ) : if not ele : arr . append ( 0 ) return 1 length = 0 while ele : arr . append ( ele % 7 ) ele //= 7 length += 1 return length     n , m = map ( int , input ( ) . split ( ) ) n -= 1 m -= 1   n_base7 , m_base7 = [ ] , [ ] n_length , m_length = length_base_7 ( n , n_base7 ) , length_base_7 ( m , m_base7 )   n_base7 , m_base7 = n_base7 [ : : - 1 ] , m_base7 [ : : - 1 ]   combination_number = { 0 , 1 , 2 , 3 , 4 , 5 , 6 } res = 0 for i in p ( combination_number , n_length ) : if list ( i ) <= n_base7 : for j in p ( combination_number - set ( i ) , m_length ) : if list ( j ) <= m_base7 : res += 1   print ( res ) NEW_LINE


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

import java . io . * ; import java . util . * ;   public class submission { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int c = scanner . nextInt ( ) ;   List < Integer > t = new ArrayList < > ( n ) ; for ( int i = 0 ; i < n ; i ++ ) { t . add ( scanner . nextInt ( ) ) ; }   int ans = 0 ;   for ( int i = 0 ; i < n - 1 ; ++ i ) { if ( t . get ( i + 1 ) - t . get ( i ) <= c ) { ans ++ ; } else { ans = 0 ; } } ans ++ ; System . out . println ( ans ) ;   scanner . close ( ) ; } }

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

import java . util . Scanner ; import java . util . StringTokenizer ;   public class CrazyComputer { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String line1 = scanner . nextLine ( ) ;   StringTokenizer tokenizer = new StringTokenizer ( line1 ) ; int n = Integer . parseInt ( tokenizer . nextToken ( ) ) ; int m = Integer . parseInt ( tokenizer . nextToken ( ) ) ;   int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = scanner . nextInt ( ) ; }   int lastItem = arr [ n - 1 ] ; int count = 1 ; for ( int i = n - 2 ; i >= 0 ; i -- ) { if ( Math . abs ( arr [ i ] - lastItem ) <= m ) { count ++ ; lastItem = arr [ i ] ; } else { break ; } }   System . out . println ( count ) ; } }

n , c = map ( int , input ( ) . split ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) t = 1 p = l [ 0 ] for i in l [ 1 : ] : if i - p > c : t = 1 else : t += 1 p = iprint ( t ) 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

n , c = map ( int , input ( ) . split ( ) ) l = [ ] l . extend ( map ( int , input ( ) . split ( ) ) )   c1 = 1 for i in range ( n - 1 ) : if l [ i + 1 ] - l [ i ] <= c : c1 += 1 else : c1 = 1   print ( c1 ) NEW_LINE

n , x = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) c = 0 for i in range ( 1 , n ) : if ( ( a [ i ] - a [ i - 1 ] ) <= x ) : c = c + 1 else : c = 0 print ( c + 1 ) NEW_LINE

n , c = map ( int , input ( ) . split ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) ans = 1 for i in range ( n - 1 ) : if arr [ i + 1 ] - arr [ i ] <= c : ans += 1 else : ans = 1 print ( ans ) NEW_LINE


import java . util . * ; import java . awt . Point ; import java . lang . Math ; import java . util . Arrays ; import java . util . Scanner ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . io . OutputStream ; import java . util . Comparator ; import java . math . BigInteger ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . stream . IntStream ; import java . io . IOException ; import java . util . ArrayList ; import java . math . BigInteger ; import java . util . Collections ; import java . util . StringTokenizer ; public class S { public static void main ( String [ ] args ) throws java . lang . Exception { FastScanner in = new FastScanner ( ) ; int t = in . ni ( ) ; while ( t -- > 0 ) { int n = in . ni ( ) ; int r [ ] = in . ria ( n ) ; int m = in . ni ( ) ; int b [ ] = in . ria ( m ) ; int i = 0 , j = 0 , max = 0 , sum = 0 ; int max1 = 0 , max2 = 0 , sum1 = 0 , sum2 = 0 ; for ( i = 0 ; i < n ; i ++ ) { sum1 += r [ i ] ; max1 = Math . max ( max1 , sum1 ) ; } for ( i = 0 ; i < m ; i ++ ) { sum2 += b [ i ] ; max2 = Math . max ( max2 , sum2 ) ; } max = max1 + max2 ; System . out . println ( max ) ; } }

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

import java . util . Scanner ;   public class B1469 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int T = in . nextInt ( ) ; for ( int t = 0 ; t < T ; t ++ ) { int N = in . nextInt ( ) ; int maxR = 0 ; int sum = 0 ; for ( int n = 0 ; n < N ; n ++ ) { int r = in . nextInt ( ) ; sum += r ; maxR = Math . max ( maxR , sum ) ; } int maxB = 0 ; sum = 0 ; int M = in . nextInt ( ) ; for ( int m = 0 ; m < M ; m ++ ) { int b = in . nextInt ( ) ; sum += b ; maxB = Math . max ( maxB , sum ) ; } int answer = maxR + maxB ; System . out . println ( answer ) ; } }   }

import java . util . * ; public class anb { public static void main ( String args [ ] ) { Scanner in = new Scanner ( System . in ) ; int t = in . nextInt ( ) ; int i , j ; while ( t -- > 0 ) { int n = in . nextInt ( ) ; int a [ ] = new int [ n ] ; int ar [ ] = new int [ n ] ; for ( i = 0 ; i < n ; i ++ ) { a [ i ] = in . nextInt ( ) ; if ( i != 0 ) ar [ i ] = ar [ i - 1 ] + a [ i ] ; else ar [ i ] = a [ i ] ; } int m = in . nextInt ( ) ; int b [ ] = new int [ m ] ; int br [ ] = new int [ m ] ; for ( i = 0 ; i < m ; i ++ ) { b [ i ] = in . nextInt ( ) ; if ( i != 0 ) br [ i ] = br [ i - 1 ] + b [ i ] ; else br [ i ] = b [ i ] ; } int max1 = 0 , max2 = 0 ; for ( i = 0 ; i < n ; i ++ ) { if ( ar [ i ] > max1 ) max1 = ar [ i ] ; } for ( i = 0 ; i < m ; i ++ ) { if ( br [ i ] > max2 ) max2 = br [ i ] ; } System . out . println ( max1 + max2 ) ; } } }

def check ( a1 , a2 ) : m1 = 0 NEW_LINE c1 = 0 NEW_LINE for i in range ( 0 , len ( a1 ) ) : c1 = c1 + a1 [ i ] NEW_LINE m1 = max ( m1 , c1 ) NEW_LINE sum = m1 NEW_LINE m1 = 0 NEW_LINE c1 = 0 NEW_LINE for i in range ( 0 , len ( a2 ) ) : c1 = c1 + a2 [ i ] NEW_LINE m1 = max ( m1 , c1 ) NEW_LINE sum += m1 NEW_LINE return sum     for _ in range ( int ( input ( ) ) ) : x = int ( input ( ) ) NEW_LINE a1 = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE y = int ( input ( ) ) NEW_LINE a2 = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE k = ( check ( a1 , a2 ) ) NEW_LINE print ( k ) NEW_LINE

def solver ( n , m , red , blue ) : ans = 0 NEW_LINE r = [ 0 ] * ( n + 1 ) NEW_LINE b = [ 0 ] * ( m + 1 ) NEW_LINE for i in range ( n ) : r [ i + 1 ] += r [ i ] + red [ i ] NEW_LINE for i in range ( m ) : b [ i + 1 ] += b [ i ] + blue [ i ] NEW_LINE ans = max ( r ) + max ( b ) NEW_LINE print ( max ( 0 , ans ) ) NEW_LINE T = int ( input ( ) ) NEW_LINE for _ in range ( T ) : n = int ( input ( ) ) NEW_LINE red = [ int ( x ) for x in input ( ) . split ( ) ] NEW_LINE m = int ( input ( ) ) NEW_LINE blue = [ int ( x ) for x in input ( ) . split ( ) ] NEW_LINE solver ( n , m , red , blue ) NEW_LINE

from collections import Counterdef NEW_LINE maxSubArraySum ( a , size ) : max1 = 0 NEW_LINE ans = 0 NEW_LINE for i in a : max1 += i NEW_LINE if ( max1 > ans ) : ans = max1 NEW_LINE return anst = int ( input ( ) ) NEW_LINE for _ in range ( t ) : n = int ( input ( ) ) NEW_LINE ali = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE m = int ( input ( ) ) NEW_LINE bli = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE q = maxSubArraySum ( ali , n ) NEW_LINE w = maxSubArraySum ( bli , m ) NEW_LINE

import osimport NEW_LINE sysfrom NEW_LINE io NEW_LINE import BytesIO , IOBase     NEW_LINE def main ( ) : pass NEW_LINE     NEW_LINE

for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) NEW_LINE r = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE m = int ( input ( ) ) NEW_LINE b = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE p = list ( ) NEW_LINE q = list ( ) NEW_LINE for i in range ( n ) : l = sum ( r [ : ( i + 1 ) ] ) NEW_LINE p . append ( l ) NEW_LINE for j in range ( m ) : d = sum ( b [ : ( j + 1 ) ] ) NEW_LINE q . append ( d ) NEW_LINE a = max ( p ) NEW_LINE b = max ( q ) NEW_LINE print ( max ( 0 , a ) + max ( 0 , b ) ) NEW_LINE


import java . util . ArrayList ; import java . util . Scanner ;   public class testD { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int i , j ; i = input . nextInt ( ) ; j = input . nextInt ( ) ; ArrayList < String > m = new ArrayList < String > ( ) ; input . nextLine ( ) ; for ( int k = 0 ; k < i ; k ++ ) { m . add ( input . nextLine ( ) ) ; }   ArrayList < Integer > light = new ArrayList < Integer > ( ) ; for ( int k = 0 ; k < j ; k ++ ) { light . add ( 0 ) ; }   for ( int k = 0 ; k < m . size ( ) ; k ++ ) { for ( int l = 0 ; l < j ; l ++ ) { if ( m . get ( k ) . charAt ( l ) == '1' ) { light . set ( l , light . get ( l ) + 1 ) ; } } } for ( int k = 0 ; k < i ; k ++ ) { if ( is ( light , j , m , k ) ) { System . out . println ( " YES " ) ; return ; } } System . out . println ( " NO " ) ; }   public static Boolean is ( ArrayList < Integer > light , int lightnum , ArrayList < String > button , int buttonnum ) { for ( int j = 0 ; j < lightnum ; j ++ ) { if ( button . get ( buttonnum ) . charAt ( j ) == '1' ) { if ( light . get ( j ) - 1 == 0 ) { return false ; } } } return true ; } }

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 SwitchesAndLamps {   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 ( ) ;

import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; sc . nextLine ( ) ; String [ ] str = new String [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { str [ i ] = sc . nextLine ( ) ; } boolean flag1 , flag2 ; for ( int i = 0 ; i < n ; i ++ ) { flag2 = true ; for ( int j = 0 ; j < m ; j ++ ) { if ( str [ i ] . charAt ( j ) == '1' ) { flag1 = false ; for ( int k = 0 ; k < n ; k ++ ) { if ( str [ k ] . charAt ( j ) == '1' && k != i ) { flag1 = true ; break ; } } if ( ! flag1 ) flag2 = false ; } } if ( flag2 ) { System . out . println ( " YES " ) ; return ; } } System . out . println ( " NO " ) ; return ; } }

n , m = map ( int , input ( ) . split ( ) ) grid = [ ] for i in range ( n ) : grid . append ( input ( ) ) cnts = [ 0 for i in range ( m ) ] for i in range ( n ) : for j in range ( m ) : cnts [ j ] += 0 if grid [ i ] [ j ] == '0' else 1 for i in range ( n ) : flag = True for j in range ( m ) : if grid [ i ] [ j ] == '1' and cnts [ j ] == 1 : flag = False break if flag : print ( ' YES ' ) exit ( 0 ) print ( ' NO ' ) NEW_LINE

if __name__ == ' _ _ main _ _ ' : cin = input n , m = map ( int , cin ( ) . split ( ) ) s , l , f = [ [ ] for _ in range ( n ) ] , [ 0 ] * m , 0   for i in range ( n ) : t = cin ( ) for j in range ( m ) : if t [ j ] == "1" : l [ j ] += int ( t [ j ] ) s [ i ] . append ( j ) for i in range ( n ) : r = set ( l [ c ] - 1 for c in s [ i ] ) if not 0 in r : f = not f break print ( " YNEOS " [ not f : : 2 ] ) NEW_LINE

import sys , math , itertoolsfrom collections import Counter , deque , defaultdictfrom bisect import bisect_left , bisect_right from heapq import heappop , heappush , heapify , nlargestfrom copy import deepcopymod = 10 ** 9 + 7 INF = float ( ' inf ' ) def inp ( ) : return int ( sys . stdin . readline ( ) ) def inpl ( ) : return list ( map ( int , sys . stdin . readline ( ) . split ( ) ) ) def inpl_1 ( ) : return list ( map ( lambda x : int ( x ) - 1 , sys . stdin . readline ( ) . split ( ) ) ) def inps ( ) : return sys . stdin . readline ( ) def inpsl ( x ) : tmp = sys . stdin . readline ( ) ; return list ( tmp [ : x ] ) def err ( x ) : print ( x ) ; exit ( )   n , m = inpl ( ) s = [ inpsl ( m ) for _ in range ( n ) ] lampcnt = [ 0 ] * mfor i in range ( n ) : for j in range ( m ) : if s [ i ] [ j ] == '1' : lampcnt [ j ] += 1 res = Falsefor i in range ( n ) : only = False for j in range ( m ) : if s [ i ] [ j ] == '1' and lampcnt [ j ] == 1 : only = True if not only : res = Trueprint ( ' YES ' if res else ' NO ' ) NEW_LINE

n , m = map ( int , input ( ) . split ( ) ) x = list ( list ( map ( int , input ( ) ) ) for i in range ( n ) ) res = [ 0 ] * mfor i in range ( n ) : for j in range ( m ) : res [ j ] += x [ i ] [ j ]   for i in range ( n ) : ok = 1 for j in range ( m ) : if res [ j ] == 1 and x [ i ] [ j ] == 1 : ok = 0 break if ok : print ( " YES " ) exit ( ) print ( " NO " ) NEW_LINE


import java . io . * ; import java . util . * ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ;    public class Main1 {   static class pair implements Comparable < pair > { int a ; int b ; public pair ( int a , int b ) { this . a = a ; this . b = b ; } @ Override public int compareTo ( pair o ) {

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

import java . util . * ; import java . io . * ;   public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter out = new PrintWriter ( new OutputStreamWriter ( System . out ) ) ; StringTokenizer st ;   int N = Integer . parseInt ( in . readLine ( ) ) ; st = new StringTokenizer ( in . readLine ( ) ) ; int [ ] graph = new int [ N ] ;   for ( int i = 0 ; i < N ; i ++ ) { graph [ i ] = Integer . parseInt ( st . nextToken ( ) ) - 1 ; }   StringBuilder ans = new StringBuilder ( ) ; for ( int i = 0 ; i < N ; i ++ ) { boolean [ ] marked = new boolean [ N ] ; marked [ i ] = true ; int j = graph [ i ] ; while ( true ) { if ( marked [ j ] ) { ans . append ( j + 1 ) . append ( " ▁ " ) ; break ; } else { marked [ j ] = true ; } j = graph [ j ] ; } } out . println ( ans ) ;   in . close ( ) ; out . close ( ) ; }   }

import java . io . * ; import java . util . * ;   public class badge { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int N = Integer . parseInt ( br . readLine ( ) ) ; int [ ] succ = new int [ N ] ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; for ( int i = 0 ; i < N ; i ++ ) { succ [ i ] = Integer . parseInt ( st . nextToken ( ) ) - 1 ; } int [ ] out = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { int cur = i ; boolean [ ] seen = new boolean [ N ] ; while ( ! seen [ cur ] ) { seen [ cur ] = true ; cur = succ [ cur ] ; } out [ i ] = cur ; } PrintWriter pw = new PrintWriter ( System . out ) ; StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < N - 1 ; i ++ ) { if ( out [ i ] != - 1 ) { sb . append ( ( out [ i ] + 1 ) + " ▁ " ) ; } else { sb . append ( ( i + 1 ) + " ▁ " ) ; } } if ( out [ N - 1 ] != - 1 ) { sb . append ( ( out [ N - 1 ] + 1 ) ) ; } else { sb . append ( N ) ; } pw . println ( sb . toString ( ) ) ; pw . close ( ) ; } }

n = int ( input ( ) ) a1 = [ 0 ] + [ int ( x ) for x in input ( ) . strip ( ) . split ( " ▁ " ) ]   out = [ ]   for i in range ( 1 , n + 1 ) : a = a1 . copy ( ) j = a [ i ] NEW_LINE

import functoolsimport timefrom collections import Counter   def timer ( func ) : @ functools . wraps ( func ) def wrapper ( * args , ** kwargs ) : stime = time . perf_counter ( ) res = func ( * args , ** kwargs ) elapsed = time . perf_counter ( ) - stime print ( f " { func . _ _ name _ _ } ▁ in ▁ { elapsed : .4f } ▁ secs " ) return res return wrapper   class solver : NEW_LINE

n = int ( input ( ) ) p = list ( map ( int , input ( ) . split ( ) ) ) ans = [ ] for start in range ( n ) : holes = [ 0 for i in range ( n ) ] holes [ start ] = 1 cur = start while max ( holes ) != 2 : holes [ p [ cur ] - 1 ] += 1 cur = p [ cur ] - 1 ans . append ( cur + 1 )   print ( ' ▁ ' . join ( list ( map ( str , ans ) ) ) ) NEW_LINE

n = int ( input ( ) ) d = dict ( zip ( range ( 1 , n + 1 ) , map ( int , input ( ) . split ( ) ) ) ) ans = [ 0 ] * nfor i in d : node = i s = set ( ) while node not in s : s . add ( node ) node = d [ node ] ans [ i - 1 ] = node   print ( * ans )   NEW_LINE

def badge ( arr , n ) : """ ▁ DFS ▁ approach ▁ to ▁ check ▁ if ▁ we ▁ visit ▁ a ▁ node ▁ twice """   NEW_LINE


import java . io . * ; import java . util . * ; import java . util . concurrent . TimeUnit ;   public class b429 implements Runnable { public static void main ( String [ ] args ) { try { new Thread ( null , new b429 ( ) , " process " , 1 << 26 ) . start ( ) ; } catch ( Exception e ) { System . out . println ( e ) ; } } public void run ( ) { FastReader scan = new FastReader ( ) ; PrintWriter out = new PrintWriter ( new OutputStreamWriter ( System . out ) ) ;

import sys   n , m = map ( int , sys . stdin . readline ( ) . split ( ) ) d = list ( map ( int , sys . stdin . readline ( ) . split ( ) ) ) gph = [ [ ] for _ in range ( n ) ]   for _ in range ( m ) : u , v = map ( int , sys . stdin . readline ( ) . split ( ) ) u -= 1 v -= 1 gph [ u ] . append ( ( v , _ ) ) gph [ v ] . append ( ( u , _ ) ) t = - 1 if d . count ( 1 ) % 2 == 1 : if - 1 not in d : print ( - 1 ) exit ( 0 ) t = d . index ( - 1 )   ans = [ False ] * mvis = [ False ] * ned = [ ( - 1 , - 1 ) ] * nrets = [ ( d [ u ] == 1 ) or ( u == t ) for u in range ( n ) ]   stk = [ [ 0 , iter ( gph [ 0 ] ) ] ] while len ( stk ) > 0 : u = stk [ - 1 ] [ 0 ] vis [ u ] = True try : while True : v , i = next ( stk [ - 1 ] [ 1 ] ) if not vis [ v ] : ed [ v ] = ( u , i ) stk . append ( [ v , iter ( gph [ v ] ) ] ) break except StopIteration : p , e = ed [ u ] if p >= 0 and rets [ u ] : rets [ p ] = not rets [ p ] ans [ e ] = True stk . pop ( ) pass print ( ans . count ( True ) ) print ( " \n " . join ( [ str ( i + 1 ) for i in range ( m ) if ans [ i ] ] ) ) NEW_LINE


import java . util . * ; import java . io . * ; import java . math . * ;   public class First {   public static void process ( ) throws IOException { char ch [ ] = nln ( ) . trim ( ) . toCharArray ( ) ; HashSet < String > set = new HashSet < String > ( ) ; for ( int i = 0 ; i <= 96 ; i += 4 ) { String x = Integer . toString ( i ) ; if ( i < 10 ) { x = "0" + x ; } set . add ( x ) ; } long count = 0l ; int n = ch . length ; for ( int i = 0 ; i < n ; i ++ ) { if ( i == 0 ) { if ( ch [ i ] == '0' || ch [ i ] == '4' || ch [ i ] == '8' ) {

import java . util . * ;   public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; char [ ] s = sc . nextLine ( ) . toCharArray ( ) ; long sum = 0 ; for ( int i = 0 ; i < s . length ; ++ i ) { if ( ( s [ i ] - '0' ) % 4 == 0 ) { ++ sum ; } } for ( int i = 1 ; i < s . length ; ++ i ) { int x = ( s [ i - 1 ] - '0' ) * 10 + ( s [ i ] - '0' ) ; if ( x % 4 == 0 ) { sum += i ; } } System . out . println ( sum ) ; } }

import java . io . * ;   public class NewSkateboard { public static void main ( String [ ] args ) throws Exception { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ;   String number = input . readLine ( ) ; int n = number . length ( ) ;   input . close ( ) ;   long [ ] dp = new long [ n + 1 ] ; dp [ 0 ] = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { int lastDigit = number . charAt ( i - 1 ) - '0' ; int lastTwoDigits = - 1 ; if ( i >= 2 ) { lastTwoDigits = ( number . charAt ( i - 2 ) - '0' ) * 10 + lastDigit ; }   dp [ i ] = dp [ i - 1 ] ; if ( lastDigit % 4 == 0 ) { dp [ i ] ++ ; }   if ( lastTwoDigits % 4 == 0 ) { dp [ i ] += ( i - 1 ) ; } }   PrintWriter output = new PrintWriter ( System . out ) ; output . println ( dp [ n ] ) ; output . close ( ) ; } }

import java . lang . * ; import java . util . * ; import java . io . * ;   public class pblm2 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; long count = 0 ; int l = s . length ( ) ; for ( int i = l - 1 ; i >= 0 ; i -- ) { if ( Integer . parseInt ( s . charAt ( i ) + " " ) % 4 == 0 ) count ++ ; if ( i > 0 ) { String k = s . charAt ( i - 1 ) + " " + s . charAt ( i ) + " " ;

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

import sysimport os . pathif os . path . exists ( ' input . txt ' ) : sys . stdin = open ( ' input . txt ' , ' r ' ) sys . stdout = open ( ' output . txt ' , ' w ' ) s = input ( ) n = len ( s ) ans = 0 for i in range ( n - 2 , - 1 , - 1 ) : if int ( s [ i ] + s [ i + 1 ] ) % 4 == 0 : ans += i + 1 for i in range ( n ) : if int ( s [ i ] ) % 4 == 0 : ans = ans + 1 print ( ans ) NEW_LINE

s = input ( ) n = len ( s ) ans = 0 for i in range ( 1 , n ) : if int ( s [ i - 1 : i + 1 ] ) % 4 == 0 : ans += ifor i in range ( n ) : if int ( s [ i ] ) % 4 == 0 : ans += 1 print ( ans ) NEW_LINE

s = input ( ) ans = 0 for i in range ( len ( s ) ) : if ( i != len ( s ) - 1 ) : if ( int ( s [ i ] + s [ i + 1 ] ) % 4 == 0 ) : ans += i + 1 NEW_LINE


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

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . util . Arrays ; import java . util . Random ; import java . util . StringTokenizer ;   public class HillAndValleys {    public static int HV ( int [ ] a ) {   int n = a . length ; int mask [ ] = new int [ n ] ;

def is_hv ( i ) : if NEW_LINE i == 0 or i == n - 1 : NEW_LINE return 0 else : if a [ i ] > a [ i - 1 ] and a [ i ] > a [ i + 1 ] : NEW_LINE INDENT return 1 elif a [ i ] < a [ i - 1 ] and a [ i ] < a [ i + 1 ] : NEW_LINE return 1 else : NEW_LINE return 0 NEW_LINE DEDENT for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) NEW_LINE a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE hv = [ 0 ] * n NEW_LINE for i in range ( 1 , n - 1 ) : if NEW_LINE is_hv ( i ) == 1 : hv [ i ] = 1 NEW_LINE s = sum ( hv ) NEW_LINE result = s NEW_LINE for i in range ( n ) : if NEW_LINE hv [ i ] == 1 : t = a [ i ] NEW_LINE for e in [ a [ i - 1 ] , a [ i + 1 ] ] : a [ i ] = e NEW_LINE result = min ( is_hv ( i - 1 ) + is_hv ( i + 1 ) + s - hv [ i - 1 ] - hv [ i + 1 ] - 1 , result ) NEW_LINE a [ i ] = t NEW_LINE print ( result ) NEW_LINE

for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) NEW_LINE a = [ int ( i ) for i in input ( ) . split ( ) ]   hills_and_valleys = [ 0 ] * n NEW_LINE for ind in range ( 1 , n - 1 ) : if NEW_LINE a [ ind - 1 ] < a [ ind ] and a [ ind + 1 ] < a [ ind ] or a [ ind - 1 ] > a [ ind ] and a [ ind + 1 ] > a [ ind ] : hills_and_valleys [ ind ] = 1   sum_of_hills_and_valleys = sum ( hills_and_valleys )   NEW_LINE

for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) NEW_LINE a = [ int ( i ) for i in input ( ) . split ( ) ]   hills_and_valleys = [ 0 ] * n NEW_LINE for ind in range ( 1 , n - 1 ) : if NEW_LINE a [ ind - 1 ] < a [ ind ] and a [ ind + 1 ] < a [ ind ] or a [ ind - 1 ] > a [ ind ] and a [ ind + 1 ] > a [ ind ] : hills_and_valleys [ ind ] = 1   sum_of_hills_and_valleys = sum ( hills_and_valleys )   if n >= 2 : NEW_LINE INDENT left_num_and_right_num = [ [ a [ 0 ] , a [ 1 ] ] ] else : NEW_LINE left_num_and_right_num = [ [ a [ 0 ] , a [ 0 ] ] ]   for ind in range ( 1 , n - 1 ) : left_num_and_right_num . append ( [ a [ ind - 1 ] , a [ ind + 1 ] ] )   if n >= 2 : left_num_and_right_num . append ( [ a [ - 2 ] , a [ - 1 ] ] )   num_of_deleted_ones = 0 NEW_LINE DEDENT for ind in range ( 1 , n - 1 ) : if NEW_LINE hills_and_valleys [ ind - 1 ] == hills_and_valleys [ ind ] == hills_and_valleys [ ind + 1 ] == 1 : num_of_deleted_ones = 3 NEW_LINE break elif hills_and_valleys [ ind ] == 1 : ones = sum ( hills_and_valleys [ ind - 1 : ind + 2 ] )   if a [ ind - 1 ] < a [ ind + 1 ] > left_num_and_right_num [ ind + 1 ] [ 1 ] or   \ a [ ind - 1 ] > a [ ind + 1 ] < left_num_and_right_num [ ind + 1 ] [ 1 ] : num_of_deleted_ones = max ( num_of_deleted_ones , ones - 1 ) else : NEW_LINE INDENT num_of_deleted_ones = max ( num_of_deleted_ones , ones )   if left_num_and_right_num [ ind - 1 ] [ 0 ] < a [ ind - 1 ] > a [ ind + 1 ] or   \ left_num_and_right_num [ ind - 1 ] [ 0 ] > a [ ind - 1 ] < a [ ind + 1 ] : num_of_deleted_ones = max ( num_of_deleted_ones , ones - 1 ) else : NEW_LINE num_of_deleted_ones = max ( num_of_deleted_ones , ones )   print ( sum_of_hills_and_valleys - num_of_deleted_ones ) NEW_LINE DEDENT


import java . util . * ;   public class Main { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; int t = scn . nextInt ( ) ; while ( t -- > 0 ) { int n = scn . nextInt ( ) ; String str = scn . next ( ) ; if ( str . equals ( "2020" ) ) { System . out . println ( " YES " ) ; continue ; } if ( str . substring ( 0 , 4 ) . equals ( "2020" ) || str . substring ( n - 4 , n ) . equals ( "2020" ) ) { System . out . println ( " YES " ) ; continue ; } if ( ( str . substring ( 0 , 3 ) + str . substring ( n - 1 , n ) ) . equals ( "2020" ) || ( str . substring ( 0 , 2 ) + str . substring ( n - 2 , n ) ) . equals ( "2020" ) || ( str . subSequence ( 0 , 1 ) + str . substring ( n - 3 , n ) ) . equals ( "2020" ) ) { System . out . println ( " YES " ) ; continue ; } System . out . println ( " NO " ) ; } } }

import java . util . * ; public class lastyear { public static void main ( String [ ] args ) { int t , n , i ;   String s = " " ;   Scanner sc = new Scanner ( System . in ) ;   t = sc . nextInt ( ) ;   while ( t -- > 0 ) { n = sc . nextInt ( ) ; s = sc . next ( ) ;   if ( s . startsWith ( "2020" ) || s . endsWith ( "2020" ) || ( s . startsWith ( "2" ) && s . endsWith ( "020" ) ) || ( s . startsWith ( "20" ) && s . endsWith ( "20" ) ) || ( s . startsWith ( "202" ) && s . endsWith ( "0" ) ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } }   }   }

import java . util . * ; import java . util . regex . * ; import java . io . * ;   public class Solution {

import java . util . * ;   public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int t = in . nextInt ( ) ; for ( int i = 0 ; i < t ; i ++ ) { int n = in . nextInt ( ) ; char [ ] s = in . next ( ) . toCharArray ( ) ; if ( s [ 0 ] == '2' && s [ 1 ] == '0' && s [ n - 2 ] == '2' && s [ n - 1 ] == '0' ) { System . out . println ( " YES " ) ; } else if ( s [ 0 ] == '2' && s [ n - 3 ] == '0' && s [ n - 2 ] == '2' && s [ n - 1 ] == '0' ) { System . out . println ( " YES " ) ; } else if ( s [ 0 ] == '2' && s [ 1 ] == '0' && s [ 2 ] == '2' && s [ n - 1 ] == '0' ) { System . out . println ( " YES " ) ; } else if ( s [ 0 ] == '2' && s [ 1 ] == '0' && s [ 2 ] == '2' && s [ 3 ] == '0' ) { System . out . println ( " YES " ) ; } else if ( s [ n - 4 ] == '2' && s [ n - 3 ] == '0' && s [ n - 2 ] == '2' && s [ n - 1 ] == '0' ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } }

import java . util . * ; import java . lang . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) throws java . lang . Exception { long i , t ; Scanner sc = new Scanner ( System . in ) ; t = sc . nextLong ( ) ; for ( i = 1 ; i <= t ; i ++ ) { int n ; String s ; n = sc . nextInt ( ) ; s = sc . next ( ) ; if ( s . charAt ( 0 ) == '2' && s . charAt ( 1 ) == '0' && s . charAt ( 2 ) == '2' && s . charAt ( 3 ) == '0' ) { System . out . println ( " yes " ) ; } else if ( s . charAt ( n - 4 ) == '2' && s . charAt ( n - 3 ) == '0' && s . charAt ( n - 2 ) == '2' && s . charAt ( n - 1 ) == '0' ) { System . out . println ( " yes " ) ; } else if ( s . charAt ( 0 ) == '2' && s . charAt ( 1 ) == '0' && s . charAt ( 2 ) == '2' && s . charAt ( n - 1 ) == '0' ) { System . out . println ( " yes " ) ; } else if ( s . charAt ( 0 ) == '2' && s . charAt ( 1 ) == '0' && s . charAt ( n - 2 ) == '2' && s . charAt ( n - 1 ) == '0' ) { System . out . println ( " yes " ) ; } else if ( s . charAt ( 0 ) == '2' && s . charAt ( n - 3 ) == '0' && s . charAt ( n - 2 ) == '2' && s . charAt ( n - 1 ) == '0' ) { System . out . println ( " yes " ) ; } else { System . out . println ( " no " ) ; } } } }

for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) NEW_LINE s = input ( ) NEW_LINE t = [ ] NEW_LINE a = s [ : 4 ] NEW_LINE t . append ( a ) NEW_LINE b = s [ - 4 ] + s [ - 3 ] + s [ - 2 ] + s [ - 1 ] NEW_LINE t . append ( b ) NEW_LINE c = s [ 0 ] + s [ - 3 ] + s [ - 2 ] + s [ - 1 ] NEW_LINE t . append ( c ) NEW_LINE d = s [ : 2 ] + s [ - 2 ] + s [ - 1 ] NEW_LINE t . append ( d ) NEW_LINE e = s [ : 3 ] + s [ - 1 ] NEW_LINE t . append ( e ) NEW_LINE if '2020' in t : NEW_LINE INDENT print ( ' YES ' ) else : NEW_LINE print ( ' NO ' ) NEW_LINE DEDENT

t = int ( input ( ) )   for i in range ( t ) : n = list ( map ( int , input ( ) . split ( ) ) )   s = input ( )     l = len ( s ) NEW_LINE

t = int ( input ( ) ) NEW_LINE for x in range ( t ) : n = int ( input ( ) ) NEW_LINE s = input ( )   if ( s [ : 1 ] == "2" and s [ n - 3 : ] == "020" ) : print ( " YES " )   elif ( s [ : 2 ] == "20" and s [ n - 2 : ] == "20" ) : print ( " YES " ) elif ( s [ : 3 ] == "202" and s [ n - 1 : ] == "0" ) : print ( " YES " )   elif ( s [ : 4 ] == "2020" or s [ n - 4 : ] == "2020" ) : print ( " YES " )   else : print ( " NO " )   NEW_LINE

t = int ( input ( ) )   NEW_LINE def testcase ( s ) : temp = "2020" NEW_LINE if s == " " : print ( " NO " ) NEW_LINE return n = len ( s ) - 4 NEW_LINE for i in range ( 5 ) : curr = s [ : i ] + s [ i + n : ] NEW_LINE if curr == temp : print ( " YES " ) NEW_LINE return print ( " NO " )   for _ in range ( t ) : n = int ( input ( ) ) NEW_LINE s = input ( ) NEW_LINE testcase ( s ) NEW_LINE

t = int ( input ( ) ) NEW_LINE while t : t -= 1 NEW_LINE n = int ( input ( ) ) NEW_LINE st = input ( ) NEW_LINE if st [ 0 : 1 ] == "2" and st [ n - 3 : ] == "020" or st [ 0 : 2 ] == "20" and st [ n - 2 : ] == "20" or st [ 0 : 3 ] == "202" and st [ n - 1 : ] == "0" or st [ 0 : 4 ] == "2020" or st [ n - 4 : ] == "2020" : NEW_LINE INDENT print ( " YES " ) else : NEW_LINE print ( " NO " ) NEW_LINE DEDENT


import java . util . Scanner ;   public class SystemofEquations { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int m = scanner . nextInt ( ) ; int a = ( int ) Math . max ( Math . sqrt ( n ) , Math . sqrt ( m ) ) ; int b = Math . max ( m , n ) - ( int ) Math . pow ( a , 2 ) ;

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

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class NewClass {   public static void main ( String [ ] args ) throws IOException {   BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer tok = new StringTokenizer ( reader . readLine ( ) ) ; int n = Integer . parseInt ( tok . nextToken ( ) ) , m = Integer . parseInt ( tok . nextToken ( ) ) , min = Math . min ( n , m ) , count = 0 , x , y ;   for ( int i = 0 ; i <= min ; i ++ ) { for ( int j = 0 ; j <= min ; j ++ ) { x = ( int ) Math . pow ( i , 2 ) + j ; y = ( int ) Math . pow ( j , 2 ) + i ; if ( m == y && x == n ) { count ++ ; } } } System . out . println ( count ) ; } }

import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int m = scan . nextInt ( ) ; int ans = 0 ; for ( int a = 0 ; a * a <= n && a <= m ; a ++ ) { int b = n - a * a ; if ( a + ( b * b ) == m ) { ans ++ ; } } System . out . print ( ans ) ; } }

n , m = map ( int , input ( ) . split ( ) )     count = 0 for i in range ( 0 , int ( n ** ( 1 / 2 ) ) + 1 ) : for j in range ( 0 , int ( m ** ( 1 / 2 ) ) + 1 ) : if ( i ** 2 ) + j == n and i + ( j ** 2 ) == m : count += 1   print ( count ) NEW_LINE

n , m = map ( int , input ( ) . split ( ) ) i = 0 c = 0 while i ** 2 <= n : if i + ( n - i ** 2 ) ** 2 == m : c += 1 i += 1 print ( c ) NEW_LINE

n , m = map ( int , input ( ) . split ( ) ) count = 0 a = 0 while a ** 2 <= n : b = n - a ** 2 if b >= 0 and a + b ** 2 == m : count += 1 a += 1 print ( count ) NEW_LINE

n , m = map ( int , input ( ) . split ( ) ) a = 0 b = 0 pair = 0   while a <= n : while b <= m : if ( a ** 2 ) + b == n and a + ( b ** 2 ) == m : pair += 1 b += 1 a += 1 b = 0 print ( pair ) NEW_LINE


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

import java . util . * ;   public class Test { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; double n = input . nextDouble ( ) ; double p = input . nextDouble ( ) ; double q = input . nextDouble ( ) ; System . out . printf ( Locale . UK , " % .4f \n " , p * n / ( p + q ) ) ; } }

import java . util . * ;   public class Test { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; double n = input . nextDouble ( ) ; double p = input . nextDouble ( ) ; double q = input . nextDouble ( ) ; double res = p * n / ( p + q ) ; if ( res % 1 != 0 ) System . out . printf ( Locale . UK , " % .4f \n " , res ) ; else System . out . printf ( " % d \n " , ( int ) res ) ; } }

import java . util . Scanner ;   public class Main {   public static void main ( String [ ] args ) { Scanner S = new Scanner ( System . in ) ; int i = S . nextInt ( ) ; int v1 = S . nextInt ( ) ; int v2 = S . nextInt ( ) ;   System . out . println ( i / ( Float . parseFloat ( String . valueOf ( v2 ) ) / v1 + 1 ) ) ; } }

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

a = int ( input ( ) ) b = int ( input ( ) ) c = int ( input ( ) )   print ( a / ( b + c ) * b ) NEW_LINE

l = int ( input ( ) ) p = int ( input ( ) ) q = int ( input ( ) ) c = p / ( p + q ) print ( c * l ) NEW_LINE

l = int ( input ( ) ) p = int ( input ( ) ) q = int ( input ( ) )   time = l / ( p + q ) print ( p * time ) NEW_LINE

s = int ( input ( ) ) p = int ( input ( ) ) q = int ( input ( ) ) print ( s * p / ( p + q ) ) NEW_LINE

l , p , q = [ int ( input ( ) ) for _ in [ 1 , 2 , 3 ] ] print ( l * p / ( p + q ) ) NEW_LINE


import java . util . * ; import java . util . Arrays ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; for ( int j = 0 ; j < n ; j ++ ) { int k = sc . nextInt ( ) ; int temp = 0 , res = 0 ; String students = sc . next ( ) ; char [ ] a = new char [ k ] ; a = students . toCharArray ( ) ; for ( int x = 0 ; x < k ; x ++ ) { a [ x ] = students . charAt ( x ) ; } for ( int i = k - 1 ; i >= 0 ; i -- ) { if ( a [ i ] == ' A ' ) { res = Math . max ( res , temp ) ; temp = 0 ; } else { temp ++ ; } } System . out . println ( res ) ; } } }

import java . util . * ; public class Solution { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int t = s . nextInt ( ) ; for ( int i = 0 ; i < t ; i ++ ) { int count = 0 , count1 = 0 ; int n = s . nextInt ( ) ; s . nextLine ( ) ; String s1 = s . nextLine ( ) ; boolean jt = false ; for ( int j = 0 ; j < s1 . length ( ) ; j ++ ) { if ( s1 . charAt ( j ) == ' A ' ) jt = true ; if ( s1 . charAt ( j ) == ' P ' && jt == true ) { count ++ ; } else { count = 0 ; } if ( count > count1 ) count1 = count ; } System . out . println ( count1 ) ; } } }

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

t = int ( input ( ) ) for q in range ( t ) : n = int ( input ( ) ) s = input ( ) c = 0 while " AP " in s : s = s . replace ( " AP " , " AA " ) c += 1 print ( c ) NEW_LINE

for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) a = input ( ) . split ( ' A ' ) max1 = 0 for i in range ( 1 , len ( a ) ) : max1 = max ( max1 , len ( a [ i ] ) ) print ( max1 )     NEW_LINE

I = inputexec ( int ( I ( ) ) * " I ( ) ; print ( max ( 0,0 , * map ( len , I ( ) . split ( ' A ' ) [ 1 : ] ) ) ) ; " ) NEW_LINE

from sys import stdin , stdoutimport math , bisectfrom collections import Counter , deque , defaultdictL = lambda : list ( map ( int , stdin . readline ( ) . strip ( ) . split ( ) ) ) M = lambda : map ( int , stdin . readline ( ) . strip ( ) . split ( ) ) I = lambda : int ( stdin . readline ( ) . strip ( ) ) S = lambda : stdin . readline ( ) . strip ( ) C = lambda : stdin . readline ( ) . strip ( ) . split ( ) def pr ( a ) : return ( " ▁ " . join ( list ( map ( str , a ) ) ) ) NEW_LINE

x = int ( input ( ) ) for i in range ( x ) : n = int ( input ( ) ) s = input ( ) b = [ ] for j in range ( n ) : if ( s [ j ] == " A " ) : b . append ( j ) d = 0 if ( len ( b ) > 0 ) : for k in range ( 0 , len ( b ) - 1 ) : t = b [ k + 1 ] - b [ k ] - 1 d = max ( d , t ) if ( b [ - 1 ] != n - 1 ) : t = n - 1 - b [ - 1 ] d = max ( t , d ) print ( d ) else : print ( 0 ) NEW_LINE


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

import java . util . * ;   import javafx . util . Pair ;   import java . io . * ;   public class Main { static int [ ] dx = { 0 , 1 , 0 , - 1 } ;

import java . io . * ; import java . util . * ; public class Main { public static IO in ; public static PrintWriter out ; static void init_io ( String filename ) throws Exception { if ( filename . equals ( " " ) ) { in = new IO ( System . in ) ; out = new PrintWriter ( new BufferedWriter ( new OutputStreamWriter ( System . out ) ) , true ) ; } else { in = new IO ( new FileInputStream ( filename + " . in " ) ) ; out = new PrintWriter ( new BufferedWriter ( new FileWriter ( filename + " . out " ) ) , true ) ; } } final static long mod = 1000000007 ; static int n , m ; static int pack ( int r , int c , int dir , int nturns ) { return r * m * 12 + c * 12 + dir * 3 + nturns ; } static int pack2 ( int pos , int dir , int nturns ) { return pos * 12 + dir * 3 + nturns ; } static int dr [ ] = new int [ ] { 0 , 0 , - 1 , 1 } ; static int dc [ ] = new int [ ] { 1 , - 1 , 0 , 0 } ; static boolean valid ( int r , int c ) { return r >= 0 && r < n && c >= 0 && c < m ; } static void solve ( int tc ) throws Exception { n = in . nint ( ) ; m = in . nint ( ) ; boolean [ ] [ ] grid = new boolean [ n ] [ m ] ; boolean [ ] vis = new boolean [ n * m * 12 ] ; int spos = 0 , tpos = 0 ; for ( int i = 0 ; i < n ; i ++ ) { String s = in . nstr ( ) ; for ( int j = 0 ; j < m ; j ++ ) { if ( s . charAt ( j ) == ' S ' ) spos = i * m + j ; if ( s . charAt ( j ) == ' T ' ) tpos = i * m + j ; grid [ i ] [ j ] = ( s . charAt ( j ) != ' * ' ) ; } } int [ ] queue = new int [ 15000000 ] ;

n , m = map ( int , input ( ) . split ( ) ) mat = [ ] ans = - 1 for i in range ( n ) : mat . append ( input ( ) )   s , d = - 1 , - 1 for i in range ( n ) : for j in range ( m ) : if mat [ i ] [ j ] == ' S ' : s = ( i , j ) if mat [ i ] [ j ] == ' T ' : d = ( i , j )   q = [ ( s [ 0 ] , s [ 1 ] , - 1 , - 1 ) ] vis = [ 0 ] * ( n * m ) pos = 0 found = False   tmp = [ ( 0 , 1 , 1 ) , ( 0 , - 1 , 1 ) , ( 1 , 0 , 0 ) , ( - 1 , 0 , 0 ) ] for a , b , c in tmp : x , y = d while x < n and x >= 0 and y < m and y >= 0 and not mat [ x ] [ y ] == ' * ' : vis [ x * m + y ] = - 1 x += a y += b NEW_LINE

from typing import List , Set , Dictdef map2home ( n : int , m : int , map_in : List [ List [ str ] ] , turns : int ) -> List [ list ] : def validate ( i , j ) : return True if 0 <= i < n and 0 <= j < m and map_in [ i ] [ j ] != - 1 else False     def check ( i , j , count ) : if end == ( i , j ) : return 1 if count <= turns else - 1 else : return 0 NEW_LINE

import sysinput = sys . stdin . readline   def q ( sx , sy , gx , gy ) : for i in range ( sx , gx + 1 ) : for j in range ( sy , gy + 1 ) : if S [ i ] [ j ] == ' * ' : return False return True   n , m = map ( int , input ( ) . split ( ) ) S = [ input ( ) [ : - 1 ] for _ in range ( n ) ]   for i in range ( n ) : for j in range ( m ) : if S [ i ] [ j ] == ' S ' : Sx , Sy = i , j if S [ i ] [ j ] == ' T ' : Tx , Ty = i , j   for i in range ( n ) : if q ( min ( i , Sx ) , Sy , max ( i , Sx ) , Sy ) and q ( i , min ( Sy , Ty ) , i , max ( Sy , Ty ) ) and q ( min ( i , Tx ) , Ty , max ( i , Tx ) , Ty ) : print ( ' YES ' ) exit ( )   for i in range ( m ) : if q ( Sx , min ( i , Sy ) , Sx , max ( i , Sy ) ) and q ( min ( Sx , Tx ) , i , max ( Sx , Tx ) , i ) and q ( Tx , min ( i , Ty ) , Tx , max ( i , Ty ) ) : print ( ' YES ' ) exit ( )   print ( ' NO ' ) NEW_LINE

n , m = map ( int , input ( ) . split ( ) ) a = [ ] x , y = 0 , 0     def f ( c , x , y ) : for i in range ( x + 1 , n ) : if a [ i ] [ y ] == ' T ' : print ( ' YES ' ) exit ( ) if a [ i ] [ y ] == ' . ' : a [ i ] [ y ] = c elif a [ i ] [ y ] != c : break for i in range ( x - 1 , - 1 , - 1 ) : if a [ i ] [ y ] == ' T ' : print ( ' YES ' ) exit ( ) if a [ i ] [ y ] == ' . ' : a [ i ] [ y ] = c elif a [ i ] [ y ] != c : break for j in range ( y + 1 , m ) : if a [ x ] [ j ] == ' T ' : print ( ' YES ' ) exit ( ) if a [ x ] [ j ] == ' . ' : a [ x ] [ j ] = c elif a [ x ] [ j ] != c : break for j in range ( y - 1 , - 1 , - 1 ) : if a [ x ] [ j ] == ' T ' : print ( ' YES ' ) exit ( ) if a [ x ] [ j ] == ' . ' : a [ x ] [ j ] = c elif a [ x ] [ j ] != c : break     for i in range ( n ) : s = input ( ) for j in range ( m ) : if s [ j ] == ' S ' : x , y = i , j a . append ( list ( s ) ) f ( '1' , x , y ) for i in range ( n ) : for j in range ( m ) : if a [ i ] [ j ] == '1' : f ( '2' , i , j ) for i in range ( n ) : for j in range ( m ) : if a [ i ] [ j ] == '2' : f ( '3' , i , j ) print ( ' NO ' )     NEW_LINE


import java . util . * ; import java . io . * ;   public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; StringBuilder s = new StringBuilder ( input . next ( ) ) ; StringBuilder ans = new StringBuilder ( ) ; int x = 0 ; int y = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == ' x ' ) x ++ ; else y ++ ; } int max = Math . max ( x , y ) ; int min = Math . min ( x , y ) ; if ( max == x ) for ( int i = 0 ; i < ( max - min ) ; i ++ ) { ans . append ( " x " ) ; } else for ( int i = 0 ; i < ( max - min ) ; i ++ ) { ans . append ( " y " ) ; } System . out . println ( ans ) ; } }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class CodeParsing {   static class FastReader { BufferedReader br ; StringTokenizer st ;   public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; }   String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   long nextLong ( ) { return Long . parseLong ( next ( ) ) ; }   double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; }   String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } public static void main ( String [ ] args ) { FastReader sc = new FastReader ( ) ; String s = sc . next ( ) ; int x = 0 ; int y = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == ' x ' ) { x ++ ; } else { y ++ ; } } int m = Math . abs ( x - y ) ; char a ; StringBuilder sb = new StringBuilder ( ) ; if ( x > y ) { a = ' x ' ; } else { a = ' y ' ; } for ( int i = 0 ; i < m ; i ++ ) { sb . append ( a ) ; } System . out . println ( sb . toString ( ) ) ; }   }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . StringTokenizer ; import java . util . * ; public class codeParsing { static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } public static void main ( String [ ] args ) { FastReader sc = new FastReader ( ) ; String s = sc . next ( ) ; int count_x = 0 ; int count_y = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == ' x ' ) { count_x ++ ; } else { count_y ++ ; } }   StringBuilder ans = new StringBuilder ( ) ; int k = 0 ; char c ; if ( count_x > count_y ) { c = ' x ' ; k = count_x - count_y ; } else { c = ' y ' ; k = count_y - count_x ; } while ( k -- > 0 ) { ans . append ( c ) ; } System . out . println ( ans ) ; } }

import java . util . Arrays ; import java . util . Scanner ;   public class B255 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int x = 0 ; int y = 0 ; for ( char c : in . next ( ) . toCharArray ( ) ) { if ( c == ' x ' ) { x ++ ; } else { y ++ ; } } char [ ] array ; if ( x >= y ) { x -= y ; array = new char [ x ] ; Arrays . fill ( array , ' x ' ) ; } else { y -= x ; array = new char [ y ] ; Arrays . fill ( array , ' y ' ) ; } System . out . println ( new String ( array ) ) ; }   }

import java . util . Scanner ;   public class CodeParsing {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; char [ ] c = sc . next ( ) . toCharArray ( ) ; int x = 0 , y = 0 ; for ( char ch : c ) { if ( ch == ' x ' ) x ++ ; else y ++ ; } StringBuilder ans = new StringBuilder ( ) ; int left ; left = Math . abs ( x - y ) ; char ansChar = x > y ? ' x ' : ' y ' ; while ( left -- > 0 ) ans . append ( ansChar ) ; System . out . println ( ans . toString ( ) ) ; sc . close ( ) ; } }

L = input ( )     s1 = L . count ( " x " ) s2 = L . count ( " y " ) x = max ( s1 , s2 ) v = abs ( s1 - s2 ) if x == L . count ( " x " ) : print ( " x " * v ) else : print ( " y " * v ) NEW_LINE

n = input ( ) stack = [ ] for i in n : if stack == [ ] : stack . append ( i ) else : s = stack . pop ( ) if s == ' y ' and i == ' x ' : pass elif s == ' x ' and i == ' y ' : pass else : stack . append ( s ) stack . append ( i ) for i in stack : print ( i , end = ' ' ) NEW_LINE

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

s = input ( ) xs = s . count ( " x " ) ys = s . count ( " y " )   if xs > ys : print ( " x " * ( xs - ys ) ) else : print ( " y " * ( ys - xs ) ) NEW_LINE


import java . io . * ; import java . util . * ; public class Main { public static void main ( String args [ ] ) { FastReader input = new FastReader ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; int T = 1 ; while ( T -- > 0 ) { long k = input . nextLong ( ) ; long v = 9 ; long s = 0 ; int x = 1 ; while ( true ) { if ( s + v * x > k ) { break ; } s += v * x ; v *= 10 ; x ++ ; } if ( s == k ) { out . println ( 9 ) ; } else { long d = k - s ; long u = d / x ; long rem = d % x ; long nu = ( long ) Math . pow ( 10 , x - 1 ) ; nu += u ; if ( rem == 0 ) { nu -- ; out . println ( nu % 10 ) ; } else { String str = String . valueOf ( nu ) ; out . println ( str . charAt ( ( int ) ( rem - 1 ) ) ) ; } } } out . close ( ) ; } 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 . * ; import java . io . * ; import java . text . * ;   public class Main {

import java . util . Scanner ;   public class B1177 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; long N = in . nextLong ( ) ; long answer = solve ( N , 0 , 1 , 1 ) ; System . out . println ( answer ) ; }   static long solve ( long N , long offset , long start , int digits ) { long thisSection = digits * start * 9 ; long fromOffset = N - offset ; if ( fromOffset > thisSection ) { return solve ( N , offset + thisSection , 10 * start , digits + 1 ) ; } long number = start + ( fromOffset - 1 ) / digits ; long posInNumber = digits - 1 - ( fromOffset - 1 ) % digits ; while ( posInNumber > 0 ) { posInNumber -- ; number /= 10 ; } return number % 10 ; }   }

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 ) {

def main ( ) : k = int ( input ( ) ) n , tenPow , s = 1 , 1 , 0 while ( ( s + 9 * tenPow * n ) < k ) : s += 9 * tenPow * n n += 1 tenPow *= 10 num = str ( tenPow - 1 + ( k - s + n - 1 ) // n ) print ( num [ ( k - s - 1 ) % n ] )   if __name__ == " _ _ main _ _ " : main ( )   NEW_LINE

pre_cal_sum_dec = { } def sum_dec ( n ) : ''' Sum ▁ of ▁ 10 * * n ▁ + ▁ 10 * * ( n - 1 ) ▁ + ▁ . . . ▁ 10 * * 1 ▁ ▁ ▁ ▁ Parameter : ▁ n : ▁ number ▁ ▁ ▁ ▁ Return : ▁ result ▁ of ▁ the ▁ sum ''' global pre_cal_sum_dec try : return pre_cal_sum_dec [ n ] except : sumer = 0 for i in range ( 1 , n ) : sumer += 10 ** i pre_cal_sum_dec [ n ] = sumer return sumerdef find_head ( digits ) : ''' Find ▁ the ▁ starting ▁ number ▁ of ▁ a ▁ digit ▁ cluster : ▁ ex : ▁ 10 ▁ for ▁ 2 - dig ; ▁ 190 ▁ for ▁ 3 - dig ''' if digits < 1 : return 0 elif digits == 1 : return 1 else : return ( digits - 1 ) * 10 ** ( digits - 1 ) - sum_dec ( digits - 1 )   def cutter ( start , end ) : listo = [ 0 for _ in range ( 10 ) ] part = ( end - start ) // 9 listo [ 0 ] = start for each in range ( 1 , 10 ) : start += part listo [ each ] = start return listodef finder ( number ) : x , i = 0 , 0 if number == 1 : return 1 while x < number : bef = x x = find_head ( i ) i += 1 if x == number : return 1 e = i - 2 number = number - bef interval = e * 10 ** ( e - 1 ) col = number % e NEW_LINE

pre_cal_sum_dec = { } def sum_dec ( n ) : ''' Sum ▁ of ▁ 10 * * n ▁ + ▁ 10 * * ( n - 1 ) ▁ + ▁ . . . ▁ 10 * * 1 ▁ ▁ ▁ ▁ Parameter : ▁ n : ▁ number ▁ ▁ ▁ ▁ Return : ▁ result ▁ of ▁ the ▁ sum ''' global pre_cal_sum_dec try : return pre_cal_sum_dec [ n ] except : sumer = 0 for i in range ( 1 , n ) : sumer += 10 ** i pre_cal_sum_dec [ n ] = sumer return sumerdef find_head ( digits ) : ''' Find ▁ the ▁ starting ▁ number ▁ of ▁ a ▁ digit ▁ cluster : ▁ ex : ▁ 10 ▁ for ▁ 2 - dig ; ▁ 190 ▁ for ▁ 3 - dig ''' if digits < 1 : return 0 elif digits == 1 : return 1 else : return ( digits - 1 ) * 10 ** ( digits - 1 ) - sum_dec ( digits - 1 )   list_of_head = [ find_head ( i ) for i in range ( 18 ) ] def finder ( number ) : x , i = 0 , 1 if number == 1 : return 1 for x in list_of_head [ 1 : ] : if x > number : break bef = x i += 1 if x == number : return 1 e = i - 1 number = number - bef interval = e * 10 ** ( e - 1 ) col = number % e NEW_LINE


import java . util . * ; import java . io . * ;   public class B { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; char [ ] [ ] arr = new char [ 11 ] [ 11 ] ; for ( int i = 0 ; i < 11 ; i ++ ) { arr [ i ] = in . nextLine ( ) . toCharArray ( ) ; } int x = in . nextInt ( ) ; int y = in . nextInt ( ) ; x = ( x - 1 ) % 3 ; y = ( y - 1 ) % 3 ; boolean untouched = true ; for ( int i = 0 ; i < 3 ; i ++ ) { for ( int j = 0 ; j < 3 ; j ++ ) { if ( arr [ i + ( 4 * x ) ] [ j + ( 4 * y ) ] == ' . ' ) { untouched = false ; arr [ i + ( 4 * x ) ] [ j + ( 4 * y ) ] = ' ! ' ; } } } for ( int i = 0 ; i < 11 ; i ++ ) { if ( ! ( i == 3 || i == 7 ) ) { for ( int j = 0 ; j < 11 ; j ++ ) { if ( untouched && arr [ i ] [ j ] == ' . ' ) System . out . print ( ' ! ' ) ; else System . out . print ( arr [ i ] [ j ] ) ; } } System . out . println ( ) ; } } }

board = [ list ( input ( ) ) for i in range ( 11 ) ] ( x , y ) = map ( int , input ( ) . split ( ) )   x = ( x - 1 ) % 3 y = ( y - 1 ) % 3   can = Falsefor i in range ( 3 ) : for j in range ( 3 ) : if board [ x * 4 + i ] [ y * 4 + j ] == ' . ' : board [ x * 4 + i ] [ y * 4 + j ] = ' ! ' can = True if not can : for i in range ( 11 ) : if i % 4 != 3 : for j in range ( 11 ) : if board [ i ] [ j ] == ' . ' : board [ i ] [ j ] = ' ! '   for i in range ( 11 ) : print ( ' ' . join ( board [ i ] ) ) NEW_LINE

X = [ ] count = 0 while ( count < 9 ) : Y = input ( ) Z = [ char for char in Y if char != ' ▁ ' ] if Z != [ ] : X . append ( Z ) count += 1 x , y = map ( int , input ( ) . split ( ) ) u = ( x - 1 ) % 3 v = ( y - 1 ) % 3 ok = False for i in range ( 3 ) : for j in range ( 3 ) : t , s = 3 * u + i , 3 * v + j if X [ t ] [ s ] == ' . ' : X [ t ] [ s ] = ' ! ' ok = True if ok == False : for i in range ( 9 ) : for j in range ( 9 ) : if X [ i ] [ j ] == ' . ' : X [ i ] [ j ] = ' ! ' cnt = 0 for i in X : cnt += 1 [ u1 , u2 , u3 , u4 , u5 , u6 , u7 , u8 , u9 ] = i print ( u1 + u2 + u3 + " ▁ " + u4 + u5 + u6 + " ▁ " + u7 + u8 + u9 ) if cnt == 3 or cnt == 6 : print ( " ▁ " ) NEW_LINE


import java . util . * ;    public class CodeforcesContest { private static long sport ( int [ ] a , char [ ] chars ) { int n = a . length ; long [ ] pa = new long [ n + 1 ] ; long [ ] pb = new long [ n + 1 ] ; for ( int i = 1 ; i < n + 1 ; i ++ ) { if ( chars [ i - 1 ] == ' A ' ) { pa [ i ] += pa [ i - 1 ] + a [ i - 1 ] ; pb [ i ] = pb [ i - 1 ] ; } else { pb [ i ] += pb [ i - 1 ] + a [ i - 1 ] ; pa [ i ] = pa [ i - 1 ] ; } } int from = Integer . MAX_VALUE ; int to = Integer . MAX_VALUE ; long max = 0 ;

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

n = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) ; s = input ( ) if n == 1 : print ( arr [ 0 ] ) ; exit ( ) NEW_LINE

n = int ( input ( ) ) p = list ( map ( int , input ( ) . split ( ) ) ) s = input ( ) total = 0 for i in range ( n ) : if s [ i ] == ' B ' : total += p [ i ] ans = totalcur = totalfor i in range ( n ) : if s [ i ] == ' A ' : cur += p [ i ] else : cur -= p [ i ] ans = max ( ans , cur )   cur = totalfor i in reversed ( range ( n ) ) : if s [ i ] == ' A ' : cur += p [ i ] else : cur -= p [ i ] ans = max ( ans , cur )   print ( ans ) NEW_LINE

n = int ( input ( ) ) p = list ( map ( int , input ( ) . split ( ) ) ) s = input ( ) ogmx = 0 premx = [ 0 ] * ( n + 1 ) sufmx = [ 0 ] * ( n + 1 ) NEW_LINE

n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) s = input ( ) def m ( s , a ) : q , w = 0 , 0 for i in range ( n ) : if s [ i ] == " A " : q += a [ i ] else : w += a [ i ] r = w for i in range ( n ) : if s [ i ] == " A " : w += a [ i ] ; q -= a [ i ] else : q += a [ i ] ; w -= a [ i ] r = max ( r , w ) return rprint ( max ( m ( s , a ) , m ( s [ : : - 1 ] , a [ : : - 1 ] ) ) ) NEW_LINE


import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner s = new Scanner ( System . in ) ; int t = s . nextInt ( ) ; while ( t -- != 0 ) { String a = s . next ( ) ; String b = s . next ( ) ; int num = lcm ( a . length ( ) , b . length ( ) ) ;

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class B_String_LCM {   static Scanner scanner = new Scanner ( ) ; static int testCases ; static String mul ( String s , int k ) { StringBuilder sb = new StringBuilder ( ) ; while ( k -- >= 1 ) { sb . append ( s ) ; } return sb . toString ( ) ; } static int gcd ( int a , int b ) { if ( a == 0 ) return b ; if ( b == 0 ) return a ; if ( a == b ) return a ; if ( a > b ) return gcd ( a - b , b ) ; return gcd ( a , b - a ) ; } static void solve ( String a , String b ) { int n = a . length ( ) , m = b . length ( ) ; int g = gcd ( n , m ) ; if ( mul ( a , m / g ) . equalsIgnoreCase ( mul ( b , n / g ) ) ) { System . out . println ( mul ( a , m / g ) ) ; } else { System . out . println ( - 1 ) ; } } public static void main ( String [ ] args ) throws IOException { testCases = scanner . nextInt ( ) ; for ( int i = 0 ; i < testCases ; i ++ ) { solve ( scanner . next ( ) , scanner . next ( ) ) ; } } static class Scanner { BufferedReader in ; StringTokenizer st ;   public Scanner ( ) { in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) throws IOException { while ( st == null || ! st . hasMoreElements ( ) ) { st = new StringTokenizer ( in . readLine ( ) ) ; } return st . nextToken ( ) ; } int nextInt ( ) throws IOException { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) throws IOException { return Long . parseLong ( next ( ) ) ; } String nextLine ( ) throws IOException { return in . readLine ( ) ; } } }

import java . util . * ; import java . lang . * ; import java . io . * ;    public class Codechef { static int hcf ( int a , int b ) { int hcf = 1 ; for ( int i = 1 ; i <= a || i <= b ; i ++ ) { if ( a % i == 0 && b % i == 0 ) hcf = i ; } return hcf ; } public static void main ( String [ ] args ) throws java . lang . Exception { Scanner sc = new Scanner ( System . in ) ; int tt = sc . nextInt ( ) ; sc . nextLine ( ) ; while ( tt -- != 0 ) { String s , t ; s = sc . nextLine ( ) ; t = sc . nextLine ( ) ; int x = s . length ( ) ; int y = t . length ( ) ; int lcm = ( x * y ) / hcf ( x , y ) ; int a = lcm / x ; int b = lcm / y ; String s1 = " " , s2 = " " ; for ( int i = 1 ; i <= a ; i ++ ) { s1 += s ; } for ( int i = 1 ; i <= b ; i ++ ) { s2 += t ; } if ( s1 . equals ( s2 ) ) { System . out . println ( s1 ) ; } else System . out . println ( - 1 ) ; } } }

import java . util . Scanner ;   public class B1473 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int T = in . nextInt ( ) ; for ( int t = 0 ; t < T ; t ++ ) { String A = in . next ( ) ; String B = in . next ( ) ; int a = A . length ( ) ; int b = B . length ( ) ; int gcd = gcd ( a , b ) ; int aCopies = b / gcd ; int bCopies = a / gcd ; StringBuilder aa = new StringBuilder ( ) ; StringBuilder bb = new StringBuilder ( ) ; for ( int i = 0 ; i < aCopies ; i ++ ) { aa . append ( A ) ; } for ( int i = 0 ; i < bCopies ; i ++ ) { bb . append ( B ) ; } boolean ok = aa . toString ( ) . equals ( bb . toString ( ) ) ; System . out . println ( ok ? aa : " - 1" ) ; } }   static int gcd ( int a , int b ) { return ( b == 0 ) ? a : gcd ( b , a % b ) ; }   }

import mathfor NEW_LINE _ in range ( int ( input ( ) ) ) : s1 = input ( ) NEW_LINE s2 = input ( ) NEW_LINE g = math . gcd ( len ( s1 ) , len ( s2 ) ) NEW_LINE if ( len ( s2 ) // g * s1 == len ( s1 ) // g * s2 ) : NEW_LINE INDENT print ( len ( s2 ) // g * s1 ) else : NEW_LINE print ( - 1 ) NEW_LINE DEDENT

for _ in range ( 0 , int ( input ( ) ) ) : s , t = input ( ) , input ( ) NEW_LINE p , q = len ( s ) , len ( t ) NEW_LINE while p != q : if NEW_LINE p > q : q = q + len ( t ) else : p = p + len ( s ) NEW_LINE f , g = ( int ( q / len ( t ) ) , int ( p / len ( s ) ) ) NEW_LINE if s * g == t * f : NEW_LINE INDENT print ( s * g ) else : NEW_LINE print ( - 1 ) NEW_LINE DEDENT

a = int ( input ( ) ) NEW_LINE for i in range ( a ) : s = input ( ) NEW_LINE t = input ( ) NEW_LINE n1 = len ( t ) NEW_LINE n2 = len ( s ) NEW_LINE x = n1 NEW_LINE while x >= n1 : if NEW_LINE x % n2 == 0 and x % n1 == 0 : alpha = x NEW_LINE break NEW_LINE x += 1 NEW_LINE

import math   testCases = int ( input ( ) )   for i in range ( testCases ) : stringA = input ( ) NEW_LINE stringB = input ( ) NEW_LINE a = len ( stringA ) NEW_LINE b = len ( stringB ) NEW_LINE LCM = a * b // math . gcd ( a , b ) NEW_LINE stringAlcm = stringA * ( LCM // a ) NEW_LINE stringBlcm = stringB * ( LCM // b ) NEW_LINE if stringAlcm == stringBlcm : NEW_LINE INDENT print ( stringAlcm ) else : NEW_LINE print ( - 1 ) NEW_LINE DEDENT


import java . util . Scanner ;   public class Stairways { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int a [ ] = new int [ n + 1 ] ; int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] == 1 ) { ++ ans ; } } System . out . println ( ans ) ; int c = 0 ; a [ n ] = 1 ; for ( int i = 1 ; i < n + 1 ; i ++ ) { if ( a [ i ] != 1 ) { ++ c ; } else { System . out . print ( ( c + 1 ) + " ▁ " ) ; c = 0 ; } } } }

import java . util . ArrayList ; import java . util . Scanner ;   public class JavaApplication4 { public static void main ( String [ ] args ) { int sum , x , counter = 0 ; ArrayList < Integer > max = new ArrayList < > ( ) ; Scanner scan = new Scanner ( System . in ) ; int i = 0 ; x = scan . nextInt ( ) ; int n [ ] = new int [ x ] ; if ( x == 1 ) { n [ 0 ] = scan . nextInt ( ) ; counter = 1 ; max . add ( 1 ) ; } else { for ( i = 0 ; i < x ; i ++ ) { n [ i ] = scan . nextInt ( ) ; if ( n [ i ] == 1 ) counter ++ ; if ( i != 0 & n [ i ] == 1 ) max . add ( n [ i - 1 ] ) ; } max . add ( n [ i - 1 ] ) ; } System . out . println ( counter ) ; max . forEach ( ( t ) -> { System . out . print ( t + " ▁ " ) ; } ) ;  	  }

n = int ( input ( ) )   arr = [ int ( i ) for i in input ( ) . split ( ) ] arr = arr [ 1 : : ] + [ arr [ 0 ] ] x = 1 ans = [ ]   for i in arr : if i == 1 : ans . append ( x ) x = 1 else : x += 1   print ( len ( ans ) ) print ( * ans )   NEW_LINE

input ( ) a = input ( ) . split ( ) l = [ x for x , y in zip ( a , a [ 1 : ] + [ '1' ] ) if '1' == y ] print ( len ( l ) ) print ( * l ) NEW_LINE

n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) c = 0 s = [ ] d = 1 for i in l : if ( i == d ) : d += 1 else : s . append ( d - 1 ) d = 2 c += 1 s . append ( d - 1 ) c += 1 print ( c ) for i in s : print ( i , end = ' ▁ ' ) NEW_LINE


import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . * ; import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ;   public class Test {   public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskA solver = new TaskA ( ) ; solver . call ( in , out ) ; out . close ( ) ; }   static class TaskA { public void call ( InputReader in , PrintWriter out ) { int n , a , b = 1 ; n = in . nextInt ( ) ; a = ( n / 2 ) + 1 ; out . println ( a ) ; for ( int i = 1 , j = 1 ; i <= a && j <= a ; i ++ ) { if ( b > n ) break ; if ( b % 2 == 0 ) { out . println ( j + " ▁ " + i ) ; j ++ ; i -- ; } else { out . println ( j + " ▁ " + i ) ; } b ++ ;   }       } }   static class InputReader { public BufferedReader reader ; public StringTokenizer tokenizer ;   public InputReader ( InputStream stream ) { reader = new BufferedReader ( new InputStreamReader ( stream ) , 32768 ) ; tokenizer = null ; }   public String next ( ) { while ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( ) ; }   public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } public long nextLong ( ) { return Long . parseLong ( next ( ) ) ; }   } }

import java . io . * ; import java . util . * ; public class Mohammad { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) , c = n / 2 ; System . out . println ( ++ c ) ; for ( int i = 1 ; i <= c ; i ++ ) System . out . println ( 1 + " ▁ " + i ) ; for ( int i = 2 ; i <= n - c + 1 ; i ++ ) System . out . println ( c + " ▁ " + i ) ; } }

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

import mathimport sysfrom collections import * import itertools def cint ( ) : return list ( map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ) ) ) def cstr ( ) : return list ( map ( str , input ( ) . split ( ' ▁ ' ) ) )     def gcd ( a , b ) : if ( b == 0 ) : return a return gcd ( b , a % b )     def solve ( t ) : n = int ( input ( ) ) r = ( n + 1 ) // 2   if ( n + 1 ) / 2 != ( n + 1 ) // 2 : r += 1   print ( r ) indx = 1 for i in range ( n ) : if i < r : print ( 0 + 1 , i + 1 ) else : print ( indx + 1 , r ) indx += 1 	 	 	       if __name__ == " _ _ main _ _ " : NEW_LINE

import matha = int ( input ( ) ) m = math . ceil ( ( a + 1 ) / 2 ) print ( m ) for i in range ( 1 , min ( a + 1 , m + 1 ) ) : print ( 1 , i ) a = a - 1 for i in range ( m - a + 1 , m + 1 ) : if ( a <= 0 ) : break print ( m , i ) a = a - 1 NEW_LINE

n = int ( input ( ) ) m = n // 2 + 1 print ( m ) for i in range ( n ) : print ( i // 2 + 1 , i // 2 + 1 + i % 2 ) NEW_LINE

n = int ( input ( ) ) if ( ( n - 1 ) % 2 == 1 ) : c = ( ( n - 1 ) // 2 ) + 1 else : c = ( n - 1 ) // 2 c += 1 r = 1 print ( c ) for i in range ( 1 , n + 1 ) : if ( i <= n - c ) : print ( "1" , end = " ▁ " ) print ( i ) else : print ( c , end = " ▁ " ) print ( r ) r += 1 NEW_LINE


import java . util . * ; import java . io . * ; import java . lang . * ;   public class MainClass { private static BufferedReader br = null ; private static StringTokenizer st = null ; static { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } private static String str ( ) throws IOException { return br . readLine ( ) ; } private static int ints ( ) throws IOException { return Integer . parseInt ( br . readLine ( ) ) ; } private static int [ ] ints ( int N ) throws IOException { st = new StringTokenizer ( br . readLine ( ) ) ; int [ ] nums = new int [ N ] ; for ( int i = 0 ; i < N ; i += 1 ) { nums [ i ] = Integer . parseInt ( st . nextToken ( ) ) ; } return nums ; } public static void main ( String [ ] args ) throws IOException { String [ ] str = br . readLine ( ) . split ( " ▁ " ) ; long N = Long . parseLong ( str [ 0 ] ) ; long K = Long . parseLong ( str [ 1 ] ) ; Solution obj = new Solution ( ) ; long [ ] ans = obj . dipCertiNotWinners ( N , K ) ; System . out . println ( ans [ 0 ] + " ▁ " + ans [ 1 ] + " ▁ " + ans [ 2 ] ) ; br . close ( ) ; } }   class Solution { public long [ ] dipCertiNotWinners ( long N , long K ) {

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

import java . io . * ; import java . util . * ;   public class Training { public static void main ( String [ ] args ) throws IOException { Scanner input = new Scanner ( System . in ) ; long n = input . nextLong ( ) , k = input . nextLong ( ) ; long a = n / 2 / ( k + 1 ) ; long b = a * k ; System . out . println ( a + " ▁ " + b + " ▁ " + ( n - a - b ) ) ;   }

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

import java . util . * ;   public class P1 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ;   long n = sc . nextLong ( ) ; long k = sc . nextLong ( ) ; if ( n <= k ) { System . out . println ( 0 + " ▁ " + 0 + " ▁ " + n ) ;   } else { long a = ( n / 2 ) / ( k + 1 ) ;   long b = k * a ; long N = n - ( a + a * k ) ; System . out . println ( a + " ▁ " + b + " ▁ " + N ) ; }   } }

n , k = map ( int , input ( ) . split ( ) )   certificate = n // 2 // ( k + 1 ) * kdiplomas = n // 2 // ( k + 1 ) non_winners = n - diplomas - certificate   print ( diplomas , certificate , non_winners ) NEW_LINE

a , b = map ( int , input ( ) . split ( ) ) c = a // 2 d = c // ( b + 1 ) e = b * dprint ( d , e , a - d - e ) NEW_LINE

n , k = map ( int , input ( ) . split ( ) ) d = n // ( 2 * ( k + 1 ) ) c = k * dnw = n - ( c + d ) print ( d , c , nw ) NEW_LINE

n , k = map ( int , input ( ) . split ( ) ) d = ( n // 2 ) // ( k + 1 ) print ( d , k * d , n - ( k + 1 ) * d ) NEW_LINE


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

import java . util . Arrays ; import java . util . Scanner ;   public class RainDestroyer { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ;   int n = scan . nextInt ( ) ; int [ ] a = new int [ n ] ; int [ ] sort = new int [ n ] ;   for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = scan . nextInt ( ) ; sort [ i ] = a [ i ] ; }   Arrays . sort ( sort ) ;   int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { if ( sort [ i ] == a [ j ] ) { if ( j == 0 || j == n - 1 || a [ j - 1 ] <= a [ j ] || a [ j + 1 ] <= a [ j ] ) { ans = sort [ i ] ; } } } if ( ans > 0 ) { System . out . println ( ans ) ; break ; } } } }

n = int ( input ( ) ) x = list ( map ( int , input ( ) . split ( ) ) ) m = min ( x ) l = mc = 0 a = x [ 0 ] b = x [ - 1 ] flag = 0 while True : m = 2 ** 20 for i in range ( 1 , n - 1 ) : x [ i ] -= l if x [ i ] <= 0 and x [ i - 1 ] <= 0 : flag = 1 break if x [ i ] > 0 : m = min ( m , x [ i ] ) c += l if c > a or c > b : break if flag == 1 : break l = mprint ( min ( c , a , b ) ) NEW_LINE

if __name__ == ' _ _ main _ _ ' : n = int ( input ( ) ) a = [ 0 ] + [ int ( i ) for i in input ( ) . split ( ) ] + [ 0 ] mx = 10 ** 6 + 1   for i in range ( n + 1 ) : mx = min ( mx , max ( a [ i ] , a [ i + 1 ] ) )   print ( mx ) NEW_LINE

n , a = int ( input ( ) ) , [ 0 ] + list ( map ( int , input ( ) . split ( ) ) ) + [ 0 ] x = [ ] for i in range ( n + 1 ) : x . append ( max ( a [ i ] , a [ i + 1 ] ) ) print ( min ( x ) ) NEW_LINE


import java . util . * ;   public class TCS1 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . nextLine ( ) ; String str = sc . nextLine ( ) ; String a = str . split ( " ▁ " ) [ 0 ] ; String b = str . split ( " ▁ " ) [ 1 ] ; String temp = "6789TJQKA " ; if ( a . charAt ( 1 ) == b . charAt ( 1 ) ) { if ( temp . indexOf ( a . charAt ( 0 ) ) > temp . indexOf ( b . charAt ( 0 ) ) ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } else { if ( a . charAt ( 1 ) == s . charAt ( 0 ) ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } }

import java . util . * ;   public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int first = 0 , second = 0 ; String wrong = input . next ( ) ; String First = input . next ( ) ; String Second = input . next ( ) ; if ( First . charAt ( 0 ) == ' T ' ) first = 10 ; else if ( First . charAt ( 0 ) == ' J ' ) first = 11 ; else if ( First . charAt ( 0 ) == ' Q ' ) first = 12 ; else if ( First . charAt ( 0 ) == ' K ' ) first = 13 ; else if ( First . charAt ( 0 ) == ' A ' ) first = 14 ; else first = First . charAt ( 0 ) - '0' ; if ( Second . charAt ( 0 ) == ' T ' ) second = 10 ; else if ( Second . charAt ( 0 ) == ' J ' ) second = 11 ; else if ( Second . charAt ( 0 ) == ' Q ' ) second = 12 ; else if ( Second . charAt ( 0 ) == ' K ' ) second = 13 ; else if ( Second . charAt ( 0 ) == ' A ' ) second = 14 ; else second = Second . charAt ( 0 ) - '0' ; if ( First . charAt ( 1 ) == wrong . charAt ( 0 ) && ( Second . charAt ( 1 ) != wrong . charAt ( 0 ) ) ) System . out . println ( " YES " ) ; else if ( First . charAt ( 1 ) == Second . charAt ( 1 ) && first > second ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; }         }

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

c = [ '6' , '7' , '8' , '9' , ' T ' , ' J ' , ' Q ' , ' K ' , ' A ' ] t = input ( ) f , s = input ( ) . split ( ) if f [ 1 ] == t and s [ 1 ] != t : print ( ' YES ' ) exit ( ) elif s [ 1 ] == t and f [ 1 ] != t : print ( ' NO ' ) exit ( ) if f [ 1 ] != s [ 1 ] : print ( ' NO ' ) elif c . index ( f [ 0 ] ) > c . index ( s [ 0 ] ) : print ( ' YES ' ) else : print ( ' NO ' ) NEW_LINE

s = input ( ) a , b = map ( str , input ( ) . split ( ) ) NEW_LINE

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


import java . io . * ; import java . math . * ; import java . security . * ; import java . text . * ; import java . time . LocalTime ; import java . util . * ; import java . util . concurrent . * ; import java . util . regex . * ;    public class Main {    public static void main ( String [ ] args ) { FastScanner scan = new FastScanner ( ) ; int n = scan . nextInt ( ) ; double ans = 0 ; while ( n > 0 ) { double temp = ( double ) 1 / n ; ans += temp ; n -- ; } System . out . println ( ans ) ; } public static long divisor ( long n ) { for ( long i = 3 ; i < n ; i ++ ) { if ( n % i == 0 ) return i ; } return n ; } public static void sort ( int [ ] a ) { ArrayList < Integer > b = new ArrayList < > ( ) ; for ( int i : a ) b . add ( i ) ; Collections . sort ( b ) ; for ( int i = 0 ; i < a . length ; i ++ ) a [ i ] = b . get ( i ) ; } static class FastScanner { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( " " ) ; String next ( ) { while ( ! st . hasMoreTokens ( ) ) try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } int [ ] readArray ( int n ) { int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextInt ( ) ; return a ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } } }

import java . util . Scanner ;   public class JOEisOnTV { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; if ( n == 1 ) { System . out . println ( "1" ) ; return ; } double d = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { d = d + ( float ) 1 / i ; } System . out . println ( d ) ; } }

import java . util . * ; import java . lang . * ; import java . io . * ;   public class Solution { public static void main ( String [ ] args ) throws java . lang . Exception { java . io . BufferedReader br = new java . io . BufferedReader ( new java . io . InputStreamReader ( System . in ) ) ; OutputStream outputStream = System . out ; PrintWriter out = new PrintWriter ( outputStream ) ; int n = Integer . parseInt ( br . readLine ( ) . trim ( ) ) ; double ans = 0.0 ; for ( int i = 1 ; i <= n ; i ++ ) ans += 1.0 / i ; out . println ( ans ) ; out . close ( ) ; } }

n = int ( input ( ) ) i = 1 ans = 0 while ( i <= n ) : ans += 1 / i i += 1 print ( ans ) NEW_LINE

import matht = int ( input ( ) ) ans = 0 for i in range ( t ) : ans = ans + 1 / t t -= 1 print ( ans )   NEW_LINE

import sys   n = int ( sys . stdin . readline ( ) )   sigma = 0 total = n   while total : sigma += ( 1 / total ) total -= 1 print ( sigma ) NEW_LINE

import sys   input = sys . stdin . readline   def main ( ) : n = int ( input ( ) )   ans = 0 for i in range ( 1 , n + 1 ) : ans += 1 / n n -= 1   print ( ans )   main ( ) NEW_LINE