from sys import stdin , stdout NEW_LINE def main ( ) : NEW_LINE INDENT n = stdin . readline ( ) NEW_LINE arr = [ int ( i ) for i in stdin . readline ( ) . split ( ) ] NEW_LINE arr . sort ( ) NEW_LINE t = int ( n ) - 1 NEW_LINE p = float ( 1 / t ) NEW_LINE temp = int ( ( int ( arr [ t ] ) ** p ) // 1 ) NEW_LINE ans = int ( 0 ) NEW_LINE ans1 = int ( 0 ) NEW_LINE for i in range ( int ( n ) ) : NEW_LINE INDENT ans = int ( int ( ans ) + int ( abs ( int ( int ( temp ** i ) - arr [ i ] ) ) ) ) NEW_LINE DEDENT temp = int ( int ( temp ) + 1 ) NEW_LINE for i in range ( int ( n ) ) : NEW_LINE INDENT ans1 = int ( int ( ans1 ) + int ( abs ( int ( int ( temp ** i ) - arr [ i ] ) ) ) ) NEW_LINE DEDENT ans = min ( int ( ans ) , int ( ans1 ) ) NEW_LINE stdout . write ( str ( ans ) ) NEW_LINE DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT main ( ) NEW_LINE DEDENT


import java . io . * ; import java . util . * ; public class B { public static void main ( String [ ] args ) throws IOException { Scanner in = new Scanner ( System . in ) ; PrintWriter pw = new PrintWriter ( System . out ) ; int n = in . nextInt ( ) ; Long [ ] arr = new Long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) arr [ i ] = in . nextLong ( ) ; pw . println ( solve ( arr , n ) ) ; pw . close ( ) ; } static long solve ( Long [ ] arr , int n ) { Arrays . sort ( arr ) ; long reng = ( long ) 1e15 ; long ans = ( long ) 1e15 ; boolean finished = false ; for ( long C = 1 ; ; C ++ ) { long res = 0 ; for ( long i = 0 , pw = 1 ; i < n ; i ++ , pw *= C ) { if ( pw >= reng ) { finished = true ; break ; } res += Math . abs ( ( arr [ ( int ) i ] - pw ) ) ; } if ( finished ) break ; ans = Math . min ( ans , res ) ; } return ans ; } static void debug ( Object ... obj ) { System . err . println ( Arrays . deepToString ( obj ) ) ; } }

from sys import stdin , stdout NEW_LINE input = stdin . readline NEW_LINE def main ( ) : NEW_LINE INDENT t = 1 NEW_LINE for i in range ( t ) : NEW_LINE INDENT n = int ( input ( ) ) NEW_LINE ai = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE ans = sum ( ai ) - n NEW_LINE if n > 33 : NEW_LINE INDENT print ( ans ) NEW_LINE return NEW_LINE DEDENT base = 2 NEW_LINE num = 10 ** 10 * 5 NEW_LINE ai . sort ( ) NEW_LINE while base ** ( n - 1 ) < num : NEW_LINE INDENT ans = min ( ans , sum ( [ abs ( ai [ i ] - base ** i ) for i in range ( n ) ] ) ) NEW_LINE base += 1 NEW_LINE DEDENT print ( ans ) NEW_LINE DEDENT DEDENT main ( ) NEW_LINE


n = int ( input ( ) ) NEW_LINE s = sorted ( map ( int , input ( ) . split ( ) ) ) NEW_LINE c = 1 NEW_LINE mx = 100 * ( 10 ** 9 ) NEW_LINE ans = float ( ' inf ' ) NEW_LINE while c ** ( n - 1 ) < mx : NEW_LINE INDENT cur = 0 NEW_LINE for i in range ( n ) : cur += abs ( s [ i ] - c ** i ) NEW_LINE c += 1 NEW_LINE ans = min ( ans , cur ) NEW_LINE DEDENT print ( ans ) NEW_LINE


import java . math . * ; import java . util . * ; import java . io . * ; public class gr13b {

n , m = map ( int , input ( ) . split ( ) ) print ( ( n , 2 ) [ n != m ] ) NEW_LINE


a , b = input ( ) . split ( ) print ( a if a == b else 2 ) NEW_LINE


l , r = map ( int , input ( ) . split ( ) ) if l != r : print ( 2 ) else : print ( l ) NEW_LINE


def main ( ) : l , r = tuple ( map ( int , input ( ) . split ( ) ) ) if l == r : print ( l ) else : print ( 2 )   if __name__ == ' _ _ main _ _ ' : main ( ) NEW_LINE


m , n = map ( int , input ( ) . split ( ) ) if ( m == n ) : print ( m ) else : print ( 2 ) NEW_LINE


import java . util . Scanner ;   public class _0664FakeNP {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int l = sc . nextInt ( ) ; int r = sc . nextInt ( ) ; if ( r - l == 0 ) { System . out . println ( l ) ; } else { System . out . println ( 2 ) ;   } }   }


import java . util . * ; import java . math . * ; public class FakeNP { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int l = sc . nextInt ( ) ; int r = sc . nextInt ( ) ; if ( l == r ) { System . out . println ( l ) ; return ; } System . out . println ( 2 ) ; } }


import java . util . * ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int l = sc . nextInt ( ) ; int r = sc . nextInt ( ) ; if ( l == r ) { System . out . println ( l ) ; } else { System . out . println ( "2" ) ; } } }


import java . util . * ;   public class Solve {   static Scanner scan = new Scanner ( System . in ) ;   public static long solve ( long l , long r ) { if ( l == r ) { return l ; } return 2 ; }    public static void main ( String [ ] args ) {   long l = scan . nextLong ( ) ; long r = scan . nextLong ( ) ; System . out . println ( solve ( l , r ) ) ; } }


import java . util . * ; public class Array { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ;   int n = sc . nextInt ( ) ; List < Integer > list1 = new ArrayList < > ( ) ; List < Integer > list2 = new ArrayList < > ( ) ; List < Integer > list3 = new ArrayList < > ( ) ;   for ( int i = 0 ; i < n ; i ++ ) { int temp = sc . nextInt ( ) ; if ( temp < 0 ) list1 . add ( temp ) ; else if ( temp > 0 ) list2 . add ( temp ) ; else list3 . add ( temp ) ; } if ( list2 . size ( ) == 0 ) { int num1 = list1 . remove ( list1 . size ( ) - 1 ) ; int num2 = list1 . remove ( list1 . size ( ) - 1 ) ; list2 . add ( num1 ) ; list2 . add ( num2 ) ; }   if ( list1 . size ( ) % 2 == 0 ) { list3 . add ( list1 . remove ( list1 . size ( ) - 1 ) ) ;   } sc . close ( ) ;   System . out . print ( list1 . size ( ) ) ; for ( int i = 0 ; i < list1 . size ( ) ; i ++ ) System . out . print ( " ▁ " + list1 . get ( i ) ) ;   System . out . println ( ) ; System . out . print ( list2 . size ( ) ) ; for ( int i = 0 ; i < list2 . size ( ) ; i ++ ) System . out . print ( " ▁ " + list2 . get ( i ) + " ▁ " ) ;   System . out . println ( ) ; System . out . print ( list3 . size ( ) ) ; for ( int i = 0 ; i < list3 . size ( ) ; i ++ ) System . out . print ( " ▁ " + list3 . get ( i ) + " ▁ " ) ; }    }

