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

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 . IOException ; import java . io . InputStream ; import java . io . OutputStream ; import java . io . PrintWriter ; import java . math . BigInteger ; import java . util . * ;     public class Ecr44A {   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 ( ) ;

n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) n = len ( a ) a . sort ( ) ans1 = ans2 = 0 for i in range ( n ) : ans1 += abs ( a [ i ] - ( i + 1 ) * 2 ) ans2 += abs ( a [ i ] - ( 1 + i * 2 ) ) print ( min ( ans1 , ans2 ) ) NEW_LINE

n = int ( input ( ) ) * p , = map ( int , input ( ) . split ( ) ) p . sort ( ) black = sum ( abs ( i * 2 + 1 - x ) for i , x in enumerate ( p ) ) white = sum ( abs ( i * 2 + 2 - x ) for i , x in enumerate ( p ) ) print ( min ( black , white ) ) NEW_LINE

n = int ( input ( ) ) chess = list ( map ( int , input ( ) . split ( ) ) )   move1 = 0 move2 = 0   chess . sort ( )   for i in range ( len ( chess ) ) : move1 += abs ( chess [ i ] - ( i * 2 + 1 ) ) move2 += abs ( chess [ i ] - ( i * 2 + 2 ) )   print ( min ( move1 , move2 ) ) 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 = inp ( ) p = inpl ( ) ; p . sort ( ) res = 0 for i in range ( n // 2 ) : res += abs ( p [ i ] - ( i * 2 + 2 ) ) res2 = 0 for i in range ( n // 2 ) : res2 += abs ( p [ i ] - ( i * 2 + 1 ) ) print ( min ( res , res2 ) ) NEW_LINE

n = int ( input ( ) ) p = list ( map ( int , input ( ) . split ( ) ) ) ans = 0 k = 0 p . sort ( ) for i in range ( 1 , n , 2 ) : ans += abs ( p [ i // 2 ] - i ) for i in range ( 2 , n + 1 , 2 ) : k += abs ( p [ i // 2 - 1 ] - i ) print ( min ( ans , k ) ) NEW_LINE


import java . io . * ; import java . math . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws IOException { FastReader scan = new FastReader ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; Task solver = new Task ( ) ; ans = new StringBuilder ( ) ; int T = scan . nextInt ( ) ; for ( int tt = 0 ; tt < T ; tt ++ ) solver . solve ( tt , scan , out ) ; out . close ( ) ; } static StringBuilder ans ; static class Task { public void solve ( int testNumber , FastReader scan , PrintWriter out ) { int n = scan . nextInt ( ) ; if ( n <= 30 ) out . println ( " NO " ) ; else { out . println ( " YES " ) ; int x = n - 30 ; if ( x != 10 && x != 6 && x != 14 ) { out . println ( 6 + " ▁ " + 10 + " ▁ " + 14 + " ▁ " + x ) ; } else { out . println ( 6 + " ▁ " + 10 + " ▁ " + 15 + " ▁ " + ( x - 1 ) ) ; } } } } static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } public FastReader ( String s ) throws FileNotFoundException { br = new BufferedReader ( new FileReader ( new File ( s ) ) ) ; } 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 . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int t = s . nextInt ( ) ; int n ; for ( int i = 0 ; i < t ; i ++ ) { n = s . nextInt ( ) ; if ( n <= 30 ) { System . out . println ( " NO " ) ; } else { System . out . println ( " YES " ) ; if ( n == 36 || n == 40 || n == 44 ) { System . out . println ( "6 ▁ " + "10 ▁ " + "15 ▁ " + Integer . toString ( n - 31 ) ) ; } else { System . out . println ( "6 ▁ " + "10 ▁ " + "14 ▁ " + Integer . toString ( n - 30 ) ) ; } } } } }

