import java . util . * ; import java . io . * ; import java . lang . * ; public class Main {   static class FastReader {   BufferedReader br ;   StringTokenizer st ;   public FastReader ( ) throws IOException {   br = new BufferedReader ( new InputStreamReader ( System . in ) ) ;   }   public FastReader ( String s ) throws IOException {   br = new BufferedReader ( new FileReader ( new File ( s ) ) ) ;   }   String next ( ) {   while ( st == null || ! st . hasMoreElements ( ) ) {   try {   st = new StringTokenizer ( br . readLine ( ) ) ;   }   catch ( Exception e ) {   e . printStackTrace ( ) ;   }                     }   return st . nextToken ( ) ;   }   String nextLine ( ) {   String str = " " ;   try {   str = br . readLine ( ) ;   }   catch ( Exception e ) {   e . printStackTrace ( ) ;   }   return str ;   }   int nextInt ( ) {   return Integer . parseInt ( next ( ) ) ;   }   long nextLong ( ) {   return Long . parseLong ( next ( ) ) ;   }   double nextDouble ( ) {   return Double . parseDouble ( next ( ) ) ;   }   } public static void main ( String [ ] args ) throws IOException { FastReader in = new FastReader ( ) ; int n = in . nextInt ( ) ; int m = in . nextInt ( ) ; int k = in . nextInt ( ) ; int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = in . nextInt ( ) ; if ( n % 2 == 0 ) System . out . println ( 0 ) ; else { int b = a [ 0 ] ; for ( int i = 2 ; i < n ; i += 2 ) b = Math . min ( a [ i ] , b ) ; System . out . println ( Math . min ( b , 1L * m / ( ( n + 1 ) / 2 ) * k ) ) ; } } }


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

n = int ( input ( ) ) NEW_LINE for i in range ( n ) : a = int ( input ( ) ) NEW_LINE s = [ int ( i ) for i in input ( ) . split ( ' ▁ ' ) ] NEW_LINE count = { } NEW_LINE for j in range ( a ) : for NEW_LINE k in range ( j + 1 , a ) : compute = s [ k ] - s [ j ] NEW_LINE if compute not in count : count [ compute ] = 1 NEW_LINE print ( len ( count ) ) NEW_LINE


t = int ( input ( ) ) NEW_LINE for i in range ( t ) : n = int ( input ( ) ) NEW_LINE l = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE l1 = [ ] NEW_LINE for i in l : for NEW_LINE j in l : NEW_LINE if ( i != j ) : l1 . append ( abs ( i - j ) ) NEW_LINE s = len ( set ( l1 ) ) NEW_LINE print ( s ) NEW_LINE


for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) NEW_LINE l = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE a = [ ] NEW_LINE for i in l : a . append ( i / 2 ) NEW_LINE s = set ( ) NEW_LINE for i in range ( n - 1 ) : for NEW_LINE j in range ( i + 1 , n ) : s . add ( a [ j ] - a [ i ] ) NEW_LINE print ( len ( s ) ) NEW_LINE


import java . util . * ; public class bovine { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ;   int t , n , area ; area = 0 ;   t = sc . nextInt ( ) ;   while ( t -- > 0 ) { n = sc . nextInt ( ) ;   int a [ ] = new int [ n ] ;   for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; }   HashSet < Integer > al = new HashSet < Integer > ( ) ;   for ( int i = 0 ; i < n - 1 ; i ++ ) { for ( int j = i + 1 ; j < n ; j ++ ) { area = a [ j ] - a [ i ] ; al . add ( area ) ; } } System . out . println ( al . size ( ) ) ; }   }   }


import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ;   public class A1466 {   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 [ ] X = new int [ N ] ; for ( int n = 0 ; n < N ; n ++ ) { X [ n ] = in . nextInt ( ) ; } Set < Integer > set = new HashSet < > ( ) ; for ( int from = 0 ; from < N ; from ++ ) { for ( int to = from + 1 ; to < N ; to ++ ) { int area = X [ to ] - X [ from ] ;


import java . util . * ; public class Solution { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { HashSet < Long > h = new HashSet < > ( ) ; int n = sc . nextInt ( ) ; long a [ ] = new long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextLong ( ) ; } for ( int i = 0 ; i < n ; i ++ ) { for ( int j = i + 1 ; j < n ; j ++ ) { h . add ( Math . abs ( a [ j ] - a [ i ] ) ) ; } } System . out . println ( h . size ( ) ) ; } } }


import java . util . * ;   public class A1466 {   public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int t = scanner . nextInt ( ) , i , j , k , count ; for ( int f = 0 ; f < t ; f ++ ) { int n = scanner . nextInt ( ) ; k = 0 ; count = 0 ; int a [ ] = new int [ n ] ; int b [ ] = new int [ n * n ] ; for ( i = 0 ; i < n ; i ++ ) { a [ i ] = scanner . nextInt ( ) ; } for ( i = 0 ; i < n ; i ++ ) { for ( j = i + 1 ; j < n ; j ++ ) { b [ k ] = a [ j ] - a [ i ] ; k ++ ; } }   for ( i = 0 ; i < k ; i ++ ) { if ( b [ i ] != - 1 ) { count ++ ; for ( j = i + 1 ; j < k ; j ++ ) { if ( b [ i ] == b [ j ] ) { b [ j ] = - 1 ; } } } } System . out . println ( count ) ; } } }


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

for t in range ( int ( input ( ) ) ) : n = int ( input ( ) ) NEW_LINE if n in [ 1 , 2 , 4 ] : print ( - 1 ) NEW_LINE continue NEW_LINE x = y = z = 0 NEW_LINE z = n // 7 NEW_LINE left = [ [ 0 , 0 , 0 ] , [ 1 , 1 , - 1 ] , [ 3 , 0 , - 1 ] , [ 1 , 0 , 0 ] , [ 2 , 1 , - 1 ] , [ 0 , 1 , 0 ] , [ 2 , 0 , 0 ] ] NEW_LINE x += left [ n % 7 ] [ 0 ] NEW_LINE y += left [ n % 7 ] [ 1 ] NEW_LINE z += left [ n % 7 ] [ 2 ] NEW_LINE print ( x , y , z ) NEW_LINE


import sysinput = sys . stdin . readline   for _ in range ( int ( input ( ) ) ) : NEW_LINE