n = int ( input ( ) ) r = lambda : list ( map ( int , input ( ) . split ( ) ) ) arr = r ( ) neg = [ i for i in arr if i < 0 ] pos = [ i for i in arr if i > 0 ] zero = [ 0 ]   if len ( neg ) % 2 == 0 : pos . extend ( neg [ 1 : - 1 ] ) zero . append ( neg [ - 1 ] ) neg = neg [ : 1 ] else : if len ( pos ) == 0 : pos . extend ( neg [ - 2 : ] ) neg = neg [ : - 2 ]     print ( len ( neg ) , * neg ) print ( len ( pos ) , * pos ) print ( len ( zero ) , * zero )         NEW_LINE


n = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) arr . sort ( ) i = 0 while ( arr [ i ] < 0 and i < n ) : i += 1 neg = i - 1 zero = ii += 1 pos = 0 while ( i < n and arr [ i ] > 0 ) : i += 1 pos = iif pos > zero : print ( 1 , arr [ 0 ] ) print ( 1 , arr [ zero + 1 ] ) print ( n - 2 , end = ' ▁ ' ) for j in range ( 1 , n ) : if j != zero + 1 : print ( arr [ j ] , end = ' ▁ ' ) else : print ( 1 , arr [ 0 ] ) print ( 2 , arr [ 1 ] , arr [ 2 ] ) print ( n - 3 , end = ' ▁ ' ) for j in range ( 3 , n ) : print ( arr [ j ] , end = ' ▁ ' ) NEW_LINE


n = int ( input ( ) ) array = list ( map ( int , input ( ) . split ( ) ) ) a , b , c = [ ] , [ ] , [ ] for i in array : if i < 0 : a . append ( i ) elif i > 0 : b . append ( i ) else : c . append ( i ) if not b : b . append ( a . pop ( ) ) b . append ( a . pop ( ) ) if len ( a ) % 2 == 0 : c . append ( a . pop ( ) ) print ( len ( a ) , * a ) print ( len ( b ) , * b ) print ( len ( c ) , * c ) NEW_LINE


n = int ( input ( ) ) li = list ( map ( int , input ( ) . split ( ) ) ) a = [ ] b = [ ] c = [ ] for i in li : if i < 0 : a . append ( i ) elif i > 0 : b . append ( i ) else : c . append ( i )   if len ( a ) % 2 != 0 and len ( b ) == 0 : b . append ( a [ 0 ] ) b . append ( a [ 1 ] ) a = a [ 2 : ] elif len ( b ) == 0 and len ( a ) >= 3 : b . append ( a [ 0 ] ) b . append ( a [ 1 ] ) a = a [ 2 : ] c . extend ( a [ 1 : ] ) a = a [ : 1 ] if len ( a ) % 2 == 0 : c . extend ( a [ 1 : ] ) a = a [ : 1 ]     print ( len ( a ) , * a ) print ( len ( b ) , * b ) print ( len ( c ) , * c ) NEW_LINE


t = int ( input ( ) ) n = [ ] p = [ ] z = [ ] l = list ( map ( int , input ( ) . split ( ) ) ) for i in range ( t ) : if l [ i ] > 0 : p . append ( l [ i ] ) elif l [ i ] < 0 : n . append ( l [ i ] ) else : z . append ( l [ i ] ) if len ( n ) % 2 != 0 : if len ( p ) == 0 : x = n [ 0 ] y = n [ 1 ] p . append ( x ) p . append ( y ) n . remove ( x ) n . remove ( y ) else : if len ( p ) == 0 : a = n [ 0 ] b = n [ 1 ] c = n [ 2 ] p . append ( a ) p . append ( b ) z . append ( c ) n . remove ( a ) n . remove ( b ) n . remove ( c ) else : a = n [ 0 ] z . append ( a ) n . remove ( a )   r = ' ' s = ' ' q = ' ' for i in n : r += str ( i ) + ' ▁ ' for i in p : s += str ( i ) + ' ▁ ' for i in z : q += str ( i ) + ' ▁ ' print ( len ( n ) , r ) print ( len ( p ) , s ) print ( len ( z ) , q ) NEW_LINE