t = int ( input ( ) ) NEW_LINE for i in range ( t ) : NEW_LINE INDENT n = int ( input ( ) ) NEW_LINE if n < 31 : NEW_LINE INDENT print ( ' NO ' ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( ' YES ' ) NEW_LINE a = n - 30 NEW_LINE if a != 6 and a != 10 and a != 14 : NEW_LINE INDENT print ( 6 , 10 , 14 , a ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( 6 , 10 , 15 , n - 31 ) NEW_LINE DEDENT DEDENT DEDENT

import math NEW_LINE for _ in range ( int ( input ( ) ) ) : NEW_LINE INDENT x = int ( input ( ) ) NEW_LINE if x <= 30 : NEW_LINE INDENT print ( " NO " ) NEW_LINE DEDENT elif x == 36 or x == 44 or x == 40 : NEW_LINE INDENT print ( " YES " ) NEW_LINE print ( 6 , 10 , 15 , x - 31 ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( ' YES ' ) NEW_LINE print ( 6 , 10 , 14 , x - 30 ) NEW_LINE DEDENT DEDENT

for i in range ( int ( input ( ) ) ) : NEW_LINE INDENT n = int ( input ( ) ) NEW_LINE if n <= 30 : NEW_LINE INDENT print ( ' NO ' ) NEW_LINE DEDENT else : NEW_LINE INDENT if n == 36 or n == 40 or n == 44 : NEW_LINE INDENT print ( ' YES ' ) NEW_LINE print ( 6 , 10 , 15 , n - 31 ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( ' YES ' ) NEW_LINE print ( 6 , 10 , 14 , n - 30 ) NEW_LINE DEDENT DEDENT DEDENT

t = int ( input ( ) ) NEW_LINE for _ in range ( t ) : NEW_LINE INDENT n = int ( input ( ) ) NEW_LINE if ( n <= 30 ) : NEW_LINE INDENT print ( " NO " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " YES " ) NEW_LINE q = n - 30 NEW_LINE if ( q == 6 or q == 10 or q == 14 ) : NEW_LINE INDENT print ( 6 , 10 , 15 , q - 1 ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( 6 , 10 , 14 , q ) NEW_LINE DEDENT DEDENT DEDENT

n = int ( input ( ) ) NEW_LINE for _ in range ( n ) : NEW_LINE INDENT a = int ( input ( ) ) NEW_LINE if ( a < 31 ) : NEW_LINE INDENT print ( " NO " ) NEW_LINE DEDENT else : NEW_LINE INDENT k = a - 30 NEW_LINE if k != 6 and k != 14 and k != 10 : NEW_LINE INDENT print ( " YES " ) NEW_LINE print ( "6 ▁ 10 ▁ 14" , a - 30 ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " YES " ) NEW_LINE print ( "6 ▁ 10 ▁ 15" , a - 31 ) NEW_LINE DEDENT DEDENT DEDENT


import java . io . * ; import java . math . BigInteger ; import java . util . * ; import java . util . StringTokenizer ;   public class Main {   static int MOD = ( int ) Math . pow ( 10 , 9 ) + 7 ;   public static void main ( String [ ] args ) throws IOException { FastReader fr = new FastReader ( ) ; PrintWriter pw = new PrintWriter ( System . out ) ;   double X = fr . nextDouble ( ) / fr . nextDouble ( ) ; double Y = fr . nextDouble ( ) / fr . nextDouble ( ) ;   double multiplier = ( 1 - X ) * ( 1 - Y ) ;   double sum = X * ( 1 ) / ( 1 - multiplier ) ;   pw . println ( sum ) ;   pw . close ( ) ; }   static class FastReader { BufferedReader br ; StringTokenizer st ;   public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; }   String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   long nextLong ( ) { return Long . parseLong ( next ( ) ) ; }   double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; }   String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } st = null ; return str ; } }   }

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

import java . util . Scanner ;   public class Archer { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ;   double a = sc . nextInt ( ) ; double b = sc . nextInt ( ) ; double c = sc . nextInt ( ) ; double d = sc . nextInt ( ) ; double r = ( 1 - c / d ) * ( 1 - a / b ) ; System . out . println ( ( a / b ) / ( 1 - r ) ) ; } }