for i in range ( int ( input ( ) ) ) : num = int ( input ( ) ) NEW_LINE if num % 3 != 0 and num < 5 : NEW_LINE INDENT print ( - 1 ) elif num % 3 == 0 : NEW_LINE print ( num // 3 , 0 , 0 ) elif num % 5 == 0 : NEW_LINE print ( 0 , num // 5 , 0 ) elif num % 7 == 0 : NEW_LINE print ( 0 , 0 , num // 7 ) else : NEW_LINE remain = num % 5 NEW_LINE DEDENT while True : if NEW_LINE remain % 3 == 0 : print ( remain // 3 , num // 5 , 0 ) NEW_LINE break elif remain % 7 == 0 : print ( 0 , num // 5 , remain // 7 ) NEW_LINE break NEW_LINE num1 = 5 * ( ( num // 5 ) - 1 ) NEW_LINE remain = num - num1 NEW_LINE num = num1 NEW_LINE


t = int ( input ( ) ) NEW_LINE for a in range ( t ) : x , y , z = - 1 , - 1 , - 1 NEW_LINE n = int ( input ( ) ) NEW_LINE for i in range ( n // 7 + 1 ) : for NEW_LINE j in range ( n // 5 + 1 ) : NEW_LINE


cases = int ( input ( ) ) NEW_LINE while cases : cases -= 1 NEW_LINE num = int ( input ( ) )   if num in [ 1 , 2 , 4 ] : print ( - 1 ) NEW_LINE continue   if num % 3 == 0 : NEW_LINE INDENT print ( num // 3 , 0 , 0 ) elif num % 5 == 0 : NEW_LINE print ( 0 , num // 5 , 0 ) elif num % 7 == 0 : NEW_LINE print ( 0 , 0 , num // 7 ) else : NEW_LINE thr = 0 NEW_LINE DEDENT while num % 3 != 0 and num > 0 : num -= 3 NEW_LINE thr += 1 NEW_LINE if num % 5 == 0 : print ( thr , num // 5 , 0 ) NEW_LINE break NEW_LINE if num % 7 == 0 : print ( thr , 0 , num // 7 ) NEW_LINE break   NEW_LINE


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


import java . io . BufferedReader ; import java . io . InputStreamReader ;   public class cf1430A {   public static void main ( String [ ] args ) throws Exception {   BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ;   int testCases = Integer . parseInt ( in . readLine ( ) ) ;   for ( int i = 0 ; i < testCases ; i ++ ) {   int windowsCount = Integer . parseInt ( in . readLine ( ) ) ; for ( int k = 0 ; k < windowsCount ; k ++ ) { for ( int l = 0 ; l < windowsCount ; l ++ ) { for ( int m = 0 ; m < windowsCount ; m ++ ) { if ( k * 3 + l * 5 + m * 7 == windowsCount ) { System . out . println ( k + " ▁ " + l + " ▁ " + m ) ; k = windowsCount ; l = windowsCount ; m = windowsCount ; } else if ( k == windowsCount - 1 && m == windowsCount - 1 && l == windowsCount - 1 && ! ( k * 3 + l * 5 + m * 7 == windowsCount ) ) { System . out . println ( " - 1" ) ; } } } } } } }


import java . util . Scanner ;   public class A1430 {   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 three = 0 ; int five = 0 ; int seven = 0 ; if ( N % 3 == 2 ) { N -= 5 ; five ++ ; } else if ( N % 3 == 1 ) { N -= 7 ; seven ++ ; } if ( N < 0 ) { System . out . println ( " - 1" ) ; } else { three = N / 3 ; System . out . println ( three + " ▁ " + five + " ▁ " + seven ) ; } } }   }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . StringTokenizer ;   public class CF103B { static class UndirectedGraph { ArrayList < Integer > [ ] adjList ; int n ;   UndirectedGraph ( int n ) { this . n = n ; adjList = new ArrayList [ n ] ; Arrays . setAll ( adjList , i -> new ArrayList < Integer > ( ) ) ; }   void addEdge ( int v , int u ) { adjList [ v ] . add ( u ) ; adjList [ u ] . add ( v ) ; }   int cyclesCnt ( ) { int [ ] visited = new int [ n ] ; int cnt = dfs ( 0 , - 1 , visited ) ; for ( int i = 0 ; i < n ; i ++ ) if ( visited [ i ] == 0 )

def find ( node ) : while p [ node ] != node : p [ node ] = p [ p [ node ] ] node = p [ node ] return nodedef union ( n1 , n2 ) : a1 = find ( n1 ) a2 = find ( n2 )   if a1 != a2 : p [ a1 ] = a2     n , m = map ( int , input ( ) . split ( ) ) p = [ i for i in range ( n + 1 ) ] cnt = 0 for _ in range ( m ) : a , b = map ( int , input ( ) . split ( ) ) if find ( a ) == find ( b ) : cnt += 1 union ( a , b )   cnt2 = 0 for i in range ( 1 , n + 1 ) : if p [ i ] == i : cnt2 += 1 if cnt == 1 and cnt2 == 1 : print ( ' FHTAGN ! ' ) else : print ( " NO " ) NEW_LINE


import io , osinput = io . BytesIO ( os . read ( 0 , os . fstat ( 0 ) . st_size ) ) . readline from collections import defaultdict n , m = map ( int , input ( ) . split ( ) ) adj = defaultdict ( list ) for i in range ( m ) : x , y = map ( int , input ( ) . split ( ) ) adj [ x ] . append ( y ) adj [ y ] . append ( x ) ok = Falsecmps = [ ] v = [ 0 ] * ( n + 1 ) for i in range ( 1 , 1 + n ) : if not v [ i ] : q = [ i ] cmp = [ ] while q : e = q . pop ( ) if not v [ e ] : cmp . append ( e ) v [ e ] = 1 for j in adj [ e ] : if not v [ j ] : q . append ( j ) cmps . append ( cmp ) for i in cmps : if len ( i ) > 2 : s = 0 for j in i : s += len ( adj [ j ] ) s //= 2 if s == len ( i ) : ok = True print ( " FHTAGN ! " if ok and len ( cmps ) == 1 else " NO " ) NEW_LINE


import io , osinput = io . BytesIO ( os . read ( 0 , os . fstat ( 0 ) . st_size ) ) . readlinefrom collections import defaultdict   n , m = map ( int , input ( ) . split ( ) ) adj = defaultdict ( list )   for i in range ( m ) : x , y = map ( int , input ( ) . split ( ) ) adj [ x ] . append ( y ) adj [ y ] . append ( x ) cmps = 0 v = [ 0 ] * ( n + 1 )   for i in range ( 1 , 1 + n ) : if not v [ i ] : q = [ i ] while q : e = q . pop ( ) v [ e ] = 1 for j in adj [ e ] : if not v [ j ] : q . append ( j ) cmps += 1 print ( " FHTAGN ! " if n == m and cmps == 1 else " NO " ) NEW_LINE


import osimport sysfrom io import BytesIO , IOBaseBUFSIZE = 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 . util . Scanner ;   public class Main { static Scanner sc = new Scanner ( System . in ) ; static int n = sc . nextInt ( ) ; static int m = sc . nextInt ( ) ; static int f [ ] = new int [ n + 1 ] ;


import java . io . IOException ; import java . util . * ; import java . util . Arrays ; import java . util . Scanner ;   public class Bit_year { static List < Integer > [ ] adj ; static boolean [ ] visited ; static int cyclenumber ;


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

a , b = map ( int , input ( ) . split ( ) ) ans = 0 seen = set ( ) while b : b -= 1   num = int ( input ( ) ) ans += 1 rem = num % a   if rem in seen : print ( ans ) exit ( ) else : seen . add ( rem )   print ( - 1 )         NEW_LINE


from collections import Counter n , k = map ( int , input ( ) . split ( ) ) c = Counter ( ) ans = - 1 for i in range ( 1 , k + 1 ) : x = int ( input ( ) ) c [ x % n ] += 1 if ans == - 1 and c [ x % n ] > 1 : ans = i print ( ans ) NEW_LINE


def solve ( arr , p ) : d = { } for i in range ( len ( arr ) ) : res = arr [ i ] % p if not d . get ( res ) : d [ res ] = 1 else : return i + 1 return - 1 def main ( ) : p , n = list ( map ( int , input ( ) . split ( ' ▁ ' ) ) ) arr = [ ] for _ in range ( n ) : i = int ( input ( ) ) arr . append ( i ) print ( solve ( arr , p ) ) main ( ) NEW_LINE


p , n = map ( int , input ( ) . split ( ) )   lst = [ - 1 ] * p   res = - 1 for i in range ( n ) : x = int ( input ( ) ) if 0 <= ( x % p ) <= p - 1 : if lst [ x % p ] == - 1 : lst [ x % p ] = x elif lst [ x % p ] != - 1 : res = i break     print ( res if res < 0 else res + 1 ) NEW_LINE


n , m = map ( int , input ( ) . split ( ) ) x = [ ] t = [ - 1 ] * mj = 0 c = Falsefor i in range ( m ) : x += list ( map ( int , input ( ) . split ( ) ) ) for k in range ( m ) : t [ j ] = x [ k ] % n j += 1 for l in range ( m ) : for y in range ( 0 , l ) : if l != y : if t [ l ] == t [ y ] : c = True print ( l + 1 ) exit ( ) if c == False : print ( - 1 ) NEW_LINE


import com . sun . org . apache . bcel . internal . generic . AALOAD ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . math . BigInteger ; import java . util . * ; import java . util . stream . IntStream ; import javafx . util . Pair ;   public class Main {   static void sort ( int a [ ] ) { Random ran = new Random ( ) ; for ( int i = 0 ; i < a . length ; i ++ ) { int r = ran . nextInt ( a . length ) ; int temp = a [ r ] ; a [ r ] = a [ i ] ; a [ i ] = temp ; }   Arrays . sort ( a ) ; }   public static void main ( String [ ] args ) throws IOException {   Scanner input = new Scanner ( System . in ) ;   int n , b ; b = input . nextInt ( ) ; n = input . nextInt ( ) ; HashMap < Integer , Integer > map = new HashMap < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { int value = input . nextInt ( ) % b ; if ( map . containsKey ( value ) ) { System . out . println ( i + 1 ) ; return ; } else { map . put ( value , 1 ) ; } } System . out . println ( " - 1" ) ; }   }


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 _p000447A { static public void main ( final String [ ] args ) throws IOException { p000447A . _main ( args ) ; }


import java . util . Scanner ;   public class DZYHash { public static void main ( String [ ] args ) {   Scanner in = new Scanner ( System . in ) ; int p = in . nextInt ( ) , n = in . nextInt ( ) , a [ ] = new int [ p ] , i , o = - 1 ;   for ( i = 0 ; i < n ; i ++ ) { int x = in . nextInt ( ) ; a [ x % p ] ++ ; if ( a [ x % p ] > 1 ) { o = i + 1 ; break ; } } in . close ( ) ; System . out . println ( o ) ; } }


import java . util . Scanner ;   public class Main {   public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int p = input . nextInt ( ) ; int n = input . nextInt ( ) ; boolean [ ] freq = new boolean [ 301 ] ; int result = - 1 ; for ( int i = 0 ; i < n ; i ++ ) { int num = input . nextInt ( ) ; int h = num % p ; if ( freq [ h ] ) { result = i + 1 ; break ; } freq [ h ] = true ; } System . out . println ( result ) ; }   }


import java . util . * ;   public class Main { public static void main ( String [ ] args ) {   Scanner sc = new Scanner ( System . in ) ;   int n = sc . nextInt ( ) ; String arr [ ] [ ] = new String [ n ] [ n ] ;   for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = sc . next ( ) . split ( " " ) ; } String standard1 = arr [ 0 ] [ 0 ] ; String standard2 = arr [ 0 ] [ 1 ] ; if ( standard1 . equals ( standard2 ) ) { System . out . println ( " NO " ) ; return ; }   int wide = n / 2 ; for ( int i = 0 ; i < n ; i ++ ) { if ( ! ( arr [ i ] [ i ] . equals ( standard1 ) & arr [ i ] [ n - i - 1 ] . equals ( standard1 ) ) ) { System . out . println ( " NO " ) ; return ; } for ( int j = 0 ; j < n ; j ++ ) { if ( j != i & j != n - i - 1 ) { if ( ! arr [ i ] [ j ] . equals ( standard2 ) ) { System . out . println ( " NO " ) ; return ; } } } } System . out . println ( " YES " ) ;   } }

def solve ( arr , n ) : last_d = arr [ 0 ] [ 0 ] last = arr [ 0 ] [ 1 ] for i in range ( n ) : for j in range ( n ) : if i == j or i == n - j - 1 : if last_d != arr [ i ] [ j ] or last == arr [ i ] [ j ] : return ' NO ' else : if last != arr [ i ] [ j ] or arr [ i ] [ j ] == last_d : return ' NO ' return ' YES '             def main ( ) : NEW_LINE


n = int ( input ( ) ) x1 = input ( ) d = x1 [ 0 ] o = x1 [ 1 ] if d == o : print ( ' NO ' ) else : for i in range ( n - 1 ) : x = input ( ) x1 += x c = ' ' l = 1 rl = n for i in range ( 1 , n + 1 ) : if i == ( ( n // 2 ) + 1 ) : c += ( n // 2 ) * o + d + ( n // 2 ) * o l += 1 rl -= 1 continue for e in range ( 1 , n + 1 ) : if e == l or e == rl : c += d else : c += o l += 1 rl -= 1 if c == x1 : print ( ' YES ' ) else : print ( ' NO ' ) NEW_LINE


diag = [ ] nond = [ ] t = int ( input ( ) ) for a in range ( t ) : s = input ( ) diag . append ( s [ 0 + a ] ) diag . append ( s [ t - 1 - a ] ) for b in s : nond . append ( b ) nond . remove ( s [ 0 + a ] ) if t - 1 - a != 0 + a : nond . remove ( s [ t - 1 - a ] ) if len ( diag ) == diag . count ( diag [ 0 ] ) and len ( nond ) == nond . count ( nond [ 0 ] ) and nond [ 0 ] != diag [ 0 ] : print ( " YES " ) else : print ( " NO " ) NEW_LINE


diag = [ ] nond = [ ] t = int ( input ( ) ) for a in range ( t ) : s = input ( ) for b in range ( len ( s ) ) : if b == 0 + a or b == t - 1 - a : diag . append ( s [ b ] ) else : nond . append ( s [ b ] ) if len ( diag ) == diag . count ( diag [ 0 ] ) and len ( nond ) == nond . count ( nond [ 0 ] ) and nond [ 0 ] != diag [ 0 ] : print ( " YES " ) else : print ( " NO " ) NEW_LINE


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


import java . util . Scanner ;   public class JavaApplication1 {   public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; String [ ] str = new String [ n ] ; boolean flag = true ; for ( int i = 0 ; i < n ; i ++ ) { str [ i ] = input . next ( ) ; } char diagonalLetter = str [ 0 ] . charAt ( 0 ) ; char secondLetter = str [ 0 ] . charAt ( 1 ) ; if ( diagonalLetter == secondLetter ) flag = false ; else { for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { if ( i == j || j == n - i - 1 ) { if ( str [ i ] . charAt ( j ) != diagonalLetter ) { flag = false ; break ; } } else { if ( str [ i ] . charAt ( j ) != secondLetter ) { flag = false ; break ; } } } if ( ! flag ) break ; } } if ( flag ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; input . close ( ) ; } }


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


import java . util . Scanner ; public class A { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; String board [ ] = new String [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { board [ i ] = in . next ( ) ; } boolean ok = true ; char l1 = board [ 0 ] . charAt ( 0 ) ; char l2 = board [ 0 ] . charAt ( 1 ) ; if ( l1 == l2 ) { ok = false ; } for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { if ( i == j || i == ( n - j - 1 ) ) { if ( board [ i ] . charAt ( j ) != l1 ) { ok = false ; } } else { if ( board [ i ] . charAt ( j ) != l2 ) { ok = false ; } } } } System . out . println ( ok ? " YES " : " NO " ) ; } }


import java . util . Scanner ;   public class Main {   public static void main ( String [ ] args ) {   String input = new Scanner ( System . in ) . nextLine ( ) ; String [ ] costs = input . split ( " [ a - z ] { 1,10 } " ) ;   double sum = 0 ; for ( String cost : costs ) { if ( cost . isEmpty ( ) ) continue ; if ( cost . matches ( " ( [1-9 ] [ 0-9 ] { 0,2 } | 0 ) ( \\ . [0-9 ] { 3 } ) * ( \\ . [0-9 ] { 2 } ) ? " ) ) { if ( cost . length ( ) > 3 && cost . charAt ( cost . length ( ) - 3 ) == ' . ' ) cost = cost . substring ( 0 , cost . length ( ) - 3 ) + " # " + cost . substring ( cost . length ( ) - 2 ) ; cost = cost . replace ( " . " , " " ) ; cost = cost . replace ( " # " , " . " ) ; sum += Double . parseDouble ( cost ) ; } else { System . out . println ( " Invalid ▁ Input " ) ; return ; } }   String output = Long . toString ( Math . round ( sum * 100 ) / 100 ) + " . " + String . format ( " % 02d " , ( Math . round ( sum * 100 ) % 100 ) ) ; while ( output . indexOf ( ' . ' ) > 3 ) output = output . substring ( 0 , output . indexOf ( ' . ' ) - 3 ) + " . " + output . substring ( output . indexOf ( ' . ' ) - 3 ) ; if ( output . endsWith ( " . 00" ) ) output = output . substring ( 0 , output . length ( ) - 3 ) ; System . out . println ( output ) ; } }

import reimport pdb   inputNumbers = re . findall ( r ' [0-9 . ] + ' , input ( ) )     def convToNumber ( inputString ) : inputString = inputString . split ( ' . ' ) penny = 0 if len ( inputString ) > 1 and len ( inputString [ - 1 ] ) == 2 : penny = inputString . pop ( - 1 ) return float ( f " { ' ' . join ( inputString ) } . { penny } " )     def convToString ( inputNumber ) : intNumber , penny = str ( inputNumber ) . split ( ' . ' ) output = ' ' for i , char in enumerate ( list ( intNumber [ : : - 1 ] ) ) : output += char if ( i + 1 ) % 3 == 0 : output += ' . ' while len ( penny ) < 2 : penny += '0' output = output [ : : - 1 ] if output [ 0 ] == ' . ' : output = output [ 1 : ]   if penny == '00' : return output else : return f ' { output } . { penny } '   a = round ( sum ( [ convToNumber ( i ) for i in inputNumbers ] ) , 2 ) print ( convToString ( a ) ) NEW_LINE


s = input ( )   R = str . replace   for i in range ( 97 , 123 ) : s = R ( s , chr ( i ) , ' ▁ ' )   b = a = 0   for x in s . split ( ) :   l = x . rfind ( ' . ' )   if l == - 1 or len ( x ) - 1 - l > 2 : a += int ( R ( x , ' . ' , ' ' ) )   else : a += int ( R ( x [ : l ] , ' . ' , ' ' ) ) ; b += int ( x [ l + 1 : ] )   a += b // 100   b = str ( b % 100 )   a = str ( a )   r = ' '   while a : r = a [ - 3 : ] + ' . ' + r ; a = a [ : - 3 ]   if b != '0' : r += '0' * ( 2 - len ( b ) ) + b   else : r = r [ : - 1 ]   print ( r )       NEW_LINE


s = input ( )   prices = [ ]   cur = " " for i in s : if i . isdigit ( ) or i == " . " : cur += i else : if cur != " " : prices += [ cur ] cur = " "   if cur != " " : prices += [ cur ]   total = 0   for price in prices : if price . rfind ( " . " ) == len ( price ) - 1 - 3 : price = price . replace ( " . " , " " ) total += round ( float ( price ) , 2 ) elif price . rfind ( " . " ) == len ( price ) - 1 - 2 : NEW_LINE


from math import truncs = input ( ) k = - 1 temp = ' ' q = 0 for i in s : if i . isdigit ( ) : temp += i elif i == ' . ' : if k != - 1 : temp = temp [ : k ] + temp [ k + 1 : ] temp += i k = len ( temp ) - 1 elif len ( temp ) : if k != - 1 and len ( temp ) - 1 - k != 2 : temp = temp [ : k ] + temp [ k + 1 : ] q += float ( temp ) k = - 1 temp = ' ' if len ( temp ) : if k != - 1 and len ( temp ) - 1 - k != 2 : temp = temp [ : k ] + temp [ k + 1 : ] q += float ( temp ) ex = Falsefor i in range ( 2 , 0 , - 1 ) : d = int ( q // 1000 ** i ) if not ex : if d > 0 : print ( d , ' . ' , sep = ' ' , end = ' ' ) ex = True else : print ( '0' * ( 3 - len ( str ( d ) ) ) + str ( d ) + ' . ' , end = ' ' ) q -= d * 1000 ** ir = str ( int ( trunc ( q ) ) ) if q == 0 : print ( '000' ) elif trunc ( q ) != q : if ex : print ( '0' * ( 3 - len ( r ) ) , " { : . 2f } " . format ( round ( q , 2 ) ) , sep = ' ' ) else : print ( " { : . 2f } " . format ( round ( q , 2 ) ) ) else : if ex : print ( '0' * ( 3 - len ( r ) ) , int ( q ) , sep = ' ' ) else : print ( int ( q ) ) NEW_LINE


import java . io . * ; import java . nio . file . Files ; import java . nio . file . Path ; import java . nio . file . Paths ; import java . nio . file . StandardCopyOption ; import java . util . * ; import java . util . function . Function ; import java . util . function . Predicate ; import java . util . stream . Collectors ; import java . util . stream . Stream ;   import static java . util . stream . Collectors . * ; import static java . util . stream . Collectors . counting ; import static java . util . stream . Collectors . groupingBy ; import static java . util . stream . Collectors . partitioningBy ;   public class Main { public static void main ( String [ ] args ) throws IOException { InputStream inputStream = System . in ;


import java . io . * ; import java . text . DecimalFormat ; import java . util . * ; import java . io . IOException ; import java . io . InputStream ; import java . util . stream . Collector ; import java . util . stream . Collectors ;   public class Main { public static void main ( String [ ] args ) {   File file = new File ( " in . txt " ) ; InputStream inputStream = null ;


import java . util . Locale ; import java . util . Scanner ;   public class Project { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String [ ] str = sc . next ( ) . replaceFirst ( " [ a - z ] + " , " " ) . split ( " [ a - z ] + " , - 1 ) ; int len = str . length ;   long gold = 0 ; long coins = 0 ;   for ( int i = 0 ; i < len ; i ++ ) { int lastPoint = str [ i ] . lastIndexOf ( ' . ' ) ;   if ( str [ i ] . substring ( lastPoint + 1 ) . length ( ) == 2 ) { gold += Integer . parseInt ( str [ i ] . substring ( 0 , lastPoint ) . replaceAll ( " \\ . " , " " ) ) ; coins += Integer . parseInt ( str [ i ] . substring ( lastPoint + 1 ) ) ; } else { gold += Integer . parseInt ( str [ i ] . replaceAll ( " \\ . " , " " ) ) ; }   }   gold += coins / 100 ; coins %= 100 ;   if ( gold == 0 ) { System . out . printf ( Locale . GERMAN , "0 . % 02d " , coins ) ; } else if ( coins == 0 ) { System . out . printf ( Locale . GERMAN , " % , d " , gold ) ; } else { System . out . printf ( Locale . GERMAN , " % , d . %02d " , gold , coins ) ; } } }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . text . DecimalFormat ; import java . util . Locale ;   public class Checksum { public static void main ( String [ ] args ) throws IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s = reader . readLine ( ) ; double checksum = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { int z = i ; if ( Character . isDigit ( s . charAt ( i ) ) ) { StringBuilder currentPrice = new StringBuilder ( ) ; for ( int j = z ; j < s . length ( ) ; j ++ ) { char currentSymbol = s . charAt ( j ) ; i = j ; if ( Character . isDigit ( currentSymbol ) || Character . toString ( currentSymbol ) . equals ( " . " ) ) { currentPrice . append ( Character . toString ( currentSymbol ) ) ; } else break ; } String [ ] k = currentPrice . toString ( ) . split ( " \\ . " ) ; currentPrice = new StringBuilder ( ) ; for ( int j = 0 ; j < k . length ; j ++ ) { if ( k . length > 1 && j + 1 == k . length && k [ j ] . length ( ) == 2 ) { currentPrice . append ( " . " ) . append ( k [ j ] ) ; } else currentPrice . append ( k [ j ] ) ; } checksum += Double . parseDouble ( currentPrice . toString ( ) ) ; } } s = String . format ( " % , . 2f " , checksum ) ; s = s . replaceAll ( " , " , " . " ) ; if ( s . substring ( s . length ( ) - 2 ) . equals ( "00" ) ) s = s . substring ( 0 , s . length ( ) - 3 ) ; System . out . println ( s ) ; } }


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

from collections import * NEW_LINE import sys , relines = [ i [ : - 1 ] for i in sys . stdin . readlines ( ) ] NEW_LINE n = int ( lines [ 0 ] ) NEW_LINE lines = lines [ 1 : ] NEW_LINE typeof = defaultdict ( lambda : ' errtype ' ) NEW_LINE typeof [ ' void ' ] = ' void ' NEW_LINE def simplify ( s ) : global typeof NEW_LINE l , r = s . count ( ' & ' ) , s . count ( ' * ' ) NEW_LINE result = typeof [ s [ l : len ( s ) - r ] ] NEW_LINE


class CodeforcesTask87BSolution : def NEW_LINE __init__ ( self ) : self . result = ' ' NEW_LINE self . n = 0 NEW_LINE self . expressions = [ ]   NEW_LINE def read_input ( self ) : self . n = int ( input ( ) ) NEW_LINE for x in range ( self . n ) : self . expressions . append ( input ( ) . split ( " ▁ " ) )   NEW_LINE def process_task ( self ) : result = [ ] NEW_LINE lang_dict = { " void " : 0 } NEW_LINE for expr in self . expressions : if NEW_LINE expr [ 0 ] == " typedef " : up = expr [ 1 ] . count ( " * " ) NEW_LINE down = expr [ 1 ] . count ( " & " ) NEW_LINE nm = expr [ 1 ] . replace ( " * " , " " ) . replace ( " & " , " " ) NEW_LINE if nm in lang_dict : if NEW_LINE lang_dict [ nm ] == - 1 : lang_dict [ expr [ 2 ] ] = - 1 else : lang_dict [ expr [ 2 ] ] = max ( - 1 , lang_dict [ nm ] + up - down ) else : lang_dict [ expr [ 2 ] ] = - 1 elif expr [ 0 ] == " typeof " : up = expr [ 1 ] . count ( " * " ) NEW_LINE down = expr [ 1 ] . count ( " & " ) NEW_LINE nm = expr [ 1 ] . replace ( " * " , " " ) . replace ( " & " , " " ) NEW_LINE if nm in lang_dict : balance = max ( lang_dict [ nm ] + up - down , - 1 ) NEW_LINE if balance == - 1 or lang_dict [ nm ] == - 1 : NEW_LINE INDENT result . append ( " errtype " ) else : NEW_LINE result . append ( " void " + " * " * balance ) else : result . append ( " errtype " ) NEW_LINE DEDENT self . result = " \n " . join ( result )   NEW_LINE def get_result ( self ) : return self . result NEW_LINE     if __name__ == " _ _ main _ _ " : Solution = CodeforcesTask87BSolution ( ) NEW_LINE Solution . read_input ( ) NEW_LINE Solution . process_task ( ) NEW_LINE print ( Solution . get_result ( ) ) NEW_LINE


import java . io . * ; import java . util . * ; public class r73b { public static void main ( String args [ ] ) { fastio in = new fastio ( System . in ) ; PrintWriter pw = new PrintWriter ( System . out ) ;   int n = in . nextInt ( ) ; HashMap < String , Integer > countand = new HashMap < String , Integer > ( ) ; HashMap < String , Integer > countstar = new HashMap < String , Integer > ( ) ; countand . put ( " void " , 0 ) ; countstar . put ( " void " , 0 ) ; countand . put ( " errtype " , - 1 ) ; countstar . put ( " errtype " , - 1 ) ; for ( int i = 0 ; i < n ; i ++ ) {


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . StringTokenizer ; import java . util . TreeMap ;   public class VasyaAndTypes { public static TreeMap < String , Integer > parameters = new TreeMap < > ( ) ; public static int process ( String A ) { int ampersands = 0 , l = A . length ( ) ; while ( A . charAt ( ampersands ) == ' & ' ) ampersands ++ ;   int asterisks = 0 ; while ( A . charAt ( l - 1 - asterisks ) == ' * ' ) asterisks ++ ;   String C = A . substring ( ampersands , l - asterisks ) ;   if ( C . equals ( " errtype " ) ) return - 1 ; else { if ( ! parameters . containsKey ( C ) ) return - 1 ; int Cx = parameters . get ( C ) ;   if ( Cx == - 1 ) return - 1 ;   asterisks += Cx ; if ( asterisks >= ampersands ) { return asterisks - ampersands ; } else { return - 1 ; } } } public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter pw = new PrintWriter ( System . out ) ;   int n = Integer . parseInt ( br . readLine ( ) ) ;   StringTokenizer st ;     parameters . put ( " void " , 0 ) ;   for ( int i = 0 ; i < n ; i ++ ) { st = new StringTokenizer ( br . readLine ( ) ) ;   String command = st . nextToken ( ) ;   if ( command . equals ( " typedef " ) ) { String A = st . nextToken ( ) ; String B = st . nextToken ( ) ;   parameters . put ( B , process ( A ) ) ;   } else { String A = st . nextToken ( ) ;   int x = process ( A ) ; if ( x == - 1 ) pw . println ( " errtype " ) ; else { pw . print ( " void " ) ; for ( int j = 0 ; j < x ; j ++ ) pw . print ( " * " ) ; pw . println ( ) ; } } }   pw . flush ( ) ; pw . close ( ) ; } }


import java . io . File ; import java . io . FileNotFoundException ; import java . util . ArrayDeque ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . HashMap ; import java . util . Iterator ; import java . util . Scanner ;   public class A { public static void main ( String [ ] args ) throws FileNotFoundException { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) { long num = in . nextLong ( ) ; long res = 0 ; int turn = 0 ; while ( num > 0 ) { long amt = 0 ; if ( num % 4 == 0 && num > 8 ) amt = 1 ; else if ( num % 2 == 0 ) { amt = num / 2 ; } else { amt = 1 ; } num -= amt ; if ( turn == 0 ) res += amt ; turn = ( turn + 1 ) % 2 ; } System . out . println ( res ) ; } } }

from sys import stdin , stdoutdef NEW_LINE main ( ) : NEW_LINE for _ in range ( int ( stdin . readline ( ) ) ) : n = int ( stdin . readline ( ) ) NEW_LINE ans = [ 0 , 0 ] NEW_LINE first , second = 1 , 0 NEW_LINE get = [ 0 , 1 , 1 , 2 , 3 ] NEW_LINE while n : if NEW_LINE n < 5 : temp = get [ n ] NEW_LINE if first : ans [ 0 ] += temp NEW_LINE first ^= 1 NEW_LINE ans [ 1 ] += n - temp else : ans [ 1 ] += temp NEW_LINE second ^= 1 NEW_LINE ans [ 0 ] += n - temp NEW_LINE break elif n % 2 == 1 or ( ( n // 2 ) % 2 == 0 ) : NEW_LINE if first : ans [ 0 ] += 1 NEW_LINE first ^= 1 NEW_LINE second = 1 else : ans [ 1 ] += 1 NEW_LINE second ^= 1 NEW_LINE first = 1 NEW_LINE n -= 1 else : if first : ans [ 0 ] += n // 2 NEW_LINE first ^= 1 NEW_LINE second = 1 else : ans [ 1 ] += n // 2 NEW_LINE second ^= 1 NEW_LINE first = 1 NEW_LINE n = n // 2 NEW_LINE stdout . write ( " % d \n " % ( ans [ 0 ] ) ) NEW_LINE main ( ) NEW_LINE


import java . util . * ; public class ArenaOfGreed {   static HashMap < Long , Long > map = new HashMap < > ( ) ;   public static void main ( String [ ] args ) {


import java . io . * ; import java . util . * ; public class Solution { public static void main ( String [ ] args ) throws Exception { FastReader fr = new FastReader ( ) ; int t = fr . nextInt ( ) ; while ( t -- > 0 ) { long n = fr . nextLong ( ) ; boolean turn = true ; long val = 0 ; while ( n > 0 ) { if ( n % 4 == 0 && n > 8 ) { if ( turn ) val += 1 ; n -- ; } else if ( n % 2 == 0 ) { if ( turn ) val += n / 2 ; n = n / 2 ; } else { if ( turn ) val += 1 ; n -- ; } turn = ! turn ; } System . out . println ( val ) ; } } } class Pair { int x ; int y ; Pair ( int x , int y ) { this . x = x ; this . y = y ; } }      class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } }


import java . io . * ; import java . util . * ; public class Ishu { static Scanner scan = new Scanner ( System . in ) ; static void tc ( ) { long n = scan . nextLong ( ) ; long a = 0l ; long b = 0l ; int ctr = 0 ; while ( n > 0 ) { if ( ctr % 2 == 0 ) { if ( n % 2 == 0 ) { if ( ( n / 2 ) % 2 == 0 && n > 4 ) { a += 1 ; -- n ; } else { a += n / 2 ; n /= 2 ; } } else { a += 1 ; -- n ; } } else { if ( n % 2 == 0 ) { if ( ( n / 2 ) % 2 == 0 && n > 4 ) { b += 1 ; -- n ; } else { b += n / 2 ; n /= 2 ; } } else { b += 1 ; -- n ; } } ++ ctr ;   } System . out . println ( a ) ; } public static void main ( String [ ] args ) { int t = 1 ; t = scan . nextInt ( ) ; while ( t -- > 0 ) tc ( ) ; } }


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


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

for t in range ( int ( input ( ) ) ) : n = int ( input ( ) ) NEW_LINE a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE i = 0 NEW_LINE j = n - 1 NEW_LINE result = [ 0 ] * n NEW_LINE while i < j : result [ i ] = - a [ j ] NEW_LINE result [ j ] = a [ i ] NEW_LINE i += 1 NEW_LINE j -= 1 NEW_LINE print ( " ▁ " . join ( str ( x ) for x in result ) ) NEW_LINE


def insertion_sort ( l ) : for NEW_LINE i in range ( len ( l ) ) : NEW_LINE for j in ( range ( i ) ) : k = i - j NEW_LINE if l [ k ] >= l [ k - 1 ] : NEW_LINE INDENT l [ k - 1 ] , l [ k ] = l [ k ] , l [ k - 1 ] else : NEW_LINE break NEW_LINE DEDENT return l       NEW_LINE def selection_sort ( l ) : for NEW_LINE i in range ( len ( l ) ) : min_ind = i NEW_LINE min_val = l [ i ] NEW_LINE for j in range ( i , len ( l ) ) : if NEW_LINE min_val > l [ j ] : min_val = l [ j ] NEW_LINE min_ind = j NEW_LINE l [ i ] , l [ min_ind ] = l [ min_ind ] , l [ i ] NEW_LINE return l     NEW_LINE def bubble_sort ( l ) : for NEW_LINE i in range ( len ( l ) - 1 ) : NEW_LINE for j in range ( len ( l ) - 1 - i ) : if NEW_LINE l [ j ] > l [ j + 1 ] : l [ j ] , l [ j + 1 ] = l [ j + 1 ] , l [ j ] NEW_LINE return l     NEW_LINE


t = int ( input ( ) ) NEW_LINE while ( t > 0 ) : n = int ( input ( ) ) NEW_LINE temp = input ( ) NEW_LINE ar = ( temp . split ( ) ) NEW_LINE for i in range ( 0 , n , 2 ) : print ( - 1 * ( int ( ar [ i + 1 ] ) ) , end = " ▁ " ) NEW_LINE print ( ( int ( ar [ i ] ) ) , end = " ▁ " ) NEW_LINE print ( " " ) NEW_LINE t -= 1 NEW_LINE


import java . util . Arrays ; import java . util . Scanner ; import java . lang . String ; import java . util . Random ;   public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; for ( int i = 0 ; i < t ; i ++ ) { int n = sc . nextInt ( ) ; for ( int j = 0 ; j < n ; j += 2 ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; System . out . print ( - b + " ▁ " + a + " ▁ " ) ; } System . out . println ( ) ; } } }


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


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

n = int ( input ( ) ) k = int ( input ( ) ) a = int ( input ( ) ) b = int ( input ( ) )   ans = 0   if k == 1 : ans += ( n ) * a - aelse : while n > 1 : if n % k > 0 : if n < k : ans += ( n % k ) * a - a ; n -= ( n % k ) else : ans += ( n % k ) * a ; n -= ( n % k ) else : ans += min ( ( n - ( n // k ) ) * a , b ) n = n // kprint ( ans )       NEW_LINE


n = int ( input ( ) ) k = int ( input ( ) ) A = int ( input ( ) ) B = int ( input ( ) ) c = 0 while ( n != 1 ) : if ( k == 1 or k > n ) : c += ( n - 1 ) * A break elif ( n % k != 0 ) : c += ( n % k ) * A n -= n % k else : c += min ( B , ( n - n // k ) * A ) n = n // kprint ( c ) NEW_LINE


from collections import defaultdict , deque , Counterfrom sys import stdin , stdoutfrom heapq import heappush , heappopimport mathimport ioimport osimport mathimport bisect   NEW_LINE


n , k , a , b , s = int ( input ( ) ) , int ( input ( ) ) , int ( input ( ) ) , int ( input ( ) ) , 0 if ( k > 1 ) : while ( ( ( n // k ) * ( k - 1 ) * a ) > b ) : s += ( n % k ) * a + b n //= kprint ( int ( s + ( n - 1 ) * a ) ) NEW_LINE


import sysinput = sys . stdin . readlinen = int ( input ( ) ) k = int ( input ( ) ) a = int ( input ( ) ) b = int ( input ( ) ) ans = 0 if k == 1 : print ( ( n - 1 ) * a ) exit ( ) while n > 1 : if n < k : ans += ( n - 1 ) * a break if n % k != 0 : ans += ( n % k ) * a n -= ( n % k ) else : while n % k == 0 and n > 1 : temp = n // k if ( n - temp ) * a >= b : ans += b else : ans += ( ( n - temp ) * a ) n //= kprint ( ans ) NEW_LINE


import java . io . * ; import java . util . * ; import java . util . ArrayList ;    public class CryOut {    public static void main ( String [ ] args ) { InputStream stream = System . in ; PrintWriter out = new PrintWriter ( System . out ) ; FastReader sc = new FastReader ( stream ) ;


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


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


import java . lang . * ; import java . util . * ; import java . util . stream . Collectors ; import java . io . * ;   public class pblm3 { static int a ; static int b ; static int k ; static HashMap < Integer , Long > map ; public static long steps ( int n ) {


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 ( ) ; String s = sc . next ( ) ; char [ ] a = new char [ n ] ; int count = 0 , count1 = 0 ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = s . charAt ( i ) ; if ( a [ i ] == '0' ) { count ++ ; } else { count1 ++ ; } } if ( count == count1 ) { System . out . println ( "2 ▁ " ) ; for ( int i = 0 ; i < n - 1 ; i ++ ) { System . out . print ( a [ i ] ) ; } System . out . print ( " ▁ " ) ; System . out . print ( a [ n - 1 ] ) ; } else if ( n == 1 ) { int j = 0 ; System . out . println ( "1 ▁ " ) ; System . out . print ( a [ j ] ) ; } else { System . out . println ( "1 ▁ " ) ; for ( int i = 0 ; i < n ; i ++ ) { System . out . print ( a [ i ] ) ; } } } }

import math   def is_good_string ( s ) : count_1 = 0 count_0 = 0 for i in s : if i == "0" : count_0 += 1 else : count_1 += 1 if count_1 == count_0 : return False return True   def recur_search_for_good_str ( s , n , l ) : pass         def main_function ( ) : n = int ( input ( ) ) s = input ( ) if is_good_string ( s ) : return str ( 1 ) + " \n " + s else : return str ( 2 ) + " \n " + s [ 0 ] + " ▁ " + s [ 1 : ]               print ( main_function ( ) ) NEW_LINE


n = int ( input ( ) ) k = ( input ( ) ) x = k . count ( '0' ) y = k . count ( '1' ) if ( x == y ) : print ( 2 ) print ( k [ 0 ] , k [ 1 : ] ) else : print ( 1 ) print ( k ) NEW_LINE


num = int ( input ( ) ) s = input ( )   if s . count ( "0" ) != s . count ( "1" ) : print ( 1 ) print ( s ) else : print ( 2 ) print ( s [ 0 ] , s [ 1 : ] )     NEW_LINE


n = int ( input ( ) ) s = input ( ) bal = 0 for c in s : if c == '0' : bal = bal + 1 else : bal = bal - 1 if bal != 0 : print ( '1' + ' \n ' + s ) else : print ( '2' + " \n " + s [ 0 : - 1 ] + " ▁ " + s [ - 1 ] ) NEW_LINE


n = int ( input ( ) ) s = input ( ) bal = 0 for c in s : if c == '0' : bal += 1 else : bal -= 1 if bal != 0 : print ( '1' + ' \n ' + s ) else : print ( '2' + " \n " + s [ 0 : - 1 ] + " ▁ " + s [ - 1 ] ) NEW_LINE


import java . util . * ; public class Solution { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; s . nextLine ( ) ; String s1 = s . nextLine ( ) ; String result = " " ; int count = 0 , count1 = 0 , count2 = 0 ; for ( int j = 0 ; j < n ; j ++ ) { if ( s1 . charAt ( j ) == '0' ) count ++ ; else count1 ++ ; } if ( count == count1 ) { int k = n / count ; System . out . println ( "2" ) ; System . out . print ( s1 . charAt ( 0 ) + " ▁ " ) ; for ( int j = 1 ; j < n ; j ++ ) { result = result + s1 . charAt ( j ) ; } System . out . print ( result ) ; } else { System . out . println ( "1" ) ; System . out . println ( s1 ) ; } } }


import java . util . * ;   public class Test { public static void main ( String [ ] args ) {   Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; String s = input . next ( ) ;   int z = 0 , o = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( s . charAt ( i ) == '0' ) z ++ ; else o ++ ; }   if ( z == o ) { System . out . println ( 2 ) ; System . out . println ( s . substring ( 0 , n - 1 ) + " ▁ " + s . substring ( n - 1 ) ) ; } else { System . out . println ( 1 ) ; System . out . println ( s ) ; } } }


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


import java . util . * ;   public class question { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String s = sc . next ( ) ; int ct = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( s . charAt ( i ) == '0' ) ct ++ ; else ct -- ; } if ( ct != 0 ) System . out . print ( "1 \n " + s ) ; else System . out . print ( "2 \n " + s . charAt ( 0 ) + " ▁ " + s . substring ( 1 , n ) ) ; } }


import java . util . Scanner ;   public class zizo { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; char [ ] s = sc . next ( ) . toCharArray ( ) ; for ( int a = 0 ; a < n ; a ++ ) { LOOP : for ( int b = 1 ; b < n ; b ++ ) { for ( int i = 0 ; i <= 4 ; i ++ ) { int x = a + b * i ; if ( x >= n ) { continue LOOP ; } if ( s [ x ] == ' . ' ) { continue LOOP ; } } System . out . println ( " yes " ) ; return ; } } System . out . println ( " no " ) ; } }

def king ( s ) : l = [ ] for i in range ( len ( s ) ) : if s [ i ] == ' * ' : l . append ( i ) if len ( l ) < 5 : print ( ' no ' ) else : k = ( max ( x for x in l ) - min ( x for x in l ) ) // 4 def space_eq ( s , j ) : ans = False for i in s : if ( i + j ) in s and ( i + 2 * j ) in s and ( i + 3 * j ) in s and ( i + 4 * j ) in s : ans = True break return ans ans = False for j in range ( 1 , k + 1 ) : if space_eq ( l , j ) == True : ans = True break if ans == True : print ( ' yes ' ) else : print ( ' no ' )   n = int ( input ( ) ) s = input ( ) assert len ( s ) == n , ' Incorrect ▁ Input ' king ( s ) NEW_LINE


n , s , r = int ( input ( ) ) , input ( ) , rangeprint ( [ ' no ' , ' yes ' ] [ any ( all ( s [ i + k * j ] == ' * ' for k in r ( 5 ) ) for i in r ( n - 4 ) for j in r ( 1 , ( n - i + 3 ) // 4 ) ) ] ) NEW_LINE


n , s , r = int ( input ( ) ) , input ( ) , rangeprint ( [ ' yes ' , ' no ' ] [ all ( ' . ' in s [ i : i + 5 * j : j ] for i in r ( n - 4 ) for j in r ( 1 , ( n - i + 3 ) // 4 ) ) ] ) NEW_LINE


a = int ( input ( ) ) k = input ( ) b = [ i for i in range ( a ) if k [ i ] == ' * ' ] for i in b : for j in range ( 1 , 101 ) : ok = 1 for x in range ( 1 , 5 ) : if i + j * x not in b : ok = 0 ; break if ok : exit ( print ( " yes " ) ) print ( " no " ) NEW_LINE


import java . io . * ; import java . util . * ;    public class Source { static class FastScanner { private BufferedReader br ; private StringTokenizer st ; public FastScanner ( InputStream inputStream ) { br = new BufferedReader ( new InputStreamReader ( inputStream ) ) ; } public String next ( ) { while ( st == null || ! st . hasMoreTokens ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException ignored ) { } } return st . nextToken ( ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } public long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } public double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } }   public static void main ( String args [ ] ) { FastScanner scanner = new FastScanner ( System . in ) ; PrintWriter printer = new PrintWriter ( System . out ) ; int n = scanner . nextInt ( ) ; String s = scanner . next ( ) ; for ( int k = 1 ; k < n ; k ++ ) { for ( int i = 0 ; ; i ++ ) { if ( i + k * 4 >= n ) { break ; } boolean c1 = s . charAt ( i ) == ' * ' ; boolean c2 = s . charAt ( i + k ) == ' * ' ; boolean c3 = s . charAt ( i + k * 2 ) == ' * ' ; boolean c4 = s . charAt ( i + k * 3 ) == ' * ' ; boolean c5 = s . charAt ( i + k * 4 ) == ' * ' ; if ( c1 && c2 && c3 && c4 && c5 ) { printer . println ( " yes " ) ; printer . close ( ) ; return ; } } } printer . println ( " no " ) ; printer . close ( ) ; } }


import java . util . Scanner ;   public class Code {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String s = sc . next ( ) ; boolean t = true ; for ( int i = 0 ; i < s . length ( ) && t ; i ++ ) { if ( s . charAt ( i ) == ' * ' ) { for ( int j = 1 ; i + 4 * j < s . length ( ) ; j ++ ) { if ( s . charAt ( i + j ) == ' * ' && s . charAt ( i + 2 * j ) == ' * ' && s . charAt ( i + 3 * j ) == ' * ' && s . charAt ( i + 4 * j ) == ' * ' ) { System . out . println ( " yes " ) ; t = false ; break ; } } } } if ( t ) { System . out . println ( " no " ) ; } }   }


import java . util . Arrays ; import java . util . Scanner ;   public class Codeforces_1185A { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int [ ] places = { in . nextInt ( ) , in . nextInt ( ) , in . nextInt ( ) } ; int d = in . nextInt ( ) , c = 0 ; Arrays . sort ( places ) ; if ( places [ 1 ] - places [ 0 ] < d ) c = c + d - ( places [ 1 ] - places [ 0 ] ) ; if ( places [ 2 ] - places [ 1 ] < d ) c = c + d - ( places [ 2 ] - places [ 1 ] ) ; System . out . println ( c ) ; } }

a , b , c , d = map ( int , input ( ) . split ( ) )   if ( a <= b and b <= c ) or ( c <= b and b <= a ) : mid = belif ( b <= c and c <= a ) or ( a <= c and c <= b ) : mid = celse : mid = a   subOne = abs ( mid - min ( ( a , b , c ) ) ) subTwo = abs ( max ( ( a , b , c ) ) - mid ) ans = 0 if subOne < d : ans += abs ( d - subOne ) else : ans += 0 if subTwo < d : ans += abs ( d - subTwo ) else : ans += 0 print ( ans ) NEW_LINE


a , b , c , d = map ( int , input ( ) . split ( ) ) a = sorted ( [ a , b , c ] ) print ( max ( 0 , d - ( a [ 1 ] - a [ 0 ] ) ) + max ( 0 , d - ( a [ 2 ] - a [ 1 ] ) ) ) NEW_LINE


a , b , c , d = list ( map ( int , input ( ) . split ( ) ) ) s = sorted ( [ a , b , c ] ) ab = s [ 1 ] - s [ 0 ] bc = s [ 2 ] - s [ 1 ] if ab < d : if bc < d : print ( ( d - s [ 1 ] + s [ 0 ] ) + ( d - s [ 2 ] + s [ 1 ] ) ) else : print ( d - s [ 1 ] + s [ 0 ] ) else : if bc < d : print ( d - s [ 2 ] + s [ 1 ] ) else : print ( 0 )   NEW_LINE


l = list ( map ( int , input ( ) . split ( " ▁ " ) ) ) l , d = l [ : 3 ] , l [ 3 ] sec = 0 l . sort ( ) sec = max ( 0 , d - l [ 1 ] + l [ 0 ] ) + max ( 0 , d - l [ 2 ] + l [ 1 ] ) print ( sec ) NEW_LINE


a , b , c , d = map ( int , input ( ) . split ( ) ) NEW_LINE


import java . util . * ;   public class NewClass {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int [ ] arr = new int [ 4 ] ; for ( int i = 0 ; i < 4 ; i ++ ) { arr [ i ] = in . nextInt ( ) ; } int c = 0 ; int newArr [ ] = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i ++ ) { newArr [ i ] = arr [ i ] ; } Arrays . sort ( newArr ) ; int ab = Math . abs ( newArr [ 0 ] - newArr [ 1 ] ) - arr [ 3 ] ; int bc = Math . abs ( newArr [ 1 ] - newArr [ 2 ] ) - arr [ 3 ] ; int ac = Math . abs ( newArr [ 0 ] - newArr [ 2 ] ) - arr [ 3 ] ; while ( ab < 0 ) { ab ++ ; c ++ ; } while ( bc < 0 ) { bc ++ ; c ++ ; }   System . out . println ( c ) ; } }


import java . util . * ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 4 ] ; for ( int i = 1 ; i <= 3 ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; int d = sc . nextInt ( ) ; int i = 1 , total = 0 ; if ( a [ i + 1 ] - a [ i ] < d ) { total = total + ( d - ( a [ i + 1 ] - a [ i ] ) ) ; } i ++ ; if ( a [ i + 1 ] - a [ i ] < d ) { total = total + ( d - ( a [ i + 1 ] - a [ i ] ) ) ; } System . out . println ( total ) ; } }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ;   public class Main {   public static int smallestIndex ( ArrayList < Integer > a , int start ) { int min = Integer . MAX_VALUE ; for ( int i = start ; i < a . size ( ) ; i ++ ) { min = Math . min ( min , a . get ( i ) ) ; } return a . indexOf ( min ) ;   }   public static void main ( String [ ] args ) throws IOException {   FastScanner input = new FastScanner ( ) ; int tc = input . nextInt ( ) ; while ( tc -- > 0 ) { int n = input . nextInt ( ) ; ArrayList < Integer > a = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { int value = input . nextInt ( ) ; a . add ( value ) ;   } int start = 0 ;   while ( start < a . size ( ) ) { int i = smallestIndex ( a , start ) ; int small = a . get ( i ) ; if ( a . get ( i ) == a . get ( start ) ) { start ++ ; continue ; } a . remove ( a . get ( i ) ) ; a . add ( start , small ) ;

T = int ( input ( ) ) for _ in range ( T ) : n = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) ; k = 0 for i in range ( 1 , n + 1 ) : idx = arr . index ( i ) if idx == k : k += 1 ; continue elif idx > k : for i in range ( idx , k , - 1 ) : arr [ i ] , arr [ i - 1 ] = arr [ i - 1 ] , arr [ i ] k = idx print ( * arr ) NEW_LINE


import sysinput = sys . stdin . readlinefor _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) visited = set ( ) for i in range ( 1 , n + 1 ) : ind = l . index ( i ) if ind >= i - 1 : while ind > i - 1 : if ( ind - 1 , ind ) in visited : break   if l [ ind - 1 ] < l [ ind ] : break   else : l [ ind - 1 ] , l [ ind ] = l [ ind ] , l [ ind - 1 ] visited . add ( ( ind - 1 , ind ) )   ind -= 1   NEW_LINE


import java . io . * ; import java . util . * ; public class minimizethepermutation { public static void main ( String [ ] args ) throws IOException { BufferedReader f = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( f . readLine ( ) ) ; int q = Integer . parseInt ( st . nextToken ( ) ) ; while ( q > 0 ) { q -- ; int n = Integer . parseInt ( f . readLine ( ) ) ; int [ ] arr = new int [ n ] ; st = new StringTokenizer ( f . readLine ( ) ) ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = Integer . parseInt ( st . nextToken ( ) ) - 1 ; } int index = 0 ; HashSet < Integer > usedOperations = new HashSet < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { index = 0 ; while ( arr [ index ] != i ) index ++ ; for ( int j = index ; j >= 1 && ! usedOperations . contains ( j ) ; j -- ) { if ( arr [ j ] < arr [ j - 1 ] ) { int temp = arr [ j ] ; arr [ j ] = arr [ j - 1 ] ; arr [ j - 1 ] = temp ; usedOperations . add ( j ) ; } } } for ( int i : arr ) System . out . print ( i + 1 + " ▁ " ) ; System . out . println ( ) ; } } }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ;   public class Main { public static void main ( String [ ] args ) { FastScanner fs = new FastScanner ( ) ; int n = fs . nextInt ( ) ; long [ ] arr = fs . nextArrLong ( n ) ;   long current = 0 ; long answer = 0 ; long counter = 0 ; for ( int i = 0 ; i < n ; i ++ ) { long temp = arr [ i ] ; answer ++ ; if ( i == 0 || temp != current ) { current = temp ; counter = 0 ; } else { counter ++ ; answer += counter ; } } System . out . println ( answer ) ; }   }    class FastScanner { BufferedReader br ; StringTokenizer st ;   public FastScanner ( ) { 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 [ ] nextArrInt ( int n ) { try { int [ ] j = new int [ n + 1 ] ; for ( int k = 0 ; k < n ; k ++ ) { j [ k ] = nextInt ( ) ; } return j ; } catch ( Exception e ) { return null ; }   }   long [ ] nextArrLong ( int n ) { try { long [ ] j = new long [ n ] ; for ( int k = 0 ; k < n ; k ++ ) { j [ k ] = nextLong ( ) ; } return j ; } catch ( Exception e ) { return null ; } }   long nextLong ( ) { return Long . parseLong ( next ( ) ) ; }    int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } }

n = int ( input ( ) ) NEW_LINE a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE a . append ( a [ - 1 ] + 1 ) NEW_LINE r = [ ] NEW_LINE k = 1 NEW_LINE for i in range ( 1 , n + 1 ) : if NEW_LINE a [ i ] == a [ i - 1 ] : k += 1 else : r . append ( k ) NEW_LINE k = 1 NEW_LINE print ( sum ( map ( lambda x : x * ( x + 1 ) // 2 , r ) ) ) NEW_LINE


def magical ( arr ) : curr = None NEW_LINE currn = 0 NEW_LINE ans = [ ] NEW_LINE for i in arr : if NEW_LINE curr != i : ans . append ( currn ) NEW_LINE currn = 1 NEW_LINE curr = i else : currn += 1 NEW_LINE ans . append ( currn ) NEW_LINE cnt = 0 NEW_LINE for i in ans : cnt += ( ( i ) * ( i + 1 ) ) // 2 NEW_LINE return cnt   a = input ( ) NEW_LINE lst = list ( map ( int , input ( ) . strip ( ) . split ( ) ) ) NEW_LINE print ( magical ( lst ) ) NEW_LINE


n = int ( input ( ) ) NEW_LINE a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE tot = 0 NEW_LINE cur = 1 NEW_LINE for i in range ( len ( a ) - 1 ) : if NEW_LINE INDENT ( a [ i ] == a [ i + 1 ] ) : cur += 1 else : tot += ( cur * ( cur + 1 ) ) // 2 NEW_LINE DEDENT cur = 1 NEW_LINE tot += ( cur * ( cur + 1 ) ) // 2 NEW_LINE print ( tot ) NEW_LINE


n = int ( input ( ) ) NEW_LINE a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE ans = nif NEW_LINE n > 1 : i = 1 NEW_LINE while i < n : count = 0 NEW_LINE if a [ i ] == a [ i - 1 ] : count = 1 NEW_LINE while i <= n - 1 and a [ i ] == a [ i - 1 ] : i += 1 NEW_LINE count += 1 NEW_LINE i -= 1 NEW_LINE if count > 0 : ans += ( count ** 2 - count ) // 2 NEW_LINE i += 1 NEW_LINE print ( ans ) NEW_LINE


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


import java . util . * ;   public class CodeForces83A { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = input . nextInt ( ) ; } int c = a [ 0 ] ; long ans = 0 ; long count = 1 ; for ( int i = 1 ; i < n ; i ++ ) { if ( c == a [ i ] ) { count ++ ; } else { ans += count * ( count + 1 ) / 2 ; count = 1 ; c = a [ i ] ; } }   ans += count * ( count + 1 ) / 2 ;   System . out . println ( ans ) ; } }


import java . io . BufferedReader ; import java . io . BufferedWriter ; import java . io . InputStreamReader ; import java . io . OutputStreamWriter ;   public class Main {   public static void main ( String [ ] args ) throws Exception { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; BufferedWriter writer = new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ;   int t = Integer . parseInt ( reader . readLine ( ) ) ;

def power_of_num ( num ) : for i in range ( 1000 ) : yield num ** i     def sum_of_powers ( n , power ) : powers = power_of_num ( power ) power = next ( powers ) sum_of_powers = [ ] while n >= power : sum_of_powers . append ( power ) power = next ( powers ) return sum ( sum_of_powers )     def calculate_sum ( n , power ) : sum_of_pow = sum_of_powers ( n , power ) if n % 2 == 0 : normal_sum = n // 2 * ( n + 1 ) else : normal_sum = n // 2 * ( n + 1 ) + ( n + 1 ) // 2   tricky_sum = normal_sum - 2 * sum_of_pow print ( tricky_sum )     power = 2 t = int ( input ( ) ) for _ in range ( t ) : n = int ( input ( ) ) calculate_sum ( n , power ) NEW_LINE


for i in range ( int ( input ( ) ) ) : n = int ( input ( ) ) print ( n * ( n + 1 ) // 2 - ( 2 * sum ( 2 ** i for i in range ( len ( bin ( n ) [ 2 : ] ) ) ) ) ) NEW_LINE


cases = int ( input ( ) ) powers = set ( )   for i in range ( 32 ) : powers . add ( 2 ** i ) while cases : cases -= 1 num = int ( input ( ) )   ans = num * ( num + 1 ) // 2   for i in powers : if i <= num : ans -= 2 * i   print ( ans )     NEW_LINE


""" In ▁ this ▁ problem ▁ you ▁ are ▁ to ▁ calculate ▁ the ▁ sum ▁ of ▁ all ▁ integers ▁ from ▁ 1 ▁ to ▁ n , ▁ but ▁ you ▁ should ▁ take ▁ all ▁ powers ▁ of ▁ two ▁ with ▁ minus ▁ in ▁ the ▁ sum .  For ▁ example , ▁ for ▁ n  =  4 ▁ the ▁ sum ▁ is ▁ equal ▁ to ▁   -  1  -  2  +  3  -  4  =    -  4 , ▁ because ▁ 1 , ▁ 2 ▁ and ▁ 4 ▁ are ▁ 20 , ▁ 21 ▁ and ▁ 22 ▁ respectively .  Calculate ▁ the ▁ answer ▁ for ▁ t ▁ values ▁ of ▁ n . """ from math import floor , log   t = int ( input ( ) ) for x in range ( t ) : n = int ( input ( ) ) sum_to_n = n * ( n + 1 ) // 2 sum_pow_2 = ( 2 ** ( floor ( log ( n , 2 ) ) + 1 ) ) - 1 res = sum_to_n - 2 * sum_pow_2 print ( int ( res ) ) NEW_LINE


from math import log2   def f ( n ) : return 2 ** ( int ( log2 ( n ) ) + 1 ) - 1 def sum1 ( n ) : return ( n + 1 ) * n // 2 for i in range ( int ( input ( ) ) ) : n = int ( input ( ) ) print ( sum1 ( n ) - 2 * f ( n ) ) NEW_LINE


import java . util . * ;   public class A_Tricky_Sum { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int q = sc . nextInt ( ) ; while ( q -- > 0 ) { int n = sc . nextInt ( ) ; long s = 0 ; int x = ( int ) ( Math . log ( n ) / Math . log ( 2 ) ) ; x ++ ;


import java . util . Arrays ; import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; long t , a , b = 1 , sum ; t = scanner . nextLong ( ) ; for ( long i = 0 ; i < t ; i ++ ) { a = scanner . nextLong ( ) ; b = 1 ; sum = a * ( a + 1 ) / 2 ; while ( b <= a ) { sum -= 2 * b ; b *= 2 ; } System . out . println ( sum ) ; } } }


import java . io . * ; import java . util . * ;     public class Main { public static Scanner in = new Scanner ( new BufferedReader ( new InputStreamReader ( System . in ) , 640000 ) ) ; public static PrintWriter out = new PrintWriter ( System . out ) ;    public static void solve ( ) { int t = in . nextInt ( ) ; for ( int i = 0 ; i < t ; ++ i ) { int n = in . nextInt ( ) ; long totalSum = ( ( long ) n * ( n + 1 ) ) / 2 ; int maxPower = 0 ; while ( Math . pow ( 2 , maxPower ) <= n ) { maxPower ++ ; }   out . println ( totalSum - ( 2 * ( long ) ( Math . pow ( 2 , maxPower ) - 1 ) ) ) ; }   }   public static void main ( String args [ ] ) { solve ( ) ; out . close ( ) ; } }


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


import java . util . Scanner ;   public class _0735CommentaryBoxes {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long n = sc . nextLong ( ) ; long m = sc . nextLong ( ) ; long a = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long cost = 0 ; if ( n % m == 0 ) { System . out . println ( cost ) ; } else { cost += Math . min ( b * ( n % m ) , a * ( m - ( n % m ) ) ) ; System . out . println ( cost ) ; } }   }

from sys import stdinn , m , a , b = map ( int , stdin . readline ( ) . split ( ) ) x = n % mprint ( min ( a * ( m - x ) , b * x ) ) NEW_LINE


n , m , a , b = map ( int , input ( ) . split ( ) ) print ( min ( ( m - n % m ) * a , n % m * b ) ) NEW_LINE


n , m , a , b = map ( int , input ( ) . split ( ) ) ans = min ( n % m * b , ( m - n % m ) * a ) print ( ans ) NEW_LINE


import java . util . * ;   public class CodeForces990A { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; long n = input . nextLong ( ) ; long m = input . nextLong ( ) ; int a = input . nextInt ( ) ; int b = input . nextInt ( ) ; if ( n % m == 0 ) { System . out . println ( 0 ) ; } else { if ( n < m ) { System . out . println ( Math . min ( ( m - n ) * a , n * b ) ) ; } else { long count = n % m ; long x = m * ( n / m + 1 ) - n ; long min = ( long ) Math . min ( count * b , x * a ) ; System . out . println ( min ) ; } } } }


import com . sun . security . jgss . GSSUtil ;   import javax . swing . table . AbstractTableModel ; import java . io . * ; import java . util . * ; import java . util . concurrent . atomic . AtomicReferenceFieldUpdater ;


import java . util . Scanner ;   public class CommentaryBoxes { public static void main ( String [ ] args ) {   Scanner in = new Scanner ( System . in ) ; long n = in . nextLong ( ) , m = in . nextLong ( ) , d = n / m * m ; int a = in . nextInt ( ) , b = in . nextInt ( ) ;   in . close ( ) ; System . out . println ( n % m == 0 ? 0 : Math . min ( ( d + m - n ) * a , ( n - d ) * b ) ) ; } }


import java . util . Scanner ;   public class com_boxers { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long n = sc . nextLong ( ) ; long m = sc . nextLong ( ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ;   if ( n % m == 0 ) { System . out . println ( "0" ) ; } else { if ( n > m ) { long div = n / m ; long temp = n - m * div ; long cost1 = temp * b ; div ++ ; long temp1 = m * div - n ; long cost2 = temp1 * a ; if ( cost1 > cost2 ) { System . out . println ( cost2 ) ; } else { System . out . println ( cost1 ) ; } } else { long cost1 = n * b ; long cost2 = ( m - n ) * a ; if ( cost1 > cost2 ) { System . out . println ( cost2 ) ; } else { System . out . println ( cost1 ) ; } } } } }


import java . io . * ; import java . util . * ; import java . lang . * ;   public class Rextester { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st0 = new StringTokenizer ( br . readLine ( ) ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; StringTokenizer st1 = new StringTokenizer ( br . readLine ( ) ) ; br . close ( ) ; int n = new Integer ( st0 . nextToken ( ) ) ; int m = new Integer ( st0 . nextToken ( ) ) ; int [ ] f = new int [ n + 1 ] ; int [ ] b = new int [ m + 1 ] ; int [ ] finverse = new int [ 100005 ] ; for ( int i = 0 ; i < m ; i ++ ) { b [ i ] = new Integer ( st1 . nextToken ( ) ) ; } Arrays . fill ( finverse , - 2 ) ; for ( int i = 0 ; i < n ; i ++ ) { f [ i ] = new Integer ( st . nextToken ( ) ) ; if ( finverse [ f [ i ] ] == - 2 ) { finverse [ f [ i ] ] = i + 1 ; } else { finverse [ f [ i ] ] = - 1 ; } } boolean flag = false ; StringBuffer sb = new StringBuffer ( ) ; for ( int i = 0 ; i < m ; i ++ ) { if ( finverse [ b [ i ] ] == - 1 ) { flag = true ; } else if ( finverse [ b [ i ] ] == - 2 ) { System . out . println ( " Impossible " ) ; return ; } else { sb . append ( finverse [ b [ i ] ] ) . append ( " ▁ " ) ; } } if ( flag ) { System . out . println ( " Ambiguity " ) ; return ; } else { System . out . println ( " Possible \n " + sb ) ; } } }

def mapin ( ) : return map ( int , input ( ) . split ( ) )   NEW_LINE


n , m = map ( int , input ( ) . split ( ) ) f = list ( map ( int , input ( ) . split ( ) ) ) b = list ( map ( int , input ( ) . split ( ) ) ) b1 = set ( b ) f1 = set ( f ) u = 0 for i in b1 : if i not in f1 : print ( ' Impossible ' ) u = 1 breakif not u : d = { } for i in range ( n ) : if f [ i ] not in d : d [ f [ i ] ] = i + 1 else : d [ f [ i ] ] = - 1 w = [ ] v = 0 for i in b : if d [ i ] == - 1 : print ( ' Ambiguity ' ) v = 1 break else : w . append ( d [ i ] ) if not v : print ( ' Possible ' ) print ( * w ) NEW_LINE


n , m = map ( int , input ( ) . split ( ) ) f = list ( map ( int , input ( ) . split ( ) ) ) b = list ( map ( int , input ( ) . split ( ) ) ) a = [ ] b1 = set ( b ) f1 = set ( f ) for i in b1 : if i not in f1 : print ( ' Impossible ' ) breakelse : nikita_pidor = { } for i in range ( n ) : if f [ i ] not in nikita_pidor : nikita_pidor [ f [ i ] ] = [ 1 , i ] else : nikita_pidor [ f [ i ] ] [ 0 ] += 1 for i in range ( m ) : if nikita_pidor [ b [ i ] ] [ 0 ] > 1 : print ( ' Ambiguity ' ) break a . append ( nikita_pidor [ b [ i ] ] [ 1 ] + 1 ) f [ nikita_pidor [ b [ i ] ] [ 1 ] ] = - 15 else : print ( ' Possible ' ) print ( * a ) NEW_LINE


from collections import Counter n , m = map ( int , input ( ) . split ( ) ) F = list ( map ( int , input ( ) . split ( ) ) ) B = list ( map ( int , input ( ) . split ( ) ) ) x = Counter ( F ) y = Counter ( B ) ok = Trueambi = Falseres = [ ] for i in y . keys ( ) : if x [ i ] == 0 : ok = False if x [ i ] >= 2 : ambi = Trued = dict ( ) for i in range ( len ( F ) ) : if F [ i ] in d . keys ( ) : continue else : d [ F [ i ] ] = i + 1 if ok == False : print ( " Impossible " ) elif ambi == True : print ( " Ambiguity " ) else : print ( " Possible " ) res = [ ] for i in range ( len ( B ) ) : res . append ( d [ B [ i ] ] ) print ( * res ) NEW_LINE


import sysimport mathinput = sys . stdin . readlinen , m = map ( int , input ( ) . split ( ) ) f = list ( map ( int , input ( ) . split ( ) ) ) b = list ( map ( int , input ( ) . split ( ) ) ) d = { } c = 0 for i in range ( n ) : x = f [ i ] if x in d : d [ x ] . append ( i )   else : d [ x ] = [ i ]   ans = [ ] for i in range ( m ) : x = b [ i ] if x in d : if len ( d [ x ] ) == 1 and c == 0 : ans . append ( d [ x ] [ 0 ] + 1 )   else : c = 1   else : c = 2 break   if c == 2 : print ( " Impossible " ) exit ( )   if c == 1 : print ( " Ambiguity " ) exit ( )   print ( " Possible " ) print ( * ans ) NEW_LINE


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


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

import sysfrom functools import lru_cache , cmp_to_keyfrom heapq import merge , heapify , heappop , heappush NEW_LINE


import java . util . Scanner ; import java . util . Vector ;   public class p902B { static Vector < Integer > [ ] list ; static boolean visited [ ] ; static int ans , color [ ] ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; createGraph ( n , sc ) ; for ( int i = 1 ; i <= n ; i ++ ) color [ i ] = sc . nextInt ( ) ; dfs ( 1 , 0 ) ; System . out . println ( ans ) ; } static void createGraph ( int n , Scanner sc ) { visited = new boolean [ n + 1 ] ; list = new Vector [ n + 1 ] ; color = new int [ n + 1 ] ; for ( int i = 0 ; i <= n ; i ++ ) list [ i ] = new Vector < > ( ) ; for ( int i = 2 ; i <= n ; i ++ ) addEdges ( i , sc . nextInt ( ) ) ; } static void addEdges ( int i , int x ) { list [ i ] . add ( x ) ; list [ x ] . add ( i ) ; } static void dfs ( int i , int c ) { visited [ i ] = true ; if ( color [ i ] != c ) ans ++ ; for ( int x : list [ i ] ) if ( ! visited [ x ] ) dfs ( x , color [ i ] ) ; } }

n = int ( input ( ) ) p = list ( map ( int , input ( ) . split ( ) ) ) c = list ( map ( int , input ( ) . split ( ) ) ) step = 1 for i in range ( 1 , n ) : if c [ i ] != c [ p [ i - 1 ] - 1 ] : step += 1 print ( step ) NEW_LINE


import syssys . setrecursionlimit ( 100000 )   n = int ( input ( ) ) par = list ( map ( int , input ( ) . split ( ) ) ) kids = [ [ ] for _ in range ( n + 1 ) ] for i in range ( n - 1 ) : kids [ par [ i ] - 1 ] . append ( i + 1 ) c = list ( map ( int , input ( ) . split ( ) ) )   def dfs ( i , color ) : global par global kid global c ans = 0 if c [ i ] != color : ans = 1 for kid in kids [ i ] : ans += dfs ( kid , c [ i ] ) return ans   print ( dfs ( 0 , 0 ) ) NEW_LINE


n = int ( input ( ) ) p = list ( map ( int , input ( ) . split ( ) ) ) c = list ( map ( int , input ( ) . split ( ) ) )   colormap = [ 0 ] * ncount = 0 for i in range ( n ) : if ( i > 0 ) : colormap [ i ] = colormap [ p [ i - 1 ] - 1 ] if ( c [ i ] != colormap [ i ] ) : count += 1 colormap [ i ] = c [ i ] print ( count ) NEW_LINE


import syssys . setrecursionlimit ( 10 ** 9 ) from collections import defaultdict         def dfs ( nd ) : vis [ nd ] = 1 for i in graph [ nd ] : if vis [ i ] == 0 : if col [ i - 1 ] == col [ nd - 1 ] : dfs ( i ) else : q . append ( i )                                             for _ in range ( 1 ) : n = int ( input ( ) ) graph = defaultdict ( list ) l = list ( map ( int , input ( ) . split ( ) ) ) col = list ( map ( int , input ( ) . split ( ) ) ) for i in range ( 2 , n + 1 ) : graph [ i ] . append ( l [ i - 2 ] ) graph [ l [ i - 2 ] ] . append ( i ) vis = [ 0 ] * ( n + 1 ) q = [ 1 ] tc = 0 while ( q ) : tc += 1 dfs ( q . pop ( 0 ) ) print ( tc ) NEW_LINE


import java . util . ArrayList ; import java . util . Scanner ;   public class Main { static int n ; static ArrayList < Integer > [ ] adj ; static int [ ] c ; static int sum = 1 ; static void dfs ( int prev , int u ) { if ( c [ u ] != c [ prev ] ) sum ++ ; for ( int v : adj [ u ] ) if ( v != prev ) dfs ( u , v ) ; }   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; n = sc . nextInt ( ) ; adj = new ArrayList [ n ] ; for ( int i = 0 ; i < n ; i ++ ) adj [ i ] = new ArrayList < Integer > ( ) ; for ( int u = 1 ; u < n ; u ++ ) { int v = sc . nextInt ( ) - 1 ; adj [ u ] . add ( v ) ; adj [ v ] . add ( u ) ; } c = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) c [ i ] = sc . nextInt ( ) ; for ( int u : adj [ 0 ] ) dfs ( 0 , u ) ; System . out . println ( sum ) ; } }


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

def sum_row ( arr ) : ans = sum ( arr [ 0 ] ) for i in range ( 1 , len ( arr ) ) : if sum ( arr [ i ] ) != ans : return [ False ] return [ True , ans ] def sum_col ( arr ) : ans = None for i in range ( len ( arr ) ) : temp = 0 for j in range ( len ( arr [ 0 ] ) ) : temp += arr [ j ] [ i ] if ans == None : ans = temp else : if temp != ans : return [ False ] return [ True , ans ] def sum_diagonal ( arr ) : ans = 0 ans1 = 0 for i in range ( len ( arr ) ) : ans += arr [ i ] [ i ] ans1 += arr [ i ] [ len ( arr ) - i - 1 ] return [ True , ans ] if ans == ans1 else [ False ] def calculate_value ( arr , row ) : return sum ( arr [ row ] ) n = int ( input ( ) ) a = [ ] for i in range ( n ) : a . append ( list ( map ( int , input ( ) . split ( ) ) ) ) if n == 1 : print ( 1 ) exit ( ) flag = Falsefor i in range ( n ) : for j in range ( n ) : if a [ i ] [ j ] == 0 : if i != 0 : want = calculate_value ( a , i - 1 ) - sum ( a [ i ] ) else : want = calculate_value ( a , i + 1 ) - sum ( a [ i ] ) a [ i ] [ j ] = want flag = True break if flag : breakrow = sum_row ( a ) col = sum_col ( a ) dia = sum_diagonal ( a ) if row [ 0 ] and col [ 0 ] and dia [ 0 ] : if want <= 0 : print ( - 1 ) elif row [ 1 ] == col [ 1 ] == dia [ 1 ] : print ( want ) else : print ( - 1 ) else : print ( - 1 ) 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


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


import java . util . Scanner ;   public class B { public static void main ( String args [ ] ) { Scanner cin = new Scanner ( System . in ) ; int n = Integer . parseInt ( cin . nextLine ( ) ) ; int zr = - 1 , zc = - 1 ; int m [ ] [ ] = new int [ n ] [ n ] ; for ( int i = 0 ; i < n ; i ++ ) for ( int j = 0 ; j < n ; j ++ ) { m [ i ] [ j ] = cin . nextInt ( ) ; if ( m [ i ] [ j ] == 0 ) { zr = i ; zc = j ; } } System . out . println ( solve ( m , n , zr , zc ) ) ; } private static long solve ( int [ ] [ ] m , int n , int zr , int zc ) { long cm = 0 , sol = - 1 ;   if ( n == 1 ) return n ;


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . StringTokenizer ;   public class BusGame { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter pw = new PrintWriter ( System . out ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; int x = Integer . parseInt ( st . nextToken ( ) ) ; int y = Integer . parseInt ( st . nextToken ( ) ) ;   int turn = 0 ;   int xToTake [ ] = { 0 , 1 , 2 } ; int yToTake [ ] = { 22 , 12 , 2 } ; turn : while ( true ) { if ( turn == 0 ) { for ( int i = 2 ; i >= 0 ; i -- ) { if ( x >= xToTake [ i ] && y >= yToTake [ i ] ) { x -= xToTake [ i ] ; y -= yToTake [ i ] ; turn = 1 ; continue turn ; } } break ; } else { for ( int i = 0 ; i <= 2 ; i ++ ) { if ( x >= xToTake [ i ] && y >= yToTake [ i ] ) { x -= xToTake [ i ] ; y -= yToTake [ i ] ; turn = 0 ; continue turn ; } } break ; } }   if ( turn == 0 ) pw . println ( " Hanako " ) ; else pw . println ( " Ciel " ) ;   pw . flush ( ) ; pw . close ( ) ; } }

x , y = map ( int , input ( ) . strip ( ) . split ( ) ) NEW_LINE


x , y = map ( int , input ( ) . split ( ) ) NEW_LINE cnt = 0 NEW_LINE while ( True ) : if NEW_LINE INDENT ( cnt % 2 == 0 ) : NEW_LINE DEDENT if ( x >= 2 and y >= 2 ) : x -= 2 NEW_LINE y -= 2 NEW_LINE cnt += 1 elif ( x >= 1 and y >= 12 ) : x -= 1 NEW_LINE y -= 12 NEW_LINE cnt += 1 elif ( y >= 22 ) : y -= 22 NEW_LINE cnt += 1 else : break else : if ( y >= 22 ) : y -= 22 NEW_LINE cnt += 1 elif ( x >= 1 and y >= 12 ) : x -= 1 NEW_LINE y -= 12 NEW_LINE cnt += 1 elif ( x >= 2 and y >= 2 ) : x -= 2 NEW_LINE y -= 2 NEW_LINE cnt += 1 else : breakprint ( " Ciel " if cnt % 2 == 1 else " Hanako " ) NEW_LINE


x , y = map ( int , input ( ) . split ( ) ) NEW_LINE c = 2 NEW_LINE while True : if NEW_LINE c % 2 == 0 : NEW_LINE if x >= 2 and y >= 2 : c = c + 1 NEW_LINE x = x - 2 NEW_LINE y = y - 2 NEW_LINE continue elif x >= 1 and y >= 12 : c = c + 1 NEW_LINE x = x - 1 NEW_LINE y = y - 12 NEW_LINE continue elif x >= 0 and y >= 22 : c = c + 1 NEW_LINE y = y - 22 NEW_LINE continue else : print ( " Hanako " ) NEW_LINE break NEW_LINE if c % 2 == 1 : if NEW_LINE x >= 0 and y >= 22 : c = c + 1 NEW_LINE y = y - 22 NEW_LINE continue elif x >= 1 and y >= 12 : c = c + 1 NEW_LINE x = x - 1 NEW_LINE y = y - 12 NEW_LINE continue elif x >= 2 and y >= 2 : c = c + 1 NEW_LINE x = x - 2 NEW_LINE y = y - 2 NEW_LINE continue else : print ( " Ciel " ) NEW_LINE break NEW_LINE


datos = input ( ) . split ( ) NEW_LINE monedas_cien = int ( datos [ 0 ] ) NEW_LINE monedas_diez = int ( datos [ 1 ] )   rondas_jugadas = min ( monedas_cien // 2 , monedas_diez // 24 ) NEW_LINE monedas_cien = monedas_cien - ( rondas_jugadas * 2 ) NEW_LINE monedas_diez = monedas_diez - ( rondas_jugadas * 24 )   maneras_sacar_cien = [ 2 , 1 , 0 ] NEW_LINE maneras_sacar_diez = [ 2 , 12 , 22 ]   ganando = ' Hanako ' NEW_LINE continua = Truei = 0 NEW_LINE while continua : if NEW_LINE i % 2 == 0 : j = 0 NEW_LINE while j < 3 : if NEW_LINE maneras_sacar_cien [ j ] <= monedas_cien and maneras_sacar_diez [ j ] <= monedas_diez : monedas_cien = monedas_cien - NEW_LINE INDENT maneras_sacar_cien [ j ] NEW_LINE DEDENT monedas_diez = monedas_diez - maneras_sacar_diez [ j ] NEW_LINE ganando = ' Ciel ' NEW_LINE break NEW_LINE j = j + 1 NEW_LINE if j == 3 : continua = False NEW_LINE break else : j = 0 NEW_LINE while j < 3 : if NEW_LINE maneras_sacar_cien [ 2 - j ] <= monedas_cien and maneras_sacar_diez [ 2 - j ] <= monedas_diez : monedas_cien = monedas_cien - NEW_LINE INDENT maneras_sacar_cien [ 2 - j ] NEW_LINE DEDENT monedas_diez = monedas_diez - maneras_sacar_diez [ 2 - j ] NEW_LINE ganando = ' Hanako ' NEW_LINE break NEW_LINE j = j + 1 NEW_LINE if j == 3 : continua = False NEW_LINE break NEW_LINE i = i + 1 NEW_LINE print ( ganando ) NEW_LINE


state = 1 NEW_LINE x , y = map ( int , input ( ) . split ( ) )   while True : state = 1 - state NEW_LINE if state == 0 : if NEW_LINE x >= 2 and y >= 2 : x -= 2 NEW_LINE y -= 2 NEW_LINE continue elif x >= 1 and y >= 12 : x -= 1 NEW_LINE y -= 12 NEW_LINE continue elif x >= 0 and y >= 22 : x -= 0 NEW_LINE y -= 22 NEW_LINE continue else : break elif state == 1 : NEW_LINE if x >= 0 and y >= 22 : x -= 0 NEW_LINE y -= 22 NEW_LINE continue elif x >= 1 and y >= 12 : x -= 1 NEW_LINE y -= 12 NEW_LINE continue elif x >= 2 and y >= 2 : x -= 2 NEW_LINE y -= 2 NEW_LINE continue else : break     print ( [ ' Hanako ' , ' Ciel ' ] [ state ] )     NEW_LINE


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


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( sc . hasNext ( ) ) { int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; System . out . println ( 2 * x > y ? ( ( - 1 ) + " ▁ " + ( - 1 ) ) : ( x + " ▁ " + x * 2 ) ) ; } } } }

for i in range ( int ( input ( ) ) ) : NEW_LINE INDENT m , n = map ( int , input ( ) . split ( ) ) NEW_LINE if n % m == 0 : NEW_LINE INDENT print ( m , n ) NEW_LINE DEDENT elif m * 2 <= n : NEW_LINE INDENT print ( m , m * 2 ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( - 1 , - 1 ) NEW_LINE DEDENT DEDENT


a = int ( input ( ) ) NEW_LINE for i in range ( a ) : NEW_LINE INDENT l , r = ( map ( int , input ( ) . split ( ) ) ) NEW_LINE if 2 * l > r : NEW_LINE INDENT print ( " - 1 ▁ - 1" ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( str ( l ) + " ▁ " + str ( 2 * ( l ) ) ) NEW_LINE DEDENT DEDENT


for _ in range ( int ( input ( ) ) ) : NEW_LINE INDENT l , r = map ( int , input ( ) . split ( ) ) NEW_LINE if 2 * l <= r : NEW_LINE INDENT print ( l , 2 * l ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( - 1 , - 1 ) NEW_LINE DEDENT DEDENT


t = int ( input ( ) ) NEW_LINE for _ in range ( t ) : NEW_LINE INDENT l , r = map ( int , input ( ) . split ( ) ) NEW_LINE if ( r < 2 * l ) : NEW_LINE INDENT print ( " - 1 ▁ - 1" ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( l , 2 * l ) NEW_LINE DEDENT DEDENT


t = int ( input ( ) ) NEW_LINE for i in range ( t ) : NEW_LINE INDENT l , r = map ( int , input ( ) . split ( ) ) NEW_LINE if l * 2 > r : NEW_LINE INDENT print ( - 1 , - 1 ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( l , l * 2 ) NEW_LINE DEDENT DEDENT


import java . util . Scanner ; public class A1389 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int t = scanner . nextInt ( ) ; for ( int i = 0 ; i < t ; i ++ ) { int l = scanner . nextInt ( ) , r = scanner . nextInt ( ) ; if ( r == 2 && l == 1 ) { System . out . println ( l + " ▁ " + r ) ; continue ; } if ( ( r - l ) == 1 || l > r / 2 ) { System . out . println ( - 1 + " ▁ " + ( - 1 ) ) ; } else { if ( r % 2 == 0 ) { System . out . println ( r / 2 + " ▁ " + r ) ; } else { System . out . println ( ( r - 1 ) / 2 + " ▁ " + ( r - 1 ) ) ; } } } } }


import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( sc . hasNextInt ( ) ) { int n = sc . nextInt ( ) ; while ( n -- > 0 ) { int l = sc . nextInt ( ) ; int r = sc . nextInt ( ) ; if ( 2 * l <= r ) { System . out . printf ( " % d ▁ % d \n " , l , 2 * l ) ; } else { System . out . print ( " - 1 ▁ - 1 \n " ) ; } } } } }


import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; while ( in . hasNext ( ) ) { int t = in . nextInt ( ) ; for ( int i = 1 ; i <= t ; i ++ ) { int a = in . nextInt ( ) ; int b = in . nextInt ( ) ; if ( b < a * 2 ) { System . out . println ( " - 1" + " ▁ " + " - 1" ) ; } else { System . out . println ( a + " ▁ " + 2 * a ) ; } } } } }


import java . util . Scanner ; public class DigestThread { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; for ( int i = 0 ; i < t ; i ++ ) { int num1 , num2 ; num1 = sc . nextInt ( ) ; num2 = sc . nextInt ( ) ; if ( num1 * 2 > num2 ) System . out . println ( " - 1 ▁ - 1" ) ; else System . out . println ( num1 + " ▁ " + num1 * 2 ) ; } } }


import java . io . * ; import java . util . * ;   public class Main {   static long res = 0 ; static int n , m ;   public static void main ( String [ ] args ) throws Exception { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter out = new PrintWriter ( System . out ) ;

MOD = 1000000007   def modpow ( a , b ) : res = 1 while b > 0 : if b % 2 == 1 : res = ( res * a ) % MOD a = ( a * a ) % MOD b >>= 1 return res % MOD   n , m , k = map ( int , input ( ) . split ( ) ) if ( k == - 1 and ( n % 2 != m % 2 ) ) : print ( 0 ) elif n == 1 or m == 1 : print ( 1 ) else : print ( modpow ( 2 , ( n - 1 ) * ( m - 1 ) ) % MOD ) NEW_LINE


def mod_pow ( a , b , m ) : if b == 0 : return 1 if b == 1 : return a % m tmp = mod_pow ( a , b // 2 , m ) tmp = ( tmp * tmp ) % m if b % 2 == 1 : tmp = ( tmp * a ) % m return tmp     mod = 1000000006 n , m , res = map ( int , input ( ) . split ( ) ) if m % 2 != n % 2 and res == - 1 : print ( 0 ) else : k = ( ( ( m - 1 ) % mod ) * ( ( n - 1 ) % mod ) ) % mod ans = mod_pow ( 2 , k , mod + 1 ) print ( ans ) NEW_LINE


n , m , k = map ( int , input ( ) . split ( ) ) if k == - 1 and n % 2 != m % 2 : print ( 0 ) else : print ( pow ( 2 , ( n - 1 ) * ( m - 1 ) , 10 ** 9 + 7 ) ) NEW_LINE


import sysinput = sys . stdin . readline     def list_input ( ) : return list ( map ( int , input ( ) . split ( ) ) )     def float_compare ( a , b ) : if abs ( a - b ) < float ( 1e-9 ) : return True else : return False     def sub_mod ( x , mod ) : x = x % mod if x < 0 : x += mod return x     def divisor ( n ) : i = 1 dv = [ ] while i * i <= n : if n % i == 0 : dv . append ( i ) if i * i != n : dv . append ( n // i ) i += 1   return dv     def binpow ( a , n ) : ans = 1 MOD = int ( 1e9 ) + 7 while n : if n & 1 : NEW_LINE


import java . util . Scanner ; public class Main { public static long pow ( long a , long n ) { if ( n == 0 ) return ( 1 ) ; long ls ; ls = pow ( a , n / 2 ) ; ls = ls * ls % 1000000007 ; if ( n % 2 == 0 ) { return ls ; } else { return ls * a % 1000000007 ; } } public static void main ( String [ ] args ) { Scanner reader = new Scanner ( System . in ) ; long n , m , k ; n = reader . nextLong ( ) ; m = reader . nextLong ( ) ; k = reader . nextLong ( ) ; if ( ( ( n + m ) % 2 == 1 ) && ( k == - 1 ) ) System . out . println ( "0" ) ; else System . out . println ( pow ( pow ( 2 , ( n - 1 ) ) , m - 1 ) ) ; reader . close ( ) ; }   }


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 n = input . nextLong ( ) ; long m = input . nextLong ( ) ; int k = input . nextInt ( ) ; if ( ( n + m ) % 2 == 1 && k == - 1 ) { out . println ( 0 ) ; } else { long mod = 1000000007l ; long val = power ( 2l , m - 1 , mod ) ; val = power ( val , n - 1 , mod ) ; out . println ( val ) ; } } out . close ( ) ; } public static long power ( long a , long b , long m ) { long res = 1l ; while ( b > 0l ) { if ( b % 2l != 0l ) { res = ( res % m * a % m ) % m ; } b = b / 2l ; a = ( a % m * a % m ) % m ; } return res ; } static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } }


import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . HashMap ; import java . util . StringTokenizer ; import java . util . TreeSet ;   public class A { static PrintWriter out = new PrintWriter ( System . out ) ;   static int R , C , b [ ] [ ] ; static int rows [ ] [ ] ; static int [ ] uR , uC ; static int cols [ ] [ ] ; public static void main ( String [ ] args ) { FS in = new FS ( ) ; R = in . nextInt ( ) ; C = in . nextInt ( ) ; b = new int [ R ] [ C ] ; for ( int i = 0 ; i < R ; i ++ ) for ( int j = 0 ; j < C ; j ++ ) b [ i ] [ j ] = in . nextInt ( ) ;

from bisect import bisect_leftimport sysinput = sys . stdin . buffer . readline   n , m = map ( int , input ( ) . split ( ) ) a = [ list ( map ( int , input ( ) . split ( ) ) ) for i in range ( n ) ]     yoko_less = [ [ 0 ] * m for i in range ( n ) ] yoko_more = [ [ 0 ] * m for i in range ( n ) ] for i in range ( n ) : yoko = sorted ( set ( a [ i ] ) ) for j in range ( m ) : idx = bisect_left ( yoko , a [ i ] [ j ] ) yoko_less [ i ] [ j ] = idx yoko_more [ i ] [ j ] = len ( yoko ) - idx - 1   tate_less = [ [ 0 ] * m for i in range ( n ) ] tate_more = [ [ 0 ] * m for i in range ( n ) ] for j in range ( m ) : tate = sorted ( set ( [ a [ i ] [ j ] for i in range ( n ) ] ) ) for i in range ( n ) : idx = bisect_left ( tate , a [ i ] [ j ] ) tate_less [ i ] [ j ] = idx tate_more [ i ] [ j ] = len ( tate ) - idx - 1 ans = [ [ 0 ] * m for i in range ( n ) ] for i in range ( n ) : for j in range ( m ) : less = max ( yoko_less [ i ] [ j ] , tate_less [ i ] [ j ] ) more = max ( yoko_more [ i ] [ j ] , tate_more [ i ] [ j ] ) ans [ i ] [ j ] = 1 + more + less   for res in ans : print ( * res ) 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 . util . * ; public class Practice { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ;   int arr [ ] = new int [ m ] ; for ( int i = 0 ; i < m ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; } int count = 0 ; Arrays . sort ( arr ) ;   if ( m == 0 ) { System . out . println ( " YES " ) ; return ; }   if ( arr [ 0 ] == 1 || arr [ m - 1 ] == n ) { System . out . println ( " NO " ) ; } else { for ( int i = 1 ; i < m ; i ++ ) { if ( arr [ i - 1 ] + 1 == arr [ i ] ) { count ++ ; if ( count == 2 ) { System . out . println ( " NO " ) ; return ; } } else { count = 0 ; } }   System . out . println ( " YES " ) ; } } }

n , m = map ( int , input ( ) . split ( ) ) if m == 0 : print ( " YES " ) exit ( ) else : D = list ( map ( int , input ( ) . split ( ) ) ) D . sort ( ) if m == 1 : if D [ 0 ] != 1 and D [ 0 ] != n : print ( " YES " ) else : print ( " NO " ) else : if D [ 0 ] == 1 or D [ - 1 ] == n : print ( " NO " ) exit ( )   for i in range ( m - 2 ) :   if D [ i ] - D [ i + 1 ] == - 1 and D [ i + 1 ] - D [ i + 2 ] == - 1 : print ( " NO " ) exit ( ) print ( " YES " )             NEW_LINE


n , m = map ( int , input ( ) . split ( ) ) if m == 0 : print ( " YES " ) exit ( ) a = sorted ( list ( map ( int , input ( ) . split ( ) ) ) ) if a [ 0 ] == 1 or a [ - 1 ] == n : print ( " NO " ) exit ( ) x = 0 for i in range ( m - 1 ) : if a [ i ] + 1 == a [ i + 1 ] : x += 1 if x == 2 : print ( " NO " ) exit ( ) else : x = 0 print ( " YES " ) NEW_LINE


n , m = map ( int , input ( ) . split ( ) ) if m : l = list ( map ( int , input ( ) . split ( ) ) ) if not m : print ( " YES " ) exit ( ) if 1 in l or n in l : print ( " NO " ) exit ( ) l . sort ( ) for i in range ( len ( l ) - 2 ) :   if l [ i ] + 1 == l [ i + 1 ] and l [ i + 1 ] + 1 == l [ i + 2 ] : print ( " NO " ) exit ( )   print ( " YES " ) NEW_LINE


n , m = map ( int , input ( ) . split ( ) ) f = True   if not m == 0 : s = sorted ( [ int ( i ) for i in input ( ) . split ( ) ] )   if s [ 0 ] == 1 or s [ m - 1 ] == n : f = False else : for i in range ( m - 2 ) : if s [ i ] + 2 == s [ i + 1 ] + 1 == s [ i + 2 ] : f = False   print ( ' YES ' if f else ' NO ' ) NEW_LINE


R = lambda : map ( int , input ( ) . split ( ) ) n , m = R ( ) d = sorted ( R ( ) ) if m > 0 else [ 0 ] print ( " NO " if d [ 0 ] == 1 or d [ - 1 ] == n or any ( d [ i + 2 ] - d [ i ] < 3 for i in range ( m - 2 ) ) else " YES " ) NEW_LINE


import java . util . Arrays ; import java . util . Collections ; import java . util . Scanner ; import java . lang . Math ; public class Account { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] dirty = new int [ m ] ; for ( int i = 0 ; i < m ; i ++ ) { dirty [ i ] = sc . nextInt ( ) ; } Arrays . sort ( dirty ) ; if ( m == 0 ) { System . out . println ( " YES " ) ; return ; } if ( dirty [ 0 ] == 1 || dirty [ m - 1 ] == n ) { System . out . println ( " NO " ) ; return ; } for ( int i = 0 ; i < m - 2 ; i ++ ) { if ( dirty [ i ] + 1 == dirty [ i + 1 ] ) { if ( dirty [ i + 1 ] + 1 == dirty [ i + 2 ] ) { System . out . println ( " NO " ) ; return ; } } } System . out . println ( " YES " ) ; } }


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


import java . util . * ; public class PetyaandStaircases { public static void main ( String arg [ ] ) { Scanner sc = new Scanner ( System . in ) ; long n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int flag = 0 ; long [ ] ar = new long [ m ] ; for ( int i = 0 ; i < m ; i ++ ) { ar [ i ] = sc . nextLong ( ) ; if ( ar [ i ] == 1 || ar [ i ] == n ) flag = 1 ; }   if ( flag == 1 ) { System . out . println ( " NO " ) ; System . exit ( 0 ) ; } Arrays . sort ( ar ) ; int count = 1 ; for ( int i = 1 ; i < m ; i ++ ) { if ( ar [ i ] - ar [ i - 1 ] == 1 ) count ++ ; else count = 1 ;   if ( count == 3 ) { System . out . println ( " NO " ) ; System . exit ( 0 ) ; } }    System . out . println ( " YES " ) ;     }   }


import java . util . * ; import java . io . * ; import java . math . * ;     public class B {   private static long INF = 2000000000000000000L , M = 1000000007 , MM = 998244353 ; private static int N = 0 ;   public static void process ( ) throws IOException {   int n = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; String str = sc . next ( ) ; int [ ] arr = new int [ n ] ; arr [ 0 ] = str . charAt ( 0 ) == '0' ? 1 : - 1 ; for ( int i = 1 ; i < n ; i ++ ) { if ( str . charAt ( i ) == '1' ) { arr [ i ] = arr [ i - 1 ] - 1 ; } else { arr [ i ] = arr [ i - 1 ] + 1 ; } } int last = arr [ n - 1 ] ; int count = 0 ; if ( x == 0 ) count ++ ; for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] == x && last == 0 ) { out . println ( - 1 ) ; return ; } if ( arr [ i ] == x ) { count ++ ; continue ; } if ( last == 0 ) { continue ; } int curr = arr [ i ] ; int val = x - curr ; if ( Math . abs ( val ) % Math . abs ( last ) == 0 ) { val /= last ; if ( val / Math . abs ( val ) == - 1 ) { continue ; } else { count ++ ; } } } println ( count ) ;   }

import sys , os , iofrom collections import defaultdict NEW_LINE