import java . util . ArrayList ; import java . util . Scanner ;   public class array { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int [ ] arr = new int [ x ] ; ArrayList < Integer > n = new ArrayList < > ( ) ; ArrayList < Integer > p = new ArrayList < > ( ) ; ArrayList < Integer > z = new ArrayList < > ( ) ;   for ( int i = 0 ; i < x ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; if ( arr [ i ] < 0 ) n . add ( arr [ i ] ) ; if ( arr [ i ] > 0 ) p . add ( arr [ i ] ) ; if ( arr [ i ] == 0 ) z . add ( arr [ i ] ) ;    }


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


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


import java . util . * ;   public class Main { public static void main ( String [ ] args ) throws Exception { Scanner in = new Scanner ( System . in ) ;   int q = in . nextInt ( ) ;   ArrayList < Interval > intervals = new ArrayList < > ( ) ; int numIntervals = 0 ;   for ( int counter = 0 ; counter < q ; counter ++ ) { if ( in . nextInt ( ) == 1 ) { Interval newInterval = new Interval ( in . nextInt ( ) , in . nextInt ( ) , ++ numIntervals ) ; for ( Interval i : intervals ) { i . addInterval ( newInterval ) ; newInterval . addInterval ( i ) ; } intervals . add ( newInterval ) ; } else { int first = in . nextInt ( ) - 1 ; int goal = in . nextInt ( ) - 1 ;   System . out . println ( intervals . get ( first ) . contains ( intervals . get ( goal ) ) ? " YES " : " NO " ) ; } } }   private static class Interval { int a , b , id ; ArrayList < Interval > paths ;   public Interval ( int a , int b , int id ) { this . a = a ; this . b = b ; this . id = id ;   paths = new ArrayList < > ( ) ; }   public void addInterval ( Interval i ) { if ( i . a < this . a && this . a < i . b || i . a < this . b && this . b < i . b ) { paths . add ( i ) ;

def addEdges ( adj , nodes ) : startNewInterval , endNewInterval = nodes [ - 1 ] for i in range ( 1 , len ( nodes ) - 1 ) : startOther , endOther = nodes [ i ] if startOther < startNewInterval < endOther or startOther < endNewInterval < endOther : adj [ len ( nodes ) - 1 ] . add ( i ) if startNewInterval < startOther < endNewInterval or startNewInterval < endOther < endNewInterval : adj [ i ] . add ( len ( nodes ) - 1 )   def dfs ( adj , start , dest ) : visited = [ False ] * len ( adj ) dfsStack = [ start ] while dfsStack : cur = dfsStack . pop ( ) if visited [ cur ] : continue if cur == dest : return True visited [ cur ] = True dfsStack . extend ( list ( adj [ cur ] ) ) return False inputs = int ( input ( ) ) nodes = [ None ] adj = [ None ] for _ in range ( inputs ) : queryType , start , end = map ( int , input ( ) . split ( ) ) if queryType == 1 : NEW_LINE


import sysfrom math import sqrtfrom collections import dequeinput = sys . stdin . readline   NEW_LINE


n = int ( input ( ) )     class Graph :   def __init__ ( self , V ) : self . V = V self . adj = [ [ ] for i in range ( V ) ]   def DFSUtil ( self , temp , v , y , visited ) :   visited [ v ] = True if v == y : return True   NEW_LINE


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

n = int ( input ( ) ) ax , ay = map ( int , input ( ) . split ( ) ) bx , by = map ( int , input ( ) . split ( ) ) cx , cy = map ( int , input ( ) . split ( ) ) if ax in range ( min ( bx , cx ) , max ( bx , cx ) ) or ay in range ( min ( by , cy ) , max ( by , cy ) ) : print ( ' NO ' ) else : print ( ' YES ' ) NEW_LINE


N = int ( input ( ) ) ax , ay = map ( int , input ( ) . split ( ) ) bx , by = map ( int , input ( ) . split ( ) ) cx , cy = map ( int , input ( ) . split ( ) ) board = [ [ - 1 ] * N for i in range ( N ) ] for i in range ( N ) : board [ i ] [ ax - 1 ] = 1 board [ ay - 1 ] [ i ] = 1 for i in range ( - N , N ) : if 0 <= ay - 1 + i < N and 0 <= ax - 1 + i < N : board [ ay - 1 + i ] [ ax - 1 + i ] = 1 if 0 <= ay - 1 - i < N and 0 <= ax - 1 + i < N : board [ ay - 1 - i ] [ ax - 1 + i ] = 1 q = [ ( by - 1 , bx - 1 ) ] while q : yy , xx = q . pop ( ) if yy == cy - 1 and xx == cx - 1 : print ( " YES " ) exit ( ) for dx in [ - 1 , 0 , 1 ] : for dy in [ - 1 , 0 , 1 ] : if 0 <= yy + dy < N and 0 <= xx + dx < N and board [ yy + dy ] [ xx + dx ] == - 1 : board [ yy + dy ] [ xx + dx ] = 0 q . append ( ( yy + dy , xx + dx ) ) print ( " NO " ) NEW_LINE


n = int ( input ( ) ) ax , ay = map ( int , input ( ) . split ( ) ) NEW_LINE


n = int ( input ( ) ) ax , ay = map ( int , input ( ) . split ( ) ) bx , by = map ( int , input ( ) . split ( ) ) cx , cy = map ( int , input ( ) . split ( ) ) if ( ( bx > ax and cx > ax ) or ( bx < ax and cx < ax ) ) and ( ( by > ay and cy > ay ) or ( by < ay and cy < ay ) ) : print ( ' YES ' ) else : print ( ' NO ' ) NEW_LINE


dimensions = int ( input ( ) ) ax , ay = tuple ( map ( int , input ( ) . split ( ) ) ) bx , by = tuple ( map ( int , input ( ) . split ( ) ) ) cx , cy = tuple ( map ( int , input ( ) . split ( ) ) )   if bx < ax and by < ay : if cx < ax and cy < ay : diff_x = ax - cx diff_y = ay - cy   if diff_x == diff_y : print ( ' NO ' ) else : print ( ' YES ' ) else : print ( ' NO ' )   elif bx < ax and by > ay : if cx < ax and cy > ay : diff_x = ax - cx diff_y = cy - ay   if diff_x == diff_y : print ( ' NO ' ) else : print ( ' YES ' ) else : print ( ' NO ' )   elif bx > ax and by < ay : if cx > ax and cy < ay : diff_x = cx - ax diff_y = ay - cy   if diff_x == diff_y : print ( ' NO ' ) else : print ( ' YES ' ) else : print ( ' NO ' )   elif bx > ax and by > ay : if cx > ax and cy > ay : diff_x = cx - ax diff_y = cy - ay   if diff_x == diff_y : print ( ' NO ' ) else : print ( ' YES ' ) else : print ( ' NO ' )   else : print ( ' NO ' ) NEW_LINE


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


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


import java . util . Scanner ; public class Test {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int [ ] home = new int [ n ] ; int [ ] away = new int [ n ] ; int matches = 0 ; for ( int i = 0 ; i < n ; i ++ ) { home [ i ] = in . nextInt ( ) ; away [ i ] = in . nextInt ( ) ; } for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { if ( i == j ) continue ; if ( home [ i ] == away [ j ] ) ++ matches ; } } System . out . println ( matches ) ; } }

n = int ( input ( ) ) l1 = [ ] l2 = [ ] result = 0 for i in range ( n ) : t = input ( ) . split ( ) l1 . append ( t [ 0 ] ) l2 . append ( t [ 1 ] )   for i in range ( len ( l1 ) ) : for j in range ( len ( l2 ) ) : if l1 [ i ] == l2 [ j ] : result += 1     print ( result ) NEW_LINE


s = 0 a = [ list ( map ( int , input ( ) . split ( ) ) ) for i in range ( int ( input ( ) ) ) ] for i in range ( len ( a ) ) : for j in range ( len ( a ) ) : if a [ i ] [ 0 ] == a [ j ] [ 1 ] : s += 1 print ( s ) NEW_LINE


n = int ( input ( " " ) ) l = [ ] for i in range ( n ) : a , b = input ( " " ) . split ( " ▁ " ) a , b = int ( a ) , int ( b ) l . append ( a ) l . append ( b ) c = 0 for i in range ( 0 , len ( l ) , 2 ) : for j in range ( 1 , len ( l ) , 2 ) : if l [ i ] == l [ j ] : c = c + 1 print ( c ) NEW_LINE


n = int ( input ( ) ) s1 = [ ] s2 = [ ] ans = 0 for i in range ( n ) : a , b = input ( ) . split ( ) s1 . append ( a ) s2 . append ( b )   for x in s2 : ans = ans + s1 . count ( x ) NEW_LINE


n = int ( input ( ) ) l1 = [ ] l2 = [ ] r = 0 for i in range ( n ) : t = input ( ) . split ( ) l1 . append ( t [ 0 ] ) l2 . append ( t [ 1 ] )   for i in range ( len ( l1 ) ) : for j in range ( len ( l2 ) ) : if l1 [ i ] == l2 [ j ] : r += 1     print ( r ) NEW_LINE


import java . util . * ;   public class Main { public static void main ( String [ ] args ) { int n , i ; int a1 , a2 ; int [ ] jerh = new int [ 51 ] ; int [ ] jera = new int [ 51 ] ; Scanner sc = new Scanner ( System . in ) ; n = sc . nextInt ( ) ; for ( i = 0 ; i < n ; i ++ ) { a1 = sc . nextInt ( ) ; a2 = sc . nextInt ( ) ; jerh [ i ] = a1 ; jera [ i ] = a2 ; } int j , sig = 0 ; for ( i = 0 ; i < n ; i ++ ) { for ( j = 0 ; j < n ; j ++ ) { if ( jerh [ i ] == jera [ j ] ) sig ++ ; } } System . out . println ( sig ) ; } }


import java . util . * ; public class Game { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; int [ ] arr1 = new int [ n ] ; int [ ] arr2 = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr1 [ i ] = s . nextInt ( ) ; arr2 [ i ] = s . nextInt ( ) ; } int count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { if ( i != j && arr1 [ i ] == arr2 [ j ] ) { count ++ ; } } } System . out . println ( count ) ; } }


import java . util . * ; public class Game { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; int [ ] h = new int [ t ] ; int [ ] a = new int [ t ] ; int count = 0 ; for ( int i = 0 ; i < t ; i ++ ) { h [ i ] = sc . nextInt ( ) ; a [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < t ; i ++ ) { for ( int j = 0 ; j < t ; j ++ ) { if ( i != j && h [ i ] == a [ j ] ) ++ count ; } } System . out . println ( count ) ; } }