import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . Scanner ; import java . lang . Math ; public class Account { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ;

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

def common_common ( arr ) : commonstring = ' ' if len ( arr ) > 1 and len ( arr [ 0 ] ) > 0 : for i in range ( len ( arr [ 0 ] ) ) : for j in range ( len ( arr [ 0 ] ) - i + 1 ) : if j > len ( commonstring ) and is_commonstring ( arr [ 0 ] [ i : i + j ] , arr ) : commonstring = arr [ 0 ] [ i : i + j ] return commonstring   def is_commonstring ( stringg , arr ) : if len ( arr ) < 1 and len ( stringg ) < 1 : return False for i in range ( len ( arr ) ) : if stringg not in arr [ i ] : return False return Truedef common_common ( arr ) : commonstring = ' ' if len ( arr ) > 1 and len ( arr [ 0 ] ) > 0 : for i in range ( len ( arr [ 0 ] ) ) : for j in range ( len ( arr [ 0 ] ) - i + 1 ) : if j > len ( commonstring ) and is_commonstring ( arr [ 0 ] [ i : i + j ] , arr ) : commonstring = arr [ 0 ] [ i : i + j ] return commonstring   def is_commonstring ( stringg , arr ) : if len ( arr ) < 1 and len ( stringg ) < 1 : return False for i in range ( len ( arr ) ) : if stringg not in arr [ i ] : return False return Truet = ( input ( ) . split ( maxsplit = 4 ) ) ar = [ ] for i in t : i = float ( i ) ar . append ( i ) a = ar [ 0 ] b = ar [ 1 ] c = ar [ 2 ] d = ar [ 3 ] aa = c / daaa = ( a * c ) / ( b * d ) a1 = a / ba2 = 1 - aa - a1 + aaares = 0 ret = 0 for i in range ( 10000 ) : ret = ( a2 ** i ) res = res + ret * a1 NEW_LINE

a , b , c , d = map ( int , input ( ) . split ( ) ) result = ( a * d ) / ( b * c + a * d - a * c ) print ( result ) NEW_LINE

a , b , c , d = map ( int , input ( ) . split ( ) ) print ( ( a * d ) / ( b * c + a * d - a * c ) ) NEW_LINE

a , b , c , d = map ( int , input ( ) . split ( ) ) x = a / by = c / dxx = 1 - xyy = 1 - yf = x / ( 1 - ( xx * yy ) ) print ( f ) NEW_LINE


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

import java . io . * ; import java . util . * ; import java . lang . * ;   public class Main {   public static void main ( String [ ] args ) { FastReader in = new FastReader ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; int n = in . nextInt ( ) ; HashSet < Integer > set = new HashSet < Integer > ( ) ; HashMap < Integer , Integer > fTotal = new HashMap < > ( ) ; HashMap < Integer , Integer > fUp = new HashMap < > ( ) ; HashMap < Integer , Integer > same = new HashMap < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { int up = in . nextInt ( ) , down = in . nextInt ( ) ; set . add ( up ) ; set . add ( down ) ; add ( fUp , up ) ; add ( fTotal , up ) ; add ( fTotal , down ) ; if ( up == down ) add ( same , up ) ; } int ans = n ; for ( int ele : set ) { int cnt = fUp . getOrDefault ( ele , 0 ) ; if ( cnt >= ( n + 1 ) / 2 ) { ans = 0 ; break ; } int cntTot = fTotal . get ( ele ) ; int cntSame = same . getOrDefault ( ele , 0 ) ; if ( cntTot - cntSame >= ( n + 1 ) / 2 ) ans = Math . min ( ( ( n + 1 ) / 2 ) - cnt , ans ) ; } out . println ( ans == n ? - 1 : ans ) ; out . close ( ) ; } public static void add ( HashMap < Integer , Integer > map , int ele ) { int cnt = map . getOrDefault ( ele , 0 ) ; cnt ++ ; map . put ( ele , cnt ) ; return ; } static final Random random = new Random ( ) ;

from collections import defaultdictn = int ( input ( ) ) u , v = defaultdict ( int ) , defaultdict ( int ) for k in range ( n ) : a , b = map ( int , input ( ) . split ( ) ) u [ a ] += 1 if b != a : v [ b ] += 1 k = ( n - 1 ) // 2 s = any ( v [ b ] > k for b in v ) t = [ u [ a ] for a in u if u [ a ] + v [ a ] > k ] if t : print ( max ( 0 , k + 1 - max ( t ) ) ) else : print ( k + 1 if s else - 1 ) NEW_LINE

from collections import defaultdictimport mathn = int ( input ( ) ) d = defaultdict ( int ) o = defaultdict ( int ) for i in range ( n ) : x , y = map ( int , input ( ) . split ( ) ) o [ x ] += 1 d [ x ] += 1 if y != x : d [ y ] += 1 mi = 10 ** 5 + 1 for i in d : NEW_LINE


import java . io . * ; import java . util . * ;   public class Main {   static long len [ ] = new long [ ( int ) ( 1e5 + 1 ) ] ; static String stem = " What ▁ are ▁ you ▁ doing ▁ at ▁ the ▁ end ▁ of ▁ the ▁ world ? ▁ Are ▁ you ▁ busy ? ▁ Will ▁ you ▁ save ▁ us ? " ; static String string = " What ▁ are ▁ you ▁ doing ▁ while ▁ sending ▁ \" \" ? ▁ Are ▁ you ▁ busy ? ▁ Will ▁ you ▁ send ▁ \" \" ? " ; static String p1 = " What ▁ are ▁ you ▁ doing ▁ while ▁ sending ▁ \" " ; static String p2 = " \" ? ▁ Are ▁ you ▁ busy ? ▁ Will ▁ you ▁ send ▁ \" " ; static String p3 = " \" ? " ;   public static void main ( String [ ] args ) throws Exception { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter out = new PrintWriter ( System . out ) ; len [ 0 ] = stem . length ( ) ; for ( int i = 1 ; i < 55 ; i ++ ) { len [ i ] = len [ i - 1 ] * 2 + string . length ( ) ;

import java . util . * ;   public class CF597D { static String s1 = " ▁ What ▁ are ▁ you ▁ doing ▁ at ▁ the ▁ end ▁ of ▁ the ▁ world ? ▁ Are ▁ you ▁ busy ? ▁ Will ▁ you ▁ save ▁ us ? " ; static String s2 = " ▁ What ▁ are ▁ you ▁ doing ▁ while ▁ sending ▁ \" \" ? ▁ Are ▁ you ▁ busy ? ▁ Will ▁ you ▁ send ▁ \" \" ? " ; static long lmit = ( long ) 1e18 ; static long [ ] f = new long [ 100005 ] ; public static void main ( String [ ] args ) { Scanner cin = new Scanner ( System . in ) ; int T = cin . nextInt ( ) ; long x , y ; f [ 0 ] = 75 ; for ( int i = 1 ; i <= 100000 ; i ++ ) f [ i ] = min ( 68 + f [ i - 1 ] * 2 , lmit ) ; while ( T -- > 0 ) { x = cin . nextLong ( ) ; y = cin . nextLong ( ) ; if ( y > f [ ( int ) x ] ) { System . out . print ( ' . ' ) ; } else { System . out . print ( get ( x , y ) ) ; } } } private static char get ( long x , long y ) { if ( x == 0 ) return s1 . charAt ( ( int ) y ) ; if ( y <= 34 ) return s2 . charAt ( ( int ) y ) ; if ( y <= 34 + f [ ( int ) ( x - 1 ) ] || ( f [ ( int ) x ] >= lmit && f [ ( int ) ( x - 1 ) ] >= lmit ) ) return get ( x - 1 , y - 34 ) ; if ( y <= 34 + f [ ( int ) ( x - 1 ) ] + 32 ) return s2 . charAt ( ( int ) ( y - f [ ( int ) ( x - 1 ) ] ) ) ; if ( y <= 34 + 2 * f [ ( int ) ( x - 1 ) ] + 32 ) return get ( x - 1 , y - 34 - f [ ( int ) ( x - 1 ) ] - 32 ) ; return s2 . charAt ( ( int ) ( y - f [ ( int ) ( x - 1 ) ] - f [ ( int ) ( x - 1 ) ] ) ) ; } private static long min ( long a , long b ) { if ( a < b ) return a ; return b ; } }

from functools import lru_cacheimport sys   f0 = " What ▁ are ▁ you ▁ doing ▁ at ▁ the ▁ end ▁ of ▁ the ▁ world ? ▁ Are ▁ you ▁ busy ? ▁ Will ▁ you ▁ save ▁ us ? " fnext = [ ' What ▁ are ▁ you ▁ doing ▁ while ▁ sending ▁ " ' , ' " ? ▁ Are ▁ you ▁ busy ? ▁ Will ▁ you ▁ send ▁ " ' , ' " ? ' ] BIG = 10 ** 20   @ lru_cache ( maxsize = None ) def flength ( n ) : if n == 0 : return len ( f0 ) else : sublen = flength ( n - 1 ) return min ( BIG , sum ( [ len ( part ) for part in fnext ] ) + 2 * sublen )   def get_char ( n , k ) : while True : if k >= flength ( n ) : return ' . ' if n == 0 : return f0 [ k ]   for part in fnext : if k < len ( part ) : return part [ k ] else : k -= len ( part )   if k < flength ( n - 1 ) : n -= 1 break else : k -= flength ( n - 1 ) q = int ( input ( ) )   for i in range ( 2 * 10 ** 5 ) : flength ( i )   for _ in range ( q ) : n , k = map ( int , input ( ) . split ( ) ) print ( get_char ( n , k - 1 ) , end = " " ) print ( " " )   NEW_LINE

s0 = ' What ▁ are ▁ you ▁ doing ▁ at ▁ the ▁ end ▁ of ▁ the ▁ world ? ▁ Are ▁ you ▁ busy ? ▁ Will ▁ you ▁ save ▁ us ? ' s1 = ' What ▁ are ▁ you ▁ doing ▁ while ▁ sending ▁ " ' s2 = ' " ? ▁ Are ▁ you ▁ busy ? ▁ Will ▁ you ▁ send ▁ " ' def get ( h ) : if h > 55 : return 1 << 99 return ( 143 << h ) - 68 def solve ( n , k ) : if get ( n ) <= k : return ' . ' while True : if n == 0 : return s0 [ k ] if k < 34 : return s1 [ k ] k -= 34 if k < get ( n - 1 ) : n -= 1 continue k -= get ( n - 1 ) if k < 32 : return s2 [ k ] k -= 32 if k < get ( n - 1 ) : n -= 1 else : return ' " ? ' [ k - get ( n - 1 ) ] for i in range ( int ( input ( ) ) ) : n , k = list ( map ( int , input ( ) . split ( ) ) ) print ( solve ( n , k - 1 ) , end = ' ' ) NEW_LINE

q = int ( input ( ) ) q1 = ' What ▁ are ▁ you ▁ doing ▁ at ▁ the ▁ end ▁ of ▁ the ▁ world ? ▁ Are ▁ you ▁ busy ? ▁ Will ▁ you ▁ save ▁ us ? ' q2 = ' What ▁ are ▁ you ▁ doing ▁ while ▁ sending ▁ " " ? ▁ Are ▁ you ▁ busy ? ▁ Will ▁ you ▁ send ▁ " " ? ' q3 = ' What ▁ are ▁ you ▁ doing ▁ while ▁ sending ▁ " ' q4 = ' " ? ▁ Are ▁ you ▁ busy ? ▁ Will ▁ you ▁ send ▁ " ' q5 = ' " ? ' lq1 = len ( q1 ) lq2 = len ( q2 ) lq3 = len ( q3 ) lq4 = len ( q4 ) lq5 = len ( q5 ) lengths = [ 75 ] for i in range ( 100 ) : lengths . append ( lengths [ - 1 ] * 2 + 68 ) NEW_LINE

import syssys . setrecursionlimit ( 1500 )   s1 = " What ▁ are ▁ you ▁ doing ▁ at ▁ the ▁ end ▁ of ▁ the ▁ world ? ▁ Are ▁ you ▁ busy ? ▁ Will ▁ you ▁ save ▁ us ? " a = " What ▁ are ▁ you ▁ doing ▁ while ▁ sending ▁ \ " " b = " \ " ? ▁ Are ▁ you ▁ busy ? ▁ Will ▁ you ▁ send ▁ \ " " c = " \ " ? " ans = " "     def solve ( n , k ) : if n == 0 : if k >= len ( s1 ) : return " . " else : return s1 [ k ] if k < len ( a ) : return a [ k ] k -= len ( a ) prev_len = ( 2 ** ( n - 1 ) - 1 ) * ( len ( a ) + len ( b ) + len ( c ) ) + ( 2 ** ( n - 1 ) ) * len ( s1 ) if k < prev_len : return solve ( n - 1 , k ) k -= prev_len if k < len ( b ) : return b [ k ] k -= len ( b ) if k < prev_len : return solve ( n - 1 , k ) k -= prev_len if k < len ( c ) : return c [ k ] else : return " . "     for _ in range ( int ( input ( ) ) ) : n , k = list ( map ( int , input ( ) . split ( ) ) ) k -= 1 if n > 65 : m = n - 65 if k < len ( a ) * m : ans += a [ k % len ( a ) ] continue k -= len ( a ) * m n = n - m ans += solve ( n , k )   print ( ans ) NEW_LINE

s0 = ' What ▁ are ▁ you ▁ doing ▁ at ▁ the ▁ end ▁ of ▁ the ▁ world ? ▁ Are ▁ you ▁ busy ? ▁ Will ▁ you ▁ save ▁ us ? ' s1 = ' What ▁ are ▁ you ▁ doing ▁ while ▁ sending ▁ " ' s2 = ' " ? ▁ Are ▁ you ▁ busy ? ▁ Will ▁ you ▁ send ▁ " ' l0 = len ( s0 ) l1 = len ( s1 ) l2 = len ( s2 )   def get ( h ) : if h > 55 : return int ( 1e20 ) return ( l0 + l1 + l2 + 2 << h ) - l1 - l2 - 2 def solve ( n , k ) : if get ( n ) <= k : return ' . ' while True : if n == 0 : return s0 [ k ] if k < l1 : return s1 [ k ] k -= l1 if k < get ( n - 1 ) : n -= 1 continue k -= get ( n - 1 ) if k < l2 : return s2 [ k ] k -= l2 if k < get ( n - 1 ) : n -= 1 else : return ' " ? ' [ k - get ( n - 1 ) ]   q = int ( input ( ) ) for i in range ( q ) : n , k = list ( map ( int , input ( ) . split ( ) ) ) print ( solve ( n , k - 1 ) , end = ' ' ) NEW_LINE


import java . io . * ; import java . util . * ;   public class Main2 { static void main ( ) throws Exception { int n = sc . nextInt ( ) , k = sc . nextInt ( ) ; HashSet < Integer > all = new HashSet < Integer > ( ) ; while ( n -- > 0 ) { all . add ( sc . nextInt ( ) ) ; } for ( int i = k ; i <= 1000000 ; i += k ) { if ( all . contains ( i ) ) { pw . println ( " Yes " ) ; return ; } } for ( int i = 2 ; i <= k ; i ++ ) { if ( k % i == 0 ) { int cur = 1 ; while ( k % i == 0 ) { k /= i ; cur *= i ; } boolean f = false ; for ( int j = cur ; j <= 1000000 ; j += cur ) { if ( all . contains ( j ) ) { f = true ; break ; } } if ( ! f ) { pw . println ( " No " ) ; return ; } } } pw . println ( " Yes " ) ; } public static void main ( String [ ] args ) throws Exception { sc = new MScanner ( System . in ) ; pw = new PrintWriter ( System . out ) ; int tc = 1 ;

import sysfrom math import gcd , sqrt , ceil , log2from collections import defaultdict , Counter , dequefrom bisect import bisect_left , bisect_rightimport mathsys . setrecursionlimit ( 2 * 10 ** 5 + 10 ) import heapqfrom itertools import permutations   NEW_LINE

import math   def main ( ) : n , k = map ( int , input ( ) . split ( ) ) C = list ( map ( int , input ( ) . split ( ) ) ) l = C [ 0 ] for c in C : l = l * c // math . gcd ( l , c ) % k if ( l == 0 ) : print ( " Yes " ) return print ( " No " )   main ( ) NEW_LINE

import sys , mathinput = sys . stdin . readline   def getInts ( ) : return [ int ( s ) for s in input ( ) . split ( ) ]   def getInt ( ) : return int ( input ( ) )   def getStrs ( ) : return [ s for s in input ( ) . split ( ) ]   def getStr ( ) : return input ( ) . strip ( )   def listStr ( ) : return list ( input ( ) . strip ( ) )   import collections as colimport math   def solve ( ) : NEW_LINE

import sys , mathinput = sys . stdin . readline   def getInts ( ) : return [ int ( s ) for s in input ( ) . split ( ) ]   def getInt ( ) : return int ( input ( ) )   def getStrs ( ) : return [ s for s in input ( ) . split ( ) ]   def getStr ( ) : return input ( ) . strip ( )   def listStr ( ) : return list ( input ( ) . strip ( ) )   import collections as colimport math   def prime_factors ( n ) : factors = [ ] num = 0 while n % 2 == 0 : num += 1 n //= 2 if num : factors . append ( ( 2 , num ) ) i = 3 while n > 1 and i * i <= n : num = 0 while n % i == 0 : num += 1 n //= i if num : factors . append ( ( i , num ) ) i += 2 if n > 2 : factors . append ( ( n , 1 ) ) return factors   def fails ( num , C ) : for c in C : if c % num == 0 : return False return True   def solve ( ) : NEW_LINE


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

import java . io . * ; import java . util . * ;   public class ez { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; int size = Integer . parseInt ( st . nextToken ( ) ) ; st = new StringTokenizer ( br . readLine ( ) ) ; int max = 1000000 ; int [ ] a = new int [ max ] ; int [ ] star = new int [ max ] ; int [ ] end = new int [ max ] ; for ( int i = 0 ; i < size ; i ++ ) { int num = Integer . parseInt ( st . nextToken ( ) ) ; a [ num - 1 ] ++ ; if ( star [ num - 1 ] == 0 ) star [ num - 1 ] = i + 1 ; end [ num - 1 ] = i + 1 ; } int mod = 0 ; for ( int i = 0 ; i < max ; i ++ ) { if ( a [ i ] > mod ) mod = a [ i ] ; } int s = 1 ; int e = Integer . MAX_VALUE ; for ( int i = 0 ; i < max ; i ++ ) { if ( a [ i ] == mod && end [ i ] - star [ i ] < e - s ) { s = star [ i ] ; e = end [ i ] ; } } System . out . println ( s + " ▁ " + e ) ; } }

n = int ( input ( ) ) arr = tuple ( map ( int , input ( ) . split ( ) ) ) d = { } for i in arr : if i in d : d [ i ] += 1 else : d [ i ] = 1 big = 0 for i in d : if d [ i ] > big : big = d [ i ] s = { i } elif d [ i ] == big : s . add ( i ) small = { } large = { } for i in range ( n ) : if arr [ i ] not in small : small [ arr [ i ] ] = ifor i in range ( n - 1 , - 1 , - 1 ) : if arr [ i ] not in large : large [ arr [ i ] ] = ibest = n + 1 for i in s : j = small [ i ] k = large [ i ] if k - j + 1 < best : best = k - j + 1 ans = ( j + 1 , k + 1 ) print ( * ans ) NEW_LINE

n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) d = { }   for i in range ( n ) : if str ( a [ i ] ) not in d : d [ str ( a [ i ] ) ] = [ 1 , i , i ] else : d [ str ( a [ i ] ) ] [ 0 ] += 1 d [ str ( a [ i ] ) ] [ 2 ] = max ( d [ str ( a [ i ] ) ] [ 2 ] , i )   res = sorted ( d , key = lambda x : d [ x ] [ 0 ] , reverse = True ) maxx = d [ res [ 0 ] ] [ 0 ] ans = float ( ' inf ' ) for i in range ( len ( res ) ) : if d [ res [ i ] ] [ 0 ] < maxx : break if ans > d [ res [ i ] ] [ 2 ] - d [ res [ i ] ] [ 1 ] : ans = d [ res [ i ] ] [ 2 ] - d [ res [ i ] ] [ 1 ] ind = [ d [ res [ i ] ] [ 1 ] + 1 , d [ res [ i ] ] [ 2 ] + 1 ] print ( * ind ) NEW_LINE

from collections import Countern = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) start = dict ( [ ] ) end = dict ( [ ] ) all = [ ] count = Counter ( a ) maxx = max ( list ( count . values ( ) ) ) for j in count : if count [ j ] == maxx : all . append ( j ) for i in range ( n ) : if a [ i ] not in start : start [ a [ i ] ] = i + 1 end [ a [ i ] ] = i + 1 else : end [ a [ i ] ] = i + 1 minn = 100000000 ele = 0 for k in all : if ( end [ k ] - start [ k ] ) < minn : minn = end [ k ] - start [ k ] ele = kprint ( start [ ele ] , end [ ele ] )   NEW_LINE

n = int ( input ( ) ) arr = [ int ( x ) for x in input ( ) . split ( ) ] b = [ [ ] for x in range ( 1 , 10 ** 6 + 10 ) ] for i , j in enumerate ( arr ) : b [ j ] . append ( i ) maxi = 0 for i in b : maxi = max ( maxi , len ( i ) ) best = 10 ** 10 l , r = 1 , 1 for i in b : if len ( i ) == maxi : if i [ - 1 ] - i [ 0 ] < best : best = i [ - 1 ] - i [ 0 ] l , r = i [ 0 ] , i [ - 1 ] print ( l + 1 , r + 1 ) NEW_LINE


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int n = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; if ( ( a + b ) * n < c - d || ( a - b ) * n > c + d ) { System . out . println ( " NO " ) ; } else { System . out . println ( " YES " ) ; } } } }

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

import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner s = new Scanner ( System . in ) ; int T = s . nextInt ( ) ; for ( int t = 0 ; t < T ; t ++ ) { int n = s . nextInt ( ) ; int a = s . nextInt ( ) ; int b = s . nextInt ( ) ; int c = s . nextInt ( ) ; int d = s . nextInt ( ) ; if ( Math . abs ( a - b ) * n <= c + d && ( a + b ) * n >= Math . abs ( c - d ) ) { System . out . println ( " YES " ) ; } else System . out . println ( " NO " ) ; } } }