import java . util . Scanner ; public class Test {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int [ ] home = new int [ n ] ; int [ ] away = new int [ n ] ; int matches = 0 ; for ( int i = 0 ; i < n ; i ++ ) { home [ i ] = in . nextInt ( ) ; away [ i ] = in . nextInt ( ) ; } for ( int i = 0 ; i < n ; i ++ ) for ( int j = 0 ; j < n ; j ++ ) if ( home [ i ] == away [ j ] ) ++ matches ; System . out . println ( matches ) ; } }


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

for z in range ( 1 ) : co = 0 n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) for e in range ( 1 , 25 ) : po = 2 ** e re = sorted ( [ k % po for k in l ] ) b = n r = 0 for a in range ( n ) : b -= 1 while re [ a ] + re [ b ] >= po and b >= 0 : b -= 1 b += 1 r += n - b - ( a >= b ) r //= 2 if r % 2 : co += 2 ** e if n % 2 == 0 : for k in l : co = co ^ k print ( co ) NEW_LINE


import sysinput = sys . stdin . readline   n = int ( input ( ) ) A = list ( map ( int , input ( ) . split ( ) ) )   ANS = 0 for i in range ( 26 ) : B = [ ]   for a in A : B . append ( a & ( ( 1 << ( i + 1 ) ) - 1 ) )   B . sort ( )   j0 = n - 1 j1 = n - 1 j2 = n - 1 count = 0   for j in range ( n ) : while j0 >= 0 and B [ j0 ] + B [ j ] >= ( 1 << i ) : j0 -= 1 while j1 >= 0 and B [ j1 ] + B [ j ] > ( 1 << ( i + 1 ) ) - 1 : j1 -= 1   while j2 >= 0 and B [ j2 ] + B [ j ] >= ( 1 << i ) + ( 1 << ( i + 1 ) ) : j2 -= 1   NEW_LINE


from collections import defaultdictfrom queue import deque     def arrinp ( ) : return [ * map ( int , input ( ) . split ( ' ▁ ' ) ) ]     def mulinp ( ) : return map ( int , input ( ) . split ( ' ▁ ' ) )     def intinp ( ) : return int ( input ( ) )     def solution ( ) : co = 0 n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) for e in range ( 1 , 25 ) : po = 2 ** e re = sorted ( [ k % po for k in l ] ) b = n r = 0 for a in range ( n ) : b -= 1 while re [ a ] + re [ b ] >= po and b >= 0 : b -= 1 b += 1 r += n - b - ( a >= b ) r //= 2 if r % 2 : co += 2 ** e if n % 2 == 0 : for k in l : co = co ^ k print ( co )     testcases = 1 NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . StringTokenizer ;   public class Main { private static int findAnswer ( int n , int [ ] a ) { int res = 0 ; for ( int bit = 0 ; bit <= 25 ; bit ++ ) { if ( findBit ( n , a , bit ) > 0 ) { res += ( 1 << bit ) ; } } return res ; }   private static int findBit ( int n , int [ ] a , int bit ) { int [ ] A = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { A [ i ] = ( a [ i ] % ( 1 << ( bit + 1 ) ) ) ; } Arrays . sort ( A ) ;


import java . io . * ; import java . util . * ; import static java . lang . Math . * ;   public class PresentRedo { public static void main ( String [ ] args ) { FastScanner sc = new FastScanner ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; int N = sc . nextInt ( ) ; int [ ] a = new int [ N ] ; Arrays . setAll ( a , i -> sc . nextInt ( ) ) ; int MAXBIT = 24 ; int ans = 0 ; for ( int i = 0 , bit = 1 ; i <= MAXBIT ; i ++ , bit <<= 1 ) { int [ ] fraction = new int [ N ] ; long ones = 0 ; for ( int j = 0 ; j < N ; j ++ ) { fraction [ j ] = a [ j ] & ( bit - 1 ) ; if ( ( a [ j ] & bit ) > 0 ) { ones ++ ; } } Arrays . sort ( fraction ) ; int r = N ; long carried = 0 ; for ( int l = 0 ; l < N ; l ++ ) { while ( r >= max ( 1 , l + 2 ) && fraction [ l ] + fraction [ r - 1 ] >= bit ) { r -- ; } r = max ( r , l + 1 ) ; carried += max ( 0 , N - r ) ; }


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

def fun ( ls , ms ) : ans = 0 for i , j in zip ( ls , ms ) : NEW_LINE


n = int ( input ( ) ) s1 = input ( ) s2 = input ( ) s = 0 for i in range ( n ) : m = min ( abs ( int ( s1 [ i ] ) - int ( s2 [ i ] ) ) , min ( int ( s1 [ i ] ) , 10 - int ( s1 [ i ] ) ) + min ( int ( s2 [ i ] ) , 10 - int ( s2 [ i ] ) ) ) s = s + mprint ( s ) NEW_LINE


from __future__ import division , print_functionfrom collections import * from math import * from itertools import * import osimport sysfrom io import BytesIO , IOBaseimport math   if sys . version_info [ 0 ] < 3 : from __builtin__ import xrange as range from future_builtins import ascii , filter , hex , map , oct , zip       def main ( ) : n = int ( input ( ) ) NEW_LINE


n = int ( input ( ) ) lock = str ( input ( ) ) unlock = str ( input ( ) )   total_comb = 0   for i in range ( 0 , n ) : a = int ( lock [ i ] ) b = int ( unlock [ i ] )   d1 = abs ( a - b ) d2 = 10 - max ( a , b ) + min ( a , b )   total_comb += min ( d1 , d2 )   print ( total_comb ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Arrays ; import java . util . HashMap ; import java . util . Random ; import java . util . * ; import java . util . StringTokenizer ; import java . util . Scanner ; public class Comptetive { static class Pair { int f ; int s ; Pair ( int f , int s ) { this . f = f ; this . s = s ; } } public static void main ( String [ ] args ) { FastScanner fs = new FastScanner ( ) ; int n = fs . nextInt ( ) ;


import java . util . * ; import java . io . * ; import java . math . * ; import java . text . * ;   public class Main { static PrintWriter out ; static Reader in ; public static void main ( String [ ] args ) throws IOException { input_output ( ) ;


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . * ;   public class A { static class FastScanner { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( " " ) ;   String next ( ) { while ( ! st . hasMoreTokens ( ) ) try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   int [ ] nextArray ( int n ) { int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextInt ( ) ; return a ; }   long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } } static class FastWriter extends PrintWriter { FastWriter ( ) { super ( System . out ) ; }   void println ( int [ ] array ) { for ( int i = 0 ; i < array . length ; i ++ ) { print ( array [ i ] + " ▁ " ) ; } println ( ) ; }   void println ( long [ ] array ) { for ( int i = 0 ; i < array . length ; i ++ ) { print ( array [ i ] + " ▁ " ) ; } println ( ) ; } } public static void main ( String [ ] args ) { FastScanner in = new FastScanner ( ) ; FastWriter out = new FastWriter ( ) ; int n = in . nextInt ( ) ; String [ ] str1 = in . next ( ) . split ( " " ) ; String [ ] str2 = in . next ( ) . split ( " " ) ; int cnt = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int diff = Math . abs ( Integer . parseInt ( str1 [ i ] ) - Integer . parseInt ( str2 [ i ] ) ) ; if ( diff <= 5 ) { cnt += diff ; } else { cnt += 10 - diff ; } } out . println ( cnt ) ; out . close ( ) ; } }


import java . util . Scanner ;   public class A540 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) , t = 0 ; String word1 = scanner . next ( ) , word2 = scanner . next ( ) ; for ( int i = 0 ; i < n ; i ++ ) { int diff = Math . abs ( word1 . charAt ( i ) - word2 . charAt ( i ) ) ; if ( diff > 5 ) { t += 10 - diff ; } else { t += diff ; } } System . out . println ( t ) ; } }


import java . io . * ; import java . util . * ;   public class Olympiad { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; HashSet < Integer > set = new HashSet < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { int a = sc . nextInt ( ) ; if ( ! set . contains ( a ) && a != 0 ) { set . add ( a ) ; } } System . out . println ( set . size ( ) ) ; } }

def main_function ( ) : n = int ( input ( ) ) p = [ int ( i ) for i in input ( ) . split ( " ▁ " ) ] hash = [ 0 for i in range ( 605 ) ] for i in p : if not i == 0 : hash [ i ] += 1 count = 0 for i in hash : if i != 0 : count += 1 return count       print ( main_function ( ) ) NEW_LINE


n = int ( input ( ) ) a = set ( map ( int , input ( ) . split ( ) ) ) a -= { 0 } print ( len ( a ) ) NEW_LINE


import sysinput = sys . stdin . readline   n = int ( input ( ) ) a = [ int ( i ) for i in input ( ) . split ( ) ] res = [ int ( i ) for i in a if i > 0 ] print ( len ( set ( res ) ) ) NEW_LINE


import sys   def main ( ) : _ , s = sys . stdin . read ( ) . strip ( ) . split ( ' \n ' ) return len ( set ( s . split ( ) ) - { '0' } ) print ( main ( ) ) NEW_LINE


import java . util . Scanner ; import java . util . Arrays ;   public class Main {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; int r = 0 ; while ( r < n ) { a [ r ] = sc . nextInt ( ) ; r ++ ; } r = 0 ; int i = n - 1 ; int q = 1 ; Arrays . sort ( a ) ; while ( a [ r ] == 0 ) { r ++ ; } r = 0 ; while ( a [ r ] == 0 ) { if ( r + 1 == n ) { q = 0 ; r ++ ; } q = 1 ; r ++ ; } if ( q != 0 ) { while ( a [ r ] == 0 ) { r ++ ; } while ( a [ r ] != a [ i ] ) { if ( a [ r ] == a [ r + 1 ] ) { r ++ ; } else { q ++ ; r ++ ; } } System . out . println ( q ) ; } else { System . out . println ( 0 ) ; } } }


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


import java . util . ArrayList ; import java . util . Arrays ; import java . util . Scanner ;   public class Singleton_Pattern { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int a [ ] = new int [ 601 ] ; Arrays . fill ( a , - 1 ) ; int res = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int x = sc . nextInt ( ) ; if ( x > 0 && a [ x ] == - 1 ) { a [ x ] = 1 ; res ++ ; } } System . out . println ( res ) ; } }


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

n , x , y = map ( int , input ( ) . split ( ) ) s = input ( ) c = 0 ans1 , ans2 = 0 , 0 for i in range ( n - 1 ) : if s [ i ] == '0' and s [ i + 1 ] == '1' : c += 1 if s [ n - 1 ] == '0' : c += 1 if c == 0 : print ( 0 ) else : ans1 = x * ( c - 1 ) + y ans2 = ( c - 1 ) * y + y print ( min ( ans1 , ans2 ) )               NEW_LINE


def so ( l ) : l = l . replace ( "11" , "1" ) return ln , x , y = map ( int , input ( ) . split ( ) ) l = input ( ) if ( "0" not in l ) : print ( 0 ) else : while ( "11" in l ) : l = so ( l ) l = l . split ( "1" ) if ( l [ 0 ] == " " ) : l . remove ( " " ) if ( l [ - 1 ] == " " ) : l . pop ( )   a = len ( l ) - 1 ans1 = ( a + 1 ) * y   ans2 = a * x + y print ( min ( ans1 , ans2 ) ) NEW_LINE


if __name__ == ' _ _ main _ _ ' : n , x , y = map ( int , input ( ) . split ( ) ) s = list ( input ( ) )   arr = [ s [ 0 ] ]   for i in range ( 1 , n ) : if s [ i ] != s [ i - 1 ] : arr . append ( s [ i ] )   if len ( arr ) == 1 and arr [ 0 ] == '1' : print ( 0 ) exit ( 0 )   c = arr . count ( '0' )   xarr = [ 0 ] yarr = [ y ]   for i in range ( 1 , c ) : xarr . append ( xarr [ - 1 ] + x ) yarr . append ( yarr [ - 1 ] + y )   yarr . reverse ( )   print ( min ( map ( lambda o : o [ 0 ] + o [ 1 ] , zip ( xarr , yarr ) ) ) ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . StringTokenizer ; import java . util . Arrays ; import java . util . ArrayList ; import java . util . * ;   public class Main { static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } public static void main ( String [ ] args ) { FastReader sc = new FastReader ( ) ; int n = sc . nextInt ( ) ; long x = sc . nextLong ( ) ; long y = sc . nextLong ( ) ; String s = sc . next ( ) ; int i = 0 ; int count0 , count1 ; count1 = 0 ; count0 = 0 ; char st = s . charAt ( 0 ) ; if ( st == '0' ) count0 ++ ; else count1 ++ ; for ( i = 1 ; i < n ; i ++ ) { if ( s . charAt ( i ) == st ) continue ; { st = s . charAt ( i ) ; if ( st == '0' ) count0 ++ ; else count1 ++ ; } } if ( y > x ) { if ( count0 > 1 ) {


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

import mathn = int ( input ( ) ) ; ans = 0 a = list ( map ( int , input ( ) . split ( ) ) ) for i in range ( n ) : x = 0 for j in range ( i , n ) : x = x ^ a [ j ] ans = max ( ans , x ) print ( ans )   NEW_LINE


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


n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) ans = max ( a ) for i in range ( n - 1 ) : p = a [ i ] for j in range ( i + 1 , n ) : p = p ^ a [ j ] ans = max ( ans , p ) print ( ans ) NEW_LINE


n = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) max_xor = - 19999 for i in range ( 1 , n + 1 ) : for j in range ( n - i + 1 ) : cur_xor = arr [ j ] for h in range ( j , j + i - 1 ) : cur_xor = cur_xor ^ arr [ h + 1 ] max_xor = max ( cur_xor , max_xor ) print ( max_xor ) NEW_LINE


import math , sysfrom collections import defaultdict , dequeimport bisect as bidef yes ( ) : print ( ' YES ' ) def no ( ) : print ( ' NO ' ) def I ( ) : return ( int ( sys . stdin . readline ( ) ) ) def In ( ) : return ( map ( int , sys . stdin . readline ( ) . split ( ) ) ) def Sn ( ) : return sys . stdin . readline ( ) . strip ( ) def Pr ( x ) : sys . stdout . write ( str ( x ) + ' \n ' ) NEW_LINE


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long [ ] x = new long [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) { x [ i ] = sc . nextLong ( ) ^ x [ i - 1 ] ; } long max = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { max = Math . max ( x [ i ] , max ) ; for ( int j = 0 ; j < i ; j ++ ) { max = Math . max ( x [ i ] ^ x [ j ] , max ) ; } } System . out . println ( max ) ; } }