for t in range ( int ( input ( ) ) ) : n , a , b , c , d = map ( int , input ( ) . split ( ) ) if n * ( a - b ) > ( c + d ) or n * ( a + b ) < ( c - d ) : print ( ' No ' ) else : print ( ' Yes ' ) NEW_LINE

for i in range ( int ( input ( ) ) ) : n , a , b , c , d = map ( int , input ( ) . split ( ) ) if c - d <= n * ( a + b ) and c + d >= n * ( a - b ) : print ( " Yes " ) else : print ( " No " ) NEW_LINE

for _ in range ( int ( input ( ) ) ) : n , a , b , c , d = map ( int , input ( ) . split ( ) ) u1 = a + b d1 = abs ( a - b ) u2 = c + d d2 = abs ( c - d ) z = 0 if ( n * u1 < d2 ) : z = 1 elif ( n * d1 > u2 ) : z = 1 if ( z == 1 ) : print ( " NO " ) else : print ( " YES " ) NEW_LINE

from sys import stdin , stdout   def main ( ) : for _ in range ( int ( stdin . readline ( ) ) ) : n , a , b , c , d = map ( int , stdin . readline ( ) . split ( ' ▁ ' ) ) min_mass = ( a - b ) * n max_mass = ( a + b ) * n if min_mass > c + d or max_mass < c - d : stdout . write ( ' No \n ' ) else : stdout . write ( ' Yes \n ' )   if __name__ == " _ _ main _ _ " : main ( ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . math . BigInteger ; import java . util . * ;   import javafx . util . Pair ;   public class Main { public static void main ( String [ ] args ) { FastScanner input = new FastScanner ( ) ; int a [ ] [ ] = new int [ 3 ] [ 2 ] ; a [ 0 ] [ 0 ] = input . nextInt ( ) ; a [ 0 ] [ 1 ] = input . nextInt ( ) ; a [ 1 ] [ 0 ] = input . nextInt ( ) ; a [ 1 ] [ 1 ] = input . nextInt ( ) ; a [ 2 ] [ 0 ] = input . nextInt ( ) ; a [ 2 ] [ 1 ] = input . nextInt ( ) ; Arrays . sort ( a , new Comparator < int [ ] > ( ) { @ Override public int compare ( int [ ] t , int [ ] t1 ) { if ( t [ 0 ] - t1 [ 0 ] == 0 ) { return t1 [ 1 ] - t [ 1 ] ; } return t [ 0 ] - t1 [ 0 ] ; } } ) ;

import java . io . * ; import java . util . * ;   public class Solution { public static void main ( String [ ] args ) throws Exception { int [ ] a = in . readA ( ) ; int [ ] b = in . readA ( ) ; int [ ] c = in . readA ( ) ;   System . out . println ( 3 ) ; System . out . println ( getCoord ( a , b , c ) ) ; System . out . println ( getCoord ( c , a , b ) ) ; System . out . println ( getCoord ( b , c , a ) ) ; } public static String getCoord ( int [ ] a , int [ ] b , int [ ] c ) {

import java . util . * ; import java . io . * ; import java . io . * ; import java . util . * ; public class MainClass { public static void main ( String args [ ] ) throws IOException { Reader in = new Reader ( ) ; long [ ] X = new long [ 3 ] ; long [ ] Y = new long [ 3 ] ; for ( int i = 0 ; i < 3 ; i ++ ) { X [ i ] = in . nextLong ( ) ; Y [ i ] = in . nextLong ( ) ; } int ans = 0 ; StringBuilder stringBuilder = new StringBuilder ( ) ; for ( int i = 0 ; i < 3 ; i ++ ) { for ( int j = i + 1 ; j < 3 ; j ++ ) { long xx = X [ i ] + X [ j ] - X [ 3 - i - j ] ; long yy = Y [ i ] + Y [ j ] - Y [ 3 - i - j ] ; if ( ! ( ( xx == X [ i ] && yy == Y [ i ] ) || ( yy == Y [ j ] && xx == X [ j ] ) ) ) { ans ++ ; stringBuilder . append ( xx ) . append ( " ▁ " ) . append ( yy ) . append ( " \n " ) ; } } } System . out . println ( ans ) ; System . out . println ( stringBuilder ) ; } } 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 ] ;

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

x = [ ] y = [ ]   for i in range ( 3 ) : a , b = input ( ) . split ( ) x . append ( int ( a ) ) y . append ( int ( b ) ) print ( 3 ) for i in range ( 3 ) : print ( str ( sum ( x ) - 2 * x [ i ] ) + ' ▁ ' + str ( sum ( y ) - 2 * y [ i ] ) ) NEW_LINE

x1 , y1 = map ( int , input ( ) . split ( ) ) x2 , y2 = map ( int , input ( ) . split ( ) ) x3 , y3 = map ( int , input ( ) . split ( ) ) points = [ ] points . append ( [ x1 + x2 - x3 , y1 + y2 - y3 ] ) if [ x2 + x3 - x1 , y2 + y3 - y1 ] not in points : points . append ( [ x2 + x3 - x1 , y2 + y3 - y1 ] ) if [ x3 + x1 - x2 , y3 + y1 - y2 ] not in points : points . append ( [ x3 + x1 - x2 , y3 + y1 - y2 ] ) print ( len ( points ) ) for m in points : print ( m [ 0 ] , m [ 1 ] ) NEW_LINE


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

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

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

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

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

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

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


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

import java . util . * ;    public class Practise {

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

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

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

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

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


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

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

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

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

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

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

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

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


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

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

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

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

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

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

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

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


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

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

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

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

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

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


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

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

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

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

import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . io . IOException ; import java . util . Stack ; import java . io . InputStream ;   public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskB solver = new TaskB ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }   static class TaskB { public void solve ( int testNumber , InputReader in , PrintWriter out ) {

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

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

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

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


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

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

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

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

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

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

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

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

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


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

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

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

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

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

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

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

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


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

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

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

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


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

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

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

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

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

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

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

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


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

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

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

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

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

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

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


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

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

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

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

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

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

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

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


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

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

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

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

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

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


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

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

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

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

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

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

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


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

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

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

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

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

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


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

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

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

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

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

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

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


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

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

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

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


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

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

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


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

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

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

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

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

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

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

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

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