import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { Scanner read = new Scanner ( System . in ) ; long ans = 0 ; int n = read . nextInt ( ) ; long [ ] arr = new long [ n + 1 ] ; long [ ] pref = new long [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) { arr [ i ] = read . nextLong ( ) ; pref [ i ] = pref [ i - 1 ] ^ arr [ i ] ; } for ( int i = 1 ; i <= n ; i ++ ) { for ( int j = i ; j <= n ; j ++ ) { ans = Math . max ( ans , pref [ j ] ^ pref [ i - 1 ] ) ; } } System . out . println ( ans ) ; } }


import java . io . * ; import java . util . * ;   public class P396A { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; Task solver = new Task ( ) ; solver . solve ( in , out ) ; out . close ( ) ; }   static class Task { private static List < Integer > primes = new ArrayList < > ( ) ; final long M = 1000000007 ;   public static void sievePrimes ( int maxValue ) {

from math import factorial as fdef primes ( n ) : sieve = [ True ] * n for i in range ( 3 , int ( n ** 0.5 ) + 1 , 2 ) : if sieve [ i ] : sieve [ i * i : : 2 * i ] = [ False ] * ( ( n - i * i - 1 ) // ( 2 * i ) + 1 ) return [ 2 ] + [ i for i in range ( 3 , n , 2 ) if sieve [ i ] ] p = primes ( 31627 ) s = [ 0 ] * ( 31623 ) s1 = { } def factorize ( n ) : for i in p : if n <= 1 : return 56 while n % i == 0 : s [ p . index ( i ) ] += 1 n //= i if n > 1 : if n in s1 : s1 [ n ] += 1 else : s1 [ n ] = 1 n = int ( input ( ) ) for i in map ( int , input ( ) . split ( ) ) : factorize ( i ) s = list ( filter ( lambda a : a != 0 , s ) ) for i in s1 . values ( ) : s . append ( i ) ans = 1 for i in s : ans *= f ( i + n - 1 ) // ( f ( n - 1 ) * f ( i ) ) print ( int ( ans ) % 1000000007 ) NEW_LINE


Mod = 1000000007 MAX = 33000 n = int ( input ( ) ) A = list ( map ( int , input ( ) . split ( ) ) ) B = [ 0 ] * MAX bePrime = [ 0 ] * MAX ; primNum = [ ] C = [ ] fac = [ 1 ] for j in range ( 1 , MAX ) : fac . append ( fac [ - 1 ] * j % Mod ) def calc ( M , N ) : return fac [ M ] * pow ( fac [ N ] * fac [ M - N ] % Mod , Mod - 2 , Mod ) % Mod for j in range ( 2 , MAX ) : if bePrime [ j ] == 0 : primNum . append ( j ) i = j while i < MAX : bePrime [ i ] = 1 i = i + j for x in A : tmp = x for j in primNum : while tmp % j == 0 : tmp /= j B [ j ] += 1 if tmp > 1 : C . append ( tmp ) ans = 1 for j in range ( 2 , MAX ) : if B [ j ] > 0 : ans = ans * calc ( n + B [ j ] - 1 , n - 1 ) % Mod l = len ( C ) for j in range ( 0 , l ) : num = 0 ; for k in range ( 0 , l ) : if C [ k ] == C [ j ] : num = num + 1 if k > j : num = 0 break if num > 0 : ans = ans * calc ( n + num - 1 , n - 1 ) % Mod print ( str ( ans % Mod ) ) NEW_LINE


import java . io . * ; import java . math . BigInteger ; import java . util . * ; import java . util . Stack ; import java . util . regex . Pattern ;        public class ROUGH {   public static class FastReader { BufferedReader br ; StringTokenizer st ;


import java . io . * ; import java . math . BigInteger ; import java . util . ArrayList ; import java . util . HashMap ; import java . util . StringTokenizer ;   public class multipliers { static public HashMap < Integer , Integer > factor ( int in ) { HashMap < Integer , Integer > result = new HashMap < > ( ) ; for ( int i = 2 ; i * i <= in ; i ++ ) { if ( in % i == 0 ) { int count = 0 ; while ( in % i == 0 ) { count ++ ; in /= i ; } result . put ( i , count ) ; } } if ( in != 1 ) { result . put ( in , 1 ) ; } return result ; }   static public void factor ( int in , HashMap < Integer , Integer > a ) { HashMap < Integer , Integer > result = new HashMap < > ( ) ; for ( int i = 2 ; i * i <= in ; i ++ ) { if ( in % i == 0 ) { int count = 0 ; while ( in % i == 0 ) { count ++ ; in /= i ; } if ( a . containsKey ( i ) ) a . put ( i , a . remove ( i ) + count ) ; else a . put ( i , count ) ; } } if ( in != 1 ) { if ( a . containsKey ( in ) ) a . put ( in , a . remove ( in ) + 1 ) ; else a . put ( in , 1 ) ;   }   } static int base = 0 ; static int MOD = ( int ) ( 1e9 + 7 ) ;


import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . OutputStream ; import java . util . Set ; import java . util . HashMap ; import java . io . IOException ; import java . util . Random ; import java . io . UncheckedIOException ; import java . util . HashSet ; import java . util . Map ; import java . io . Closeable ; import java . io . Writer ; import java . io . OutputStreamWriter ; import java . math . BigInteger ; import java . util . Collections ; import java . io . InputStream ;   public class Main { public static void main ( String [ ] args ) throws Exception { Thread thread = new Thread ( null , new TaskAdapter ( ) , " " , 1 << 29 ) ; thread . start ( ) ; thread . join ( ) ; }   static class TaskAdapter implements Runnable { @ Override public void run ( ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; FastInput in = new FastInput ( inputStream ) ; FastOutput out = new FastOutput ( outputStream ) ; AOnNumberOfDecompositionsIntoMultipliers solver = new AOnNumberOfDecompositionsIntoMultipliers ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } }   static class AOnNumberOfDecompositionsIntoMultipliers { int mod = ( int ) 1e9 + 7 ; Combination comb = new Combination ( ( int ) 1e5 , mod ) ;   public void solve ( int testNumber , FastInput in , FastOutput out ) { int n = in . ri ( ) ; int [ ] a = in . ri ( n ) ; Map < Integer , Integer > map = new HashMap < > ( ) ; for ( int x : a ) { Set < Integer > set = PollardRho . findAllFactors ( x ) ; for ( int y : set ) { int p = 0 ; while ( x % y == 0 ) { x /= y ; p ++ ; } map . put ( y , map . getOrDefault ( y , 0 ) + p ) ; } }   long ans = 1 ; for ( int v : map . values ( ) ) {


import java . util . * ; import java . io . * ; public class Solution { public static PrintWriter out ; public static void main ( String args [ ] ) { MyScanner sc = new MyScanner ( ) ; out = new PrintWriter ( new BufferedOutputStream ( System . out ) , true ) ; int n = sc . nextInt ( ) ; for ( int z = 1 ; z <= n ; z ++ ) { long p = sc . nextLong ( ) ; long q = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; q = q / gcd ( p , q ) ; b = gcd ( b , q ) ; while ( b != 1 ) { while ( q % b == 0 ) q = q / b ; b = gcd ( q , b ) ; } if ( q == 1 ) out . println ( " Finite " ) ; else out . println ( " Infinite " ) ; } out . close ( ) ; } public static long gcd ( long a , long b ) { if ( a == 0 ) return b ; else if ( b == 0 ) return a ; return gcd ( b , a % b ) ; } public static class MyScanner { BufferedReader br ; StringTokenizer st ; public MyScanner ( ) { 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 Main { public static void main ( String args [ ] ) { FastReader input = new FastReader ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; int T = input . nextInt ( ) ; while ( T - -> 0 ) { long p = input . nextLong ( ) ; long q = input . nextLong ( ) ; long b = input . nextLong ( ) ; q = q / gcd ( p , q ) ; long g = gcd ( q , b ) ; while ( g > 1 ) { while ( q % g == 0 ) { q = q / g ; } g = gcd ( q , b ) ; } if ( q == 1 ) { out . println ( " Finite " ) ; } else { out . println ( " Infinite " ) ; } } out . close ( ) ; } public static long gcd ( long a , long b ) { if ( a == 0 ) { return b ; } else { return gcd ( b % a , a ) ; } } 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 ; } } } NEW_LINE


import sys   def main ( ) : n = int ( input ( ) ) ans = [ ] for i in range ( n ) : p , q , b = map ( int , input ( ) . split ( " ▁ " ) ) t = pow ( b , 111 , q ) if p * t % q == 0 : ans . append ( " Finite " ) else : ans . append ( " Infinite " )   print ( " \n " . join ( ans ) )   main ( ) NEW_LINE


import sysinput = sys . stdin . readline   t = int ( input ( ) ) res = [ ] for _ in range ( t ) : p , q , b = map ( int , input ( ) . split ( ) ) if p * pow ( b , 64 , q ) % q != 0 : res . append ( " Infinite " ) else : res . append ( " Finite " ) print ( ' \n ' . join ( res ) ) NEW_LINE


import java . io . BufferedInputStream ; import java . io . IOException ; import java . io . PrintWriter ;   public class CF_483_A {   static final BufferedInputStream input = new BufferedInputStream ( System . in ) ; static final PrintWriter output = new PrintWriter ( System . out ) ;   public static void main ( String [ ] args ) throws Exception { int n = readInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) { long p = readLong ( ) ; long q = readLong ( ) ; long b = readLong ( ) ; q = q / gcd ( q , p ) ; long d = gcd ( q , b ) ; while ( d > 1 ) { q /= d ; while ( ( q % d ) == 0 ) { q /= d ; } d = gcd ( q , d ) ; } output . println ( ( q == 1 ) ? " Finite " : " Infinite " ) ; } output . flush ( ) ; output . close ( ) ; }   static long gcd ( long a , long b ) {


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 = input . nextInt ( ) ; while ( T -- > 0 ) { long p = input . nextLong ( ) ; long q = input . nextLong ( ) ; long b = input . nextLong ( ) ; q = q / gcd ( p , q ) ; long g = gcd ( q , b ) ; while ( g > 1 ) { while ( q % g == 0 ) { q = q / g ; } g = gcd ( q , b ) ; } if ( q == 1 ) { out . println ( " Finite " ) ; } else { out . println ( " Infinite " ) ; } } out . close ( ) ; } public static long gcd ( long a , long b ) { if ( a == 0 ) { return b ; } else { return gcd ( b % a , a ) ; } } static class FastReader { BufferedReader br ; StringTokenizer st ;   public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; }   String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   long nextLong ( ) {   return Long . parseLong ( next ( ) ) ; }   double nextDouble ( ) {   return Double . parseDouble ( next ( ) ) ; }   String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } }


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

t = int ( input ( ) ) NEW_LINE for _ in range ( t ) : NEW_LINE INDENT n = int ( input ( ) ) NEW_LINE ali = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE q = ali [ 1 ] + ali [ 0 ] NEW_LINE if ( ali [ - 1 ] >= q ) : NEW_LINE INDENT print ( 1 , 2 , n ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( - 1 ) NEW_LINE DEDENT DEDENT


def removeSmallest ( ) : NEW_LINE INDENT s = arr [ 0 ] + arr [ 1 ] NEW_LINE k = 0 NEW_LINE if len ( arr ) < 3 : NEW_LINE INDENT k = - 1 NEW_LINE DEDENT for i in range ( 2 , n ) : NEW_LINE INDENT if s <= arr [ i ] : NEW_LINE INDENT k = 0 NEW_LINE x = i + 1 NEW_LINE break NEW_LINE DEDENT else : NEW_LINE INDENT k = - 1 NEW_LINE DEDENT DEDENT if k == 0 : NEW_LINE INDENT return ( " " + str ( 1 ) + " ▁ " + str ( 2 ) + " ▁ " + str ( i + 1 ) ) NEW_LINE DEDENT else : NEW_LINE INDENT return - 1 NEW_LINE DEDENT DEDENT t = int ( input ( ) ) NEW_LINE for _ in range ( t ) : NEW_LINE INDENT n = int ( input ( ) ) NEW_LINE arr = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE print ( removeSmallest ( ) ) NEW_LINE DEDENT


import sys NEW_LINE input = sys . stdin . readline NEW_LINE for test in range ( int ( input ( ) ) ) : NEW_LINE INDENT n = int ( input ( ) ) NEW_LINE a = [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE if a [ 0 ] + a [ 1 ] > a [ - 1 ] : NEW_LINE INDENT print ( - 1 ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( 1 , 2 , n ) NEW_LINE DEDENT DEDENT


for _ in range ( int ( input ( ) ) ) : NEW_LINE INDENT n = int ( input ( ) ) NEW_LINE a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE print ( * ( [ 1 , 2 , n ] , [ - 1 ] ) [ a [ 0 ] + a [ 1 ] > a [ n - 1 ] ] ) NEW_LINE DEDENT


import sys NEW_LINE input = sys . stdin . readline NEW_LINE def non_deg ( vals ) : NEW_LINE INDENT a , b , c = vals NEW_LINE return a + b > c and a + c > b and b + c > a NEW_LINE DEDENT t = int ( input ( ) ) NEW_LINE for _ in range ( t ) : NEW_LINE INDENT n = int ( input ( ) ) NEW_LINE a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE if not non_deg ( [ a [ 0 ] , a [ 1 ] , a [ - 1 ] ] ) : NEW_LINE INDENT print ( 1 , 2 , n ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( - 1 ) NEW_LINE DEDENT DEDENT


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


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


import java . util . * ; import java . io . * ; public class _practise { public static void main ( String args [ ] ) { FastReader in = new FastReader ( ) ; PrintWriter so = new PrintWriter ( new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ) ; int t = in . nextInt ( ) ; while ( t -- > 0 ) { int n = in . nextInt ( ) ; long a [ ] = new long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = in . nextLong ( ) ; if ( a [ 0 ] + a [ 1 ] > a [ n - 1 ] ) so . println ( " - 1" ) ; else so . println ( "1 ▁ 2 ▁ " + ( n ) ) ; } so . flush ( ) ; } 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 ( ) ) ; } int [ ] readIntArray ( int n ) { int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextInt ( ) ; return a ; } long [ ] readLongArray ( int n ) { long a [ ] = new long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextLong ( ) ; return a ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } }


import java . util . Scanner ; public class BadTriangle { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int test_case = scan . nextInt ( ) ; while ( test_case -- > 0 ) { int n = scan . nextInt ( ) ; int arr [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = scan . nextInt ( ) ; } if ( arr [ n - 1 ] >= ( arr [ 0 ] + arr [ 1 ] ) ) { System . out . println ( 1 + " ▁ " + 2 + " ▁ " + n ) ; } else { System . out . println ( " - 1" ) ; } } scan . close ( ) ; } }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . ArrayDeque ; import java . util . ArrayList ; import java . util . StringTokenizer ;   public class B {   public static void main ( String [ ] args ) { FastScanner fs = new FastScanner ( ) ; int n = fs . nextInt ( ) , m = fs . nextInt ( ) ; Node [ ] nodes = new Node [ n ] ; for ( int i = 0 ; i < n ; i ++ ) nodes [ i ] = new Node ( i ) ; for ( int i = 0 ; i < n ; i ++ ) { nodes [ i ] . outDegree = fs . nextInt ( ) ; for ( int j = 0 ; j < nodes [ i ] . outDegree ; j ++ ) { int next = fs . nextInt ( ) - 1 ; nodes [ i ] . canReach . add ( nodes [ next ] ) ; nodes [ next ] . canReachMe . add ( nodes [ i ] ) ; } }

n , m = list ( map ( int , input ( ) . split ( ) ) )   from collections import defaultdict   graph = defaultdict ( list )   for i in range ( 1 , n + 1 ) : neighbours = list ( map ( int , input ( ) . split ( ) ) ) [ 1 : ] graph [ ( i , 0 ) ] = [ ( x , 1 ) for x in neighbours ] graph [ ( i , 1 ) ] = [ ( x , 0 ) for x in neighbours ]   start = int ( input ( ) )   NEW_LINE


n , m = [ int ( x ) for x in input ( ) . split ( ) ]   edges = [ set ( ) ]   drain = set ( )   for i in range ( n ) :   nums = [ int ( x ) for x in input ( ) . split ( ) ]   if nums [ 0 ] == 0 :   drain . add ( i + 1 )   edges . append ( set ( nums [ 1 : ] ) )   start = int ( input ( ) )       nodes = { start }   visited = { }   while len ( nodes ) > 0 :   curr = nodes . pop ( )   for v in edges [ abs ( curr ) ] :   if curr > 0 :   v = - v   if visited . get ( v ) is None :   nodes . add ( v )   visited [ v ] = curr       ok = False   for d in drain :   if - d in visited :   print ( ' Win ' )   v = - d   l = [ ]   while v != start :   l . append ( abs ( v ) )   v = visited [ v ]   l . append ( start )   print ( ' ▁ ' . join ( str ( x ) for x in l [ : : - 1 ] ) )   ok = True   break       if not ok :   stack = [ start ]   in_stack = { start }   visited = { start }   while len ( stack ) > 0 :   curr = stack [ - 1 ]   if len ( edges [ curr ] ) == 0 :   stack . pop ( )   in_stack . remove ( curr )   continue   v = edges [ curr ] . pop ( )   if v not in visited :   visited . add ( v )   stack . append ( v )   in_stack . add ( v )   elif v in in_stack :   print ( ' Draw ' )   ok = True   break   if not ok :   print ( ' Lose ' )                         NEW_LINE


import java . util . * ; import java . io . * ; public class EdA { static long [ ] mods = { 1000000007 , 998244353 , 1000000009 } ; static long mod = mods [ 0 ] ; public static MyScanner sc ; public static PrintWriter out ; static Map < State , ArrayList < State > > graph ; static Map < Integer , ArrayList < Integer > > outgraph ; static int [ ] [ ] dp ; static Set < Integer > currDFS ; public static void main ( String [ ] omkar ) throws Exception {


import java . util . * ; import java . io . * ; import java . math . BigInteger ;   public class b { public static void main ( String [ ] args ) throws IOException { FastScanner sc = new FastScanner ( ) ; int n = sc . nextInt ( ) ; long l = sc . nextLong ( ) ; long r = sc . nextLong ( ) ; long ql = sc . nextLong ( ) ; long qr = sc . nextLong ( ) ; long [ ] w = sc . nextLongArray ( n ) ;   long [ ] lsum = new long [ n + 1 ] ; long [ ] rsum = new long [ n + 1 ] ; lsum [ 1 ] = w [ 0 ] ; for ( int i = 2 ; i <= n ; i ++ ) lsum [ i ] = lsum [ i - 1 ] + w [ i - 1 ] ; rsum [ n - 1 ] = w [ n - 1 ] ; for ( int i = n - 2 ; i >= 0 ; i -- ) rsum [ i ] = rsum [ i + 1 ] + w [ i ] ;   long min = Integer . MAX_VALUE ;   for ( int i = 0 ; i <= n ; i ++ ) { int lop = i ; int rop = n - i ; long cost = lsum [ lop ] * l + rsum [ n - rop ] * r ;   if ( lop > rop ) { cost += ( lop - rop - 1 ) * ql ; } else if ( rop > lop ) { cost += ( rop - lop - 1 ) * qr ; } min = Math . min ( min , cost ) ; } System . out . println ( min ) ;   } }

import sysfrom os import pathif ( path . exists ( ' input . txt ' ) ) : sys . stdin = open ( " input . txt " , " r " ) sys . stdout = open ( " output . txt " , " w " ) N = 10 ** 5 + 5 n , l , r , q1 , q2 = map ( int , input ( ) . split ( ) ) w = [ int ( x ) for x in input ( ) . split ( ) ] pre = [ 0 ] * Nfor i in range ( n ) : pre [ i + 1 ] = pre [ i ] + w [ i ]   ans = 10 ** 18   for i in range ( n + 1 ) : curr = pre [ i ] * l + ( pre [ n ] - pre [ i ] ) * r x , y = i , n - i if ( x < y ) : curr += q2 * ( y - x - 1 ) elif ( x > y ) : curr += q1 * ( x - y - 1 ) ans = min ( ans , curr ) print ( ans ) NEW_LINE


import time , math as mt , bisect as bs , sysfrom sys import stdin , stdoutfrom collections import dequefrom fractions import Fractionfrom collections import Counterfrom collections import OrderedDictpi = 3.14159265358979323846264338327950 def II ( ) : NEW_LINE


if __name__ == ' _ _ main _ _ ' : n , l , r , ql , qr = map ( int , input ( ) . split ( ) ) weights = [ int ( x ) for x in input ( ) . split ( ) ]   curr_sum = 0 cum_sum = list ( )   for i in weights : curr_sum += i cum_sum . append ( curr_sum ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class Main { static class InputReader { protected BufferedReader br = null ; StringTokenizer tokenizer = null ;   public InputReader ( InputStream is ) { super ( ) ; br = new BufferedReader ( new InputStreamReader ( is ) ) ; }   public String next ( ) { for ( ; tokenizer == null || ! tokenizer . hasMoreTokens ( ) ; ) { try { tokenizer = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) {


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


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

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


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


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


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


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


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


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

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


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


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


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

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


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


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


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


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

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


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


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


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


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


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


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


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


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

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


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


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


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


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


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


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


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


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

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


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


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


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


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


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


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

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


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


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


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


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


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


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


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


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

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


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

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


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


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


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


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


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


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


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


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


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


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


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

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