import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ;   public class B_745 {   public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ;   String [ ] nm = br . readLine ( ) . split ( " ▁ " ) ; int n = Integer . parseInt ( nm [ 0 ] ) ; int m = Integer . parseInt ( nm [ 1 ] ) ; int count = 0 , min_x = m + 1 , max_x = - 1 , min_y = n + 1 , max_y = - 1 ; for ( int i = 0 ; i < n ; i ++ ) { String [ ] row = br . readLine ( ) . split ( " " ) ; for ( int j = 0 ; j < m ; j ++ ) { if ( row [ j ] . contentEquals ( " X " ) ) { min_x = Math . min ( min_x , j ) ; max_x = Math . max ( max_x , j ) ; min_y = Math . min ( min_y , i ) ; max_y = Math . max ( max_y , i ) ; count ++ ; } } } System . out . println ( ( ( max_x - min_x + 1 ) * ( max_y - min_y + 1 ) == count ) ? " YES " : " NO " ) ; }   }

import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; int n = Integer . parseInt ( st . nextToken ( ) ) ; int m = Integer . parseInt ( st . nextToken ( ) ) ; String [ ] str = new String [ n ] ; int top , bot , l , r ; top = l = 1000 ; r = bot = 0 ; for ( int i = 0 ; i < n ; i ++ ) { str [ i ] = br . readLine ( ) ; if ( str [ i ] . contains ( " X " ) ) { top = Math . min ( top , i ) ; bot = Math . max ( bot , i ) ; } int x = str [ i ] . indexOf ( " X " ) ; if ( x != - 1 ) l = Math . min ( l , x ) ; int y = str [ i ] . lastIndexOf ( " X " ) ; if ( y != - 1 ) ; r = Math . max ( r , y ) ; } for ( int i = top ; i <= bot ; i ++ ) { if ( str [ i ] . substring ( l , r + 1 ) . contains ( " . " ) ) { System . out . println ( " NO " ) ; return ; } } System . out . println ( " YES " ) ; } }

import java . io . BufferedReader ; import java . io . File ; import java . io . FileWriter ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . math . BigInteger ; import java . util . * ;   public class Main {   public static void main ( String [ ] args ) throws IOException { FastScanner input = new FastScanner ( ) ; int n = input . nextInt ( ) ; int m = input . nextInt ( ) ; TreeSet < String > set = new TreeSet < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { String s = input . next ( ) ; if ( s . contains ( " X " ) ) set . add ( s ) ; } if ( set . size ( ) == 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; }   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 , m = map ( int , input ( ) . split ( ) ) puz = [ ] for x in range ( n ) : puz . append ( input ( ) ) mix = 502 miy = 502 mx = - 1 my = - 1 numx = 0 for i in range ( n ) : for j in range ( m ) : if ( puz [ i ] [ j ] == " X " ) : miy = min ( miy , i ) my = max ( my , i ) mix = min ( mix , j ) mx = max ( mx , j ) numx = numx + 1 if ( ( mx - mix + 1 ) * ( my - miy + 1 ) == numx ) : print ( " YES " ) else : print ( " NO " ) NEW_LINE

def read ( ) : return [ int ( v ) for v in input ( ) . split ( ) ]     def main ( ) : n , m = read ( )   s = [ ] for i in range ( n ) : s . append ( input ( ) )   up , left , down , right = n , m , - 1 , - 1 for i in range ( n ) : for j in range ( m ) : if s [ i ] [ j ] == ' X ' : if i < up : up = i if j < left : left = j if i > down : down = i if j > right : right = j   for i in range ( up , down + 1 ) : for j in range ( left , right + 1 ) : if s [ i ] [ j ] != ' X ' : print ( ' NO ' ) return print ( ' YES ' )     if __name__ == ' _ _ main _ _ ' : main ( ) NEW_LINE

n , m = map ( int , input ( ) . split ( ) ) cnt , l , r , u , d = 0 , n , 0 , m , 0 for i in range ( n ) : s = input ( ) for j in range ( m ) : if s [ j ] == ' X ' : cnt += 1 l = min ( l , i ) ; u = min ( u , j ) r = max ( r , i ) ; d = max ( d , j ) print ( ' YES ' if cnt == ( r - l + 1 ) * ( d - u + 1 ) else ' NO ' ) NEW_LINE

n , m = map ( int , input ( ) . split ( ) ) a = [ ] for i in range ( n ) : a . append ( list ( input ( ) ) ) k = 0 min_r = n - 1 max_r = 0 min_c = m - 1 max_c = 0 for i in range ( n ) : for j in range ( m ) : if a [ i ] [ j ] == ' X ' : k += 1 min_r = min ( min_r , i ) max_r = max ( max_r , i ) min_c = min ( min_c , j ) max_c = max ( max_c , j ) if ( max_r - min_r + 1 ) * ( max_c - min_c + 1 ) == k : print ( " YES " ) else : print ( " NO " ) NEW_LINE


import java . util . * ; import java . io . * ;   public class Main { static class FastReader { BufferedReader br ; StringTokenizer st ;   public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; }   String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   long nextLong ( ) { return Long . parseLong ( next ( ) ) ; }   double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; }   String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } }   public static void main ( String [ ] args ) { FastReader fr = new FastReader ( ) ; Scanner sc = new Scanner ( System . in ) ; int n = fr . nextInt ( ) ; int [ ] ar = new int [ n ] ; int total = 0 ; for ( int i = 0 ; i < n ; i ++ ) { ar [ i ] = fr . nextInt ( ) ; total += ar [ i ] ; } int alice = ar [ 0 ] ; ArrayList < Integer > ans = new ArrayList < > ( ) ; ans . add ( 1 ) ; for ( int i = 1 ; i < n ; i ++ ) { if ( alice > total / 2 ) break ; if ( 2 * ar [ i ] <= ar [ 0 ] ) { alice += ar [ i ] ; ans . add ( i + 1 ) ; } } if ( alice > total / 2 ) { System . out . println ( ans . size ( ) ) ; for ( Integer i : ans ) System . out . print ( i + " ▁ " ) ; } else System . out . println ( 0 ) ; } }

import java . util . * ; import java . io . * ; import java . math . * ;     public class A {   private static long INF = 2000000000L , M = 1000000007 , MM = 998244353 ; private static int N = 0 ;   public static void process ( ) throws IOException {   int n = sc . nextInt ( ) ; int my = sc . nextInt ( ) ; PriorityQueue < Pair > lis = new PriorityQueue < A . Pair > ( ) ; int sum = my ; for ( int i = 1 ; i < n ; i ++ ) { int a = sc . nextInt ( ) ; lis . add ( new Pair ( a , i + 1 ) ) ; sum += a ; } int extra = 0 ; ArrayList < Integer > ans = new ArrayList < Integer > ( ) ; ans . add ( 1 ) ; while ( lis . size ( ) > 1 && lis . peek ( ) . x * 2 <= my ) { Pair e = lis . poll ( ) ; ans . add ( e . y ) ; extra += e . x ; } my += extra ; if ( my * 2 <= sum ) { System . out . println ( 0 ) ; return ; } System . out . println ( ans . size ( ) ) ; for ( int e : ans ) System . out . print ( e + " ▁ " ) ;   }

import java . lang . * ; import java . util . * ; import java . io . * ; public class test {   Scanner sc = new Scanner ( System . in ) ; PrintWriter pr = new PrintWriter ( System . out , true ) ; public static void main ( String ... args ) { test c = new test ( ) ; c . prop ( ) ; } public void prop ( ) { int n , count = 0 , sumt = 0 , sumc = 0 , b ; ArrayList < Integer > al = new ArrayList < Integer > ( ) ; n = sc . nextInt ( ) ; b = sc . nextInt ( ) ; sumt += b ; for ( int i = 1 ; i < n ; ++ i ) { int a = sc . nextInt ( ) ; sumt += a ; if ( b >= 2 * a ) { ++ count ; sumc += a ; al . add ( i + 1 ) ; } } sumt = ( sumt / 2 ) + 1 ; if ( b >= sumt ) pr . println ( 1 + " ▁ " + 1 ) ; else if ( ( b + sumc ) >= sumt ) { pr . println ( count + 1 ) ; pr . println ( 1 ) ; for ( int i = 0 ; i < count ; ++ i ) { pr . println ( al . get ( i ) ) ; } } else pr . println ( 0 ) ; } }

import java . util . * ;   public class Main {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ;

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

n = int ( input ( ) ) lst = list ( map ( int , input ( ) . split ( ) ) ) ans = [ 1 ] summ2 = lst [ 0 ] for i in range ( 1 , n ) : if lst [ 0 ] >= ( 2 * lst [ i ] ) : ans . append ( i + 1 ) summ2 += lst [ i ] summ = sum ( lst ) NEW_LINE

for _ in range ( 1 ) : n = int ( input ( ) ) NEW_LINE

n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) count = 1 ref = a [ 0 ] arr = [ 0 ] s = reffor i in range ( n ) : if 2 * a [ i ] <= ref : arr . append ( i ) s += a [ i ] count += 1 if s <= sum ( a ) / 2 : print ( 0 ) else : print ( count ) for item in arr : print ( item + 1 , end = " ▁ " ) NEW_LINE

n , = map ( int , input ( ) . split ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) su = sum ( arr )   ans = [ 1 ] sa = arr [ 0 ] for i in range ( 1 , n ) : if arr [ i ] * 2 <= arr [ 0 ] : ans . append ( i + 1 ) sa += arr [ i ] if sa > su // 2 : print ( len ( ans ) ) print ( * ans ) else : print ( 0 ) NEW_LINE

n = int ( input ( ) ) s = [ int ( i ) for i in input ( ) . split ( ) ] a = s [ 0 ] s1 = [ ] s1 += ss1 . pop ( 0 ) s1 . sort ( ) s2 = sum ( s ) s3 = s2 // 2 s4 = as5 = a // 2 s6 = 1 for i in range ( n - 1 ) : if s1 [ i ] > s5 : break else : s4 += s1 [ i ] s6 += 1 if s4 > s3 : print ( s6 ) print ( 1 , end = ' ▁ ' ) s6 -= 1 for i in range ( 1 , n ) : if s6 == 0 : break elif s [ i ] <= s5 : s6 -= 1 print ( i + 1 , end = ' ▁ ' ) print ( ) else : print ( 0 ) NEW_LINE


import java . util . * ; import java . lang . String ; import java . lang . Math ; import java . util . Arrays ;   public class Capitalization2 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t ; t = sc . nextInt ( ) ; for ( int i = 0 ; i < t ; i ++ ) { int n , d ; n = sc . nextInt ( ) ; d = sc . nextInt ( ) ; int netres = 0 ; int [ ] a = new int [ n ] ; int [ ] res = new int [ n ] ; for ( int j = 0 ; j < n ; j ++ ) { a [ j ] = sc . nextInt ( ) ; if ( a [ j ] <= d ) { res [ netres ] = a [ j ] ; netres ++ ; } } if ( netres == 0 || netres == 1 ) System . out . println ( " NO " ) ; else if ( netres == n ) System . out . println ( " YES " ) ; else { Arrays . sort ( res , 0 , netres ) ; if ( ( res [ 0 ] + res [ 1 ] ) <= d ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } } }

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

tests = int ( input ( ) )   for test in range ( tests ) : n , d = map ( int , input ( ) . split ( ) ) NEW_LINE a = [ int ( x ) for x in input ( ) . split ( ) ] NEW_LINE a . sort ( )   if max ( a ) <= d : NEW_LINE INDENT print ( " YES " ) else : NEW_LINE b = [ a [ 0 ] + a [ 1 ] if x >= d else x for x in a ] NEW_LINE DEDENT if max ( b ) <= d : NEW_LINE INDENT print ( " YES " ) else : NEW_LINE print ( " NO " ) NEW_LINE DEDENT

for t in range ( int ( input ( ) ) ) : n , d = map ( int , input ( ) . split ( ) ) NEW_LINE a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE a . sort ( ) NEW_LINE if a [ 0 ] + a [ 1 ] <= d or max ( a ) <= d : NEW_LINE INDENT print ( ' YES ' ) else : NEW_LINE print ( ' NO ' ) NEW_LINE DEDENT

t = int ( input ( ) ) NEW_LINE res = [ ]   for i in range ( 0 , t ) : n , d = ( int ( x ) for x in input ( ) . strip ( ) . split ( ' ▁ ' ) ) NEW_LINE a1 = [ int ( x ) for x in input ( ) . strip ( ) . split ( ' ▁ ' ) ]   a = sorted ( a1 ) NEW_LINE if a [ n - 1 ] <= d : NEW_LINE INDENT res . append ( " YES " ) else : NEW_LINE if NEW_LINE DEDENT a [ 1 ] + a [ 0 ] <= d : res . append ( " YES " ) else : res . append ( " NO " ) NEW_LINE a . clear ( ) NEW_LINE for i in range ( 0 , t ) : print ( res [ i ] )   res . clear ( )   NEW_LINE

t = int ( input ( ) ) NEW_LINE res = [ ]   for i in range ( 0 , t ) : n , d = ( int ( x ) for x in input ( ) . strip ( ) . split ( ' ▁ ' ) ) NEW_LINE a1 = [ int ( x ) for x in input ( ) . strip ( ) . split ( ' ▁ ' ) ]   a = sorted ( a1 ) NEW_LINE if a [ n - 1 ] <= d : NEW_LINE INDENT res . append ( " YES " ) else : NEW_LINE if NEW_LINE DEDENT a [ 1 ] + a [ 0 ] <= d : res . append ( " YES " ) else : res . append ( " NO " ) NEW_LINE for i in range ( 0 , t ) : print ( res [ i ] ) NEW_LINE


import java . io . * ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . StringTokenizer ; import java . util . List ; import java . util . * ; public class realfast implements Runnable { private static final int INF = ( int ) 1e9 ; long in = 1000000007 ; long fac [ ] = new long [ 1000001 ] ; long inv [ ] = new long [ 1000001 ] ; public void solve ( ) throws IOException {

import java . util . * ; import java . io . * ;   public class Main { public static void main ( String args [ ] ) { new Main ( ) . run ( ) ; }   FastReader in = new FastReader ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; void run ( ) { for ( int q = ni ( ) ; q > 0 ; q -- ) { work ( ) ; } out . flush ( ) ; } long mod = 998244353 ; long gcd ( long a , long b ) { return a == 0 ? b : gcd ( b % a , a ) ; } int [ ] S1 ;

import bisect as bsfor NEW_LINE _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) NEW_LINE a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE if n <= 2 : print ( n ) NEW_LINE continue NEW_LINE stack , m , p = [ a [ 0 ] ] , [ ] , [ ( 1000000 , 0 ) ] NEW_LINE for v in a [ 1 : ] : k = bs . bisect_right ( m , v ) NEW_LINE if k == len ( m ) : stack . append ( v ) NEW_LINE m . append ( min ( stack [ - 1 ] , stack [ - 2 ] ) ) else : stack [ k + 1 ] = m [ k ] = v NEW_LINE while p [ - 1 ] [ 0 ] <= v : vv , kk = p . pop ( ) NEW_LINE m [ kk ] = min ( m [ kk ] , vv ) NEW_LINE if k + 1 < len ( m ) : p . append ( ( v , k + 1 ) ) NEW_LINE print ( len ( stack ) ) NEW_LINE

import bisect as bsfor NEW_LINE _ in range ( int ( input ( ) ) ) : n , a = int ( input ( ) ) , list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE stack , m , p = [ a [ 0 ] ] , [ ] , [ ( 1000000 , 0 ) ] NEW_LINE for v in a [ 1 : ] : k = bs . bisect_right ( m , v ) NEW_LINE if k == len ( m ) : stack . append ( v ) NEW_LINE m . append ( min ( stack [ - 1 ] , stack [ - 2 ] ) ) else : stack [ k + 1 ] = m [ k ] = v NEW_LINE while p [ - 1 ] [ 0 ] <= v : vv , kk = p . pop ( ) NEW_LINE m [ kk ] = min ( m [ kk ] , vv ) NEW_LINE if k + 1 < len ( m ) : p . append ( ( v , k + 1 ) ) NEW_LINE print ( len ( stack ) ) NEW_LINE

import osimport NEW_LINE sysfrom NEW_LINE io NEW_LINE import BytesIO , IOBase NEW_LINE


import java . util . * ; import java . io . * ;

import java . util . * ; import java . awt . List ; import java . io . * ; import java . lang . * ; import java . lang . reflect . Array ; public class c1 {   public static int mod = ( int ) Math . pow ( 10 , 9 ) + 7 ; public static void main ( String [ ] args ) { InputReader in = new InputReader ( System . in ) ; PrintWriter pw = new PrintWriter ( System . out ) ;

import java . util . Scanner ;   public class Hot_Bath { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; double t1 , t2 , y1 = 0 , y2 = 0 , x1 , x2 , t0 , div , sum ; boolean is , is1 ; while ( input . hasNext ( ) ) { div = 1000000000 ; t1 = input . nextDouble ( ) ; t2 = input . nextDouble ( ) ; x1 = input . nextDouble ( ) ; x2 = input . nextDouble ( ) ; t0 = input . nextDouble ( ) ; while ( x1 >= 0 && x2 >= 0 ) { if ( x1 + x2 == 0 ) break ; sum = ( ( t1 * x1 ) + ( t2 * x2 ) ) / ( x1 + x2 ) ; if ( sum < t0 ) { x1 -- ; continue ; } if ( sum < div ) { div = sum ; y1 = x1 ; y2 = x2 ; } x2 -- ; } System . out . println ( ( int ) y1 + " ▁ " + ( int ) y2 ) ; } } }

def gcd ( a , b ) : if ( a % b == 0 ) : return b else : return gcd ( b , a % b )   [ t1 , t2 , x1 , x2 , t0 ] = input ( ) . split ( ' ▁ ' ) NEW_LINE

import mathdef gcd ( a , b ) : if ( b == 0 ) : return a return gcd ( b , a % b ) l = input ( ) . split ( ) t1 = int ( l [ 0 ] ) t2 = int ( l [ 1 ] ) x1 = int ( l [ 2 ] ) x2 = int ( l [ 3 ] ) t0 = int ( l [ 4 ] ) num1 = t2 - t0num2 = t0 - t1if ( t1 == t2 ) : print ( x1 , x2 ) quit ( ) if ( num1 == 0 ) : print ( 0 , x2 ) quit ( ) if ( num2 == 0 ) : print ( x1 , 0 ) quit ( ) z = num2 / num1maxa = 10 ** 18 ans = ( 0 , 0 ) for i in range ( 1 , x1 + 1 ) : ok = z * i if ( ok > x2 ) : break num1 = i num2 = math . ceil ( ok ) if ( maxa == ( ( num2 / num1 ) - z ) and num2 + num1 > ans [ 0 ] + ans [ 1 ] ) : ans = ( num1 , num2 ) elif ( maxa > ( ( num2 / num1 ) - z ) ) : ans = ( num1 , num2 ) maxa = ( ( num2 / num1 - z ) ) if ( ans == ( 0 , 0 ) ) : ans = ( 0 , x2 ) print ( ans [ 0 ] , ans [ 1 ] ) NEW_LINE


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

import java . io . * ; import java . util . * ;   public class thirty_days_100 { public static void main ( String args [ ] ) { FScanner in = new FScanner ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; int t = in . nextInt ( ) ; while ( t -- > 0 ) { long n = in . nextLong ( ) ; int c = 0 ; while ( n % 5 == 0 ) { n = ( n / 5 ) * 4 ; c ++ ; } while ( n % 3 == 0 ) { n = ( n / 3 ) * 2 ; c ++ ; } while ( n % 2 == 0 ) { n = ( n / 2 ) ; c ++ ; } if ( n != 1 ) out . println ( " - 1" ) ; else out . println ( c ) ; } out . close ( ) ; }   static class FScanner { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer sb = new StringTokenizer ( " " ) ; String next ( ) { while ( ! sb . hasMoreTokens ( ) ) { try { sb = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { } } return sb . nextToken ( ) ; } String nextLine ( ) { try { return br . readLine ( ) ; } catch ( IOException e ) { } return " " ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } int [ ] readArray ( int n ) { int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextInt ( ) ; return a ; } float nextFloat ( ) { return Float . parseFloat ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } } }

task = int ( input ( ) ) while ( task > 0 ) : n = int ( input ( ) ) cnt , flag = 0 , 0 while ( n != 1 ) : if ( n % 2 == 0 ) : n = n // 2 cnt += 1 elif ( n % 3 == 0 ) : n = ( 2 * n ) // 3 cnt += 1 elif ( n % 5 == 0 ) : n = ( 4 * n ) // 5 cnt += 1 else : flag = 1 break if ( flag == 1 ) : print ( - 1 ) else : print ( cnt ) task -= 1 NEW_LINE

test = int ( input ( ) ) while test != 0 : num = int ( input ( ) ) cnt = 0 while num > 1 : if num % 2 == 0 : num //= 2 elif num % 3 == 0 : num = ( num * 2 ) // 3 elif num % 5 == 0 : num = ( num * 4 ) // 5 else : break cnt += 1 if num == 1 : print ( cnt ) else : print ( - 1 ) test -= 1 NEW_LINE

t = int ( input ( ) ) for _ in range ( t ) : n = int ( input ( ) ) f = 1 ans = 0 while n != 1 : if n % 5 == 0 : n = ( n * 4 ) // 5 ans += 1 elif n % 3 == 0 : n = ( n * 2 ) // 3 ans += 1 elif n % 2 == 0 : n = n // 2 ans += 1 else : f = 0 break if f : print ( ans ) else : print ( - 1 ) NEW_LINE


import java . util . Scanner ; import java . util . Arrays ; public class Codechef { public static void main ( String [ ] args ) throws java . lang . Exception { try { Scanner sc = new Scanner ( System . in ) ; int n , c , x , y , i ; String s ; n = sc . nextInt ( ) ; sc . nextLine ( ) ; s = sc . nextLine ( ) ; x = y = c = 0 ; for ( i = 0 ; i < n ; i ++ ) { if ( s . charAt ( i ) == ' U ' ) y ++ ; if ( s . charAt ( i ) == ' R ' ) x ++ ; if ( x == y ) { if ( i < n - 1 && s . charAt ( i ) == s . charAt ( i + 1 ) ) c ++ ; } } System . out . println ( c ) ; } catch ( Exception e ) { } } }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class Main {   static class FastScanner {   BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( " " ) ;   String next ( ) { while ( ! st . hasMoreTokens ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   int [ ] readArray ( int n ) { int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = nextInt ( ) ; } return a ; }   long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } }   public static void main ( String args [ ] ) { FastScanner f = new FastScanner ( ) ; int n = f . nextInt ( ) ; String str = f . next ( ) ; int x = 0 , y = 0 ; int count = 0 ; int prevX , prevY ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) { prevX = x ; prevY = y ; if ( str . charAt ( i ) == ' U ' ) { y ++ ; } else { x ++ ; } if ( x == y && i + 1 < str . length ( ) ) { char next = str . charAt ( i + 1 ) ; int nextX = x , nextY = y ; if ( next == ' U ' ) { nextY ++ ; } else { nextX ++ ; } if ( ( prevX == x - 1 && nextX == x + 1 ) || ( prevY == y - 1 && nextY == y + 1 ) ) { count ++ ; } } } System . out . println ( count ) ; }   }

import java . util . Arrays ; import java . util . Scanner ;   public class main { public static void main ( String [ ] args ) { Scanner k = new Scanner ( System . in ) ; String n = k . next ( ) ; String input = k . next ( ) ; int ans = 0 ; int c = input . charAt ( 0 ) == ' R ' ? 1 : - 1 ; boolean pos = input . charAt ( 0 ) == ' R ' ; for ( int i = 1 ; i < input . length ( ) ; i ++ ) { if ( input . charAt ( i ) == ' R ' ) { c += 1 ; if ( c == 1 && pos == false ) { pos = true ; ans += 1 ; } } else if ( input . charAt ( i ) == ' U ' ) { c -= 1 ; if ( c == - 1 && pos == true ) { pos = false ; ans += 1 ; } } } System . out . println ( ans ) ; } }

import java . util . * ; import java . util . stream . * ;   public class Solution { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; scan . nextLine ( ) ; String s = scan . nextLine ( ) ; int result = 0 ; int numU = 0 ; int numR = 0 ; boolean tS = true ; for ( int i = 0 ; i < n ; i ++ ) { char ch = s . charAt ( i ) ; boolean v = ( numU == numR ) ; if ( ch == ' U ' ) { numU ++ ; } else if ( ch == ' R ' ) { numR ++ ; } if ( i == 0 ) { tS = ( numU > 0 ) ; } if ( v && tS && numR > numU ) { tS = false ; result ++ ; } if ( v && ! tS && numR < numU ) { tS = true ; result ++ ; } } System . out . println ( result ) ; } }

n = int ( input ( ) ) s = input ( )   x = 0 y = 0 prev_kingdom = Nonecoin = 0 for step in s : if step == ' U ' : y += 1 else : x += 1 if y > x : curr_kingdom = 2 elif x > y : curr_kingdom = 1 if prev_kingdom and curr_kingdom != prev_kingdom : coin += 1 prev_kingdom = curr_kingdomprint ( coin ) NEW_LINE

n = int ( input ( ) ) s = input ( ) x , y = 0 , 0 f = 0 ans = 0 for c in s : if c == ' U ' : y += 1 else : x += 1 if x == y : continue else : f1 = 1 if x > y : f1 = 1 else : f1 = - 1 if f1 * f < 0 : ans += 1 f = f1print ( ans ) NEW_LINE

n = int ( input ( ) ) S = str ( input ( ) ) cur_y , cur_x = 0 , 0 C = [ ( cur_x , cur_y ) ] for c in S : if c == ' U ' : cur_y += 1 else : cur_x += 1 C . append ( ( cur_y , cur_x ) ) ans = 0 for i , ( cur_x , cur_y ) in enumerate ( C ) : if i == 0 or i == len ( C ) - 1 : continue if cur_x == cur_y : pre_x , pre_y = C [ i - 1 ] pos_x , pos_y = C [ i + 1 ] if pre_x > pre_y and pos_x < pos_y : ans += 1 elif pre_x < pre_y and pos_x > pos_y : ans += 1 print ( ans ) NEW_LINE

n = int ( input ( ) ) s = input ( ) x , y = 0 , 0 count = 0 for i in range ( len ( s ) - 1 ) : if ( s [ i ] == " U " ) : y = y + 1 if ( x == y and s [ i + 1 ] == " U " ) : count = count + 1 if ( s [ i ] == " R " ) : x = x + 1 if ( x == y and s [ i + 1 ] == " R " ) : count = count + 1 print ( count ) NEW_LINE


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

import java . util . LinkedList ; import java . util . List ; import java . util . Scanner ;   public class B792 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int N = in . nextInt ( ) ; int K = in . nextInt ( ) ; int [ ] A = new int [ K ] ; for ( int k = 0 ; k < K ; k ++ ) { A [ k ] = in . nextInt ( ) ; } List < Integer > list = new LinkedList < > ( ) ; for ( int n = 1 ; n <= N ; n ++ ) { list . add ( n ) ; } StringBuilder output = new StringBuilder ( ) ; int pos = 0 ; for ( int k = 0 ; k < K ; k ++ ) { pos += A [ k ] ; pos %= list . size ( ) ; output . append ( list . get ( pos ) ) . append ( ' ▁ ' ) ; list . remove ( pos ) ; } System . out . println ( output ) ; }   }

n , k = map ( int , ( input ( ) . split ( ) ) ) arr = list ( map ( int , input ( ) . split ( ) ) )   nums = list ( range ( 1 , n + 1 ) ) leader = 0 elims = [ ] for i in range ( k ) : elim = ( leader + arr [ i ] ) % n elims . append ( nums . pop ( elim ) ) n -= 1 leader = elimprint ( * elims )       NEW_LINE

n , k = map ( int , input ( ) . split ( ) ) k = list ( map ( int , input ( ) . split ( ) ) ) l , ans = [ ] , [ ] for i in range ( n ) : l . append ( i ) leader = 0 for i in k : ans . append ( l [ ( ( leader + i ) % ( len ( l ) ) ) ] + 1 ) leader = ( ( leader + i ) % ( len ( l ) ) ) ; l . remove ( ans [ - 1 ] - 1 ) leader = leader % len ( l )   print ( * ans , sep = " ▁ " )   NEW_LINE

n , k = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) lead = 0 lst = [ ] for i in range ( 1 , n + 1 ) : lst . append ( i ) for i in range ( k ) : ind = ( lead + a [ i ] ) % len ( lst ) print ( lst [ ind ] , end = " ▁ " ) lead = ind lst [ ind ] = - 1 llst = [ ] for j in range ( len ( lst ) ) : if lst [ j ] != - 1 : llst . append ( lst [ j ] ) lst = list ( llst ) NEW_LINE

n , k = map ( int , input ( ) . split ( ) ) a = [ x + 1 for x in range ( n ) ] for m in map ( int , input ( ) . split ( ) ) : m %= len ( a ) print ( a [ m ] , end = " ▁ " ) a = a [ m + 1 : ] + a [ : m ] print ( ) NEW_LINE


import java . util . * ; import java . math . * ;   public class Solution { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; long A = s . nextLong ( ) , B = s . nextLong ( ) , C = s . nextLong ( ) ;   if ( A == 0 && B == 0 ) { System . out . println ( C == 0 ? - 1 : 0 ) ; } else if ( A == 0 ) { System . out . println ( 1 ) ; System . out . println ( 1.0 * - C / B ) ; } else { long discriminant = B * B - 4 * A * C ; if ( discriminant < 0 ) System . out . println ( 0 ) ; else if ( discriminant == 0 ) { System . out . println ( 1 ) ; System . out . println ( 1.0 * - B / ( 2.0 * A ) ) ; } else { System . out . println ( 2 ) ; double num1 = ( - B - Math . sqrt ( discriminant ) ) / ( 2.0 * A ) ; double num2 = ( - B + Math . sqrt ( discriminant ) ) / ( 2.0 * A ) ;   if ( num1 < num2 ) { System . out . println ( num1 ) ; System . out . println ( num2 ) ; } else { System . out . println ( num2 ) ; System . out . println ( num1 ) ; } } }   s . close ( ) ; } }

import java . io . * ; import java . util . * ;   public class ProbA { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; Task solver = new Task ( ) ; solver . solve ( in , out ) ; out . close ( ) ; }

import java . io . * ; import java . util . * ; import java . lang . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; double a = sc . nextDouble ( ) ; double b = sc . nextDouble ( ) ; double c = sc . nextDouble ( ) ; if ( a == 0 && b != 0 ) { double ans = - ( c / b ) ; System . out . format ( "1 \n % .5f " , ans ) ; } else if ( a == 0 && b == 0 && c == 0 ) { System . out . println ( " - 1" ) ; } else if ( a == 0 && b == 0 && c != 0 ) { System . out . println ( "0" ) ; } else { double r1 , r2 ; double det = b * b - 4 * a * c ; if ( det > 0 ) { System . out . println ( "2" ) ; r1 = ( - b + Math . sqrt ( det ) ) / ( 2 * a ) ; r2 = ( - b - Math . sqrt ( det ) ) / ( 2 * a ) ; double x = ( r1 < r2 ) ? r1 : r2 ; double y = ( r1 > r2 ) ? r1 : r2 ; System . out . format ( " % .5f \n % .5f \n " , x , y ) ; } else if ( det == 0 ) { r1 = ( - b + Math . sqrt ( det ) ) / ( 2 * a ) ; System . out . format ( "1 \n % .5f " , r1 ) ; } else System . out . println ( "0" ) ; } } }

from math import sqrt   a , b , c = map ( int , input ( ) . split ( ) ) if a == b == c == 0 : print ( - 1 ) elif a == b == 0 :   print ( 0 ) elif a == 0 : print ( 1 ) print ( - c / b ) else : if b ** 2 == ( 4 * a * c ) :   print ( 1 ) print ( ( - b ) / ( 2 * a ) ) elif ( 4 * a * c ) > b ** 2 : print ( 0 ) else : print ( 2 ) x = ( ( - b + sqrt ( b ** 2 - ( 4 * a * c ) ) ) / ( 2 * a ) ) y = ( - b - sqrt ( b ** 2 - ( 4 * a * c ) ) ) / ( 2 * a ) print ( ' { 0 : . 16f } ' . format ( min ( x , y ) ) ) print ( ' { 0 : . 16f } ' . format ( max ( x , y ) ) ) NEW_LINE

a , b , c = map ( int , input ( ) . split ( ) )   def quadroot ( a , b , c ) : roots = [ ] negb = - 1 * b discriminant = ( b ** 2 - 4 * a * c ) ** ( 1 / 2 ) bottom = 2 * a roots . append ( format ( ( negb - discriminant ) / ( bottom ) , " . 6f " ) ) roots . append ( format ( ( negb + discriminant ) / ( bottom ) , " . 6f " ) ) return roots   if a == 0 and b == 0 and c == 0 : print ( - 1 ) exit ( ) if a == b and b == 0 and c != 0 or ( b ** 2 - 4 * a * c ) < 0 : print ( 0 ) exit ( ) ans = [ ] if a == 0 : ans . append ( ( - 1 * c ) / b ) else : ans = quadroot ( a , b , c )   for root in range ( len ( ans ) ) : ans [ root ] = float ( ans [ root ] )   ans1 = list ( set ( sorted ( ans ) ) ) print ( len ( ans1 ) ) for i in ans1 : print ( ( f ' { i : .6f } ' ) )     NEW_LINE

from math import sqrt   a , b , c = map ( int , input ( ) . split ( ) ) det = b * b - 4 * a * cif a == 0 : if b == 0 and c == 0 : print ( - 1 ) elif b == 0 : print ( 0 ) else : print ( 1 ) p = round ( - c / b , 5 ) print ( p ) elif det < 0 : print ( 0 ) elif det == 0 : print ( 1 ) p = round ( - b / ( a * 2 ) , 5 ) print ( p ) else : print ( 2 ) neu = - b + sqrt ( det ) p = round ( neu / ( 2 * a ) , 5 ) neu = - b - sqrt ( det ) q = round ( neu / ( 2 * a ) , 5 ) if p > q : p , q = q , p print ( p ) print ( q )   ''' And ▁ the ▁ shadow ▁ of ▁ the ▁ dayWill ▁ embrace ▁ the ▁ word ▁ in ▁ greyAnd ▁ the ▁ sun ▁ will ▁ set ▁ for ▁ you ''' NEW_LINE


import java . util . Scanner ;   public class AlgoDesign {   public static void main ( String args [ ] ) { int n , m , max = 0 ; Scanner sc = new Scanner ( System . in ) ; n = sc . nextInt ( ) ; m = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; if ( a [ i ] > max ) { max = a [ i ] ; } } int seatsToFill = m ; for ( int i = 0 ; i < n ; i ++ ) { if ( seatsToFill <= 0 ) { seatsToFill = 0 ; break ; } if ( a [ i ] < max ) { seatsToFill = seatsToFill - ( max - a [ i ] ) ; } } int min = 0 ; if ( seatsToFill > 0 ) { min = ( seatsToFill / n ) ; min = seatsToFill % n > 0 ? min + 1 : min ; } System . out . print ( ( max + min ) + " ▁ " + ( max + m ) ) ; } }

import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; 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 ; FastReader in = new FastReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; ABenches solver = new ABenches ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }   static class ABenches { public void solve ( int testNumber , FastReader in , PrintWriter out ) { int n = in . nextInt ( ) , m = in . nextInt ( ) ; int a [ ] = in . readArray ( n ) ; func . sort ( a ) ; int sum = 0 ; for ( int i = 0 ; i < n ; ++ i ) { sum += a [ n - 1 ] - a [ i ] ; } if ( m <= sum ) { out . println ( a [ n - 1 ] + " ▁ " + ( a [ n - 1 ] + m ) ) ; return ; } int max = a [ n - 1 ] + m ; m -= sum ; m = ( m + n - 1 ) / n ; out . println ( ( a [ n - 1 ] + m ) + " ▁ " + ( max ) ) ; }   }   static class func { public static void sort ( int [ ] arr ) {

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

n = int ( input ( ) ) m = int ( input ( ) ) a = [ ] for i in range ( n ) : a . append ( int ( input ( ) ) ) k1 = max ( a ) kmax = k1 + m     aa = m / nk2 = sum ( a ) + m + n - 1 kmin = k2 // n     print ( max ( kmin , k1 ) , kmax ) NEW_LINE

n = int ( input ( ) ) m = int ( input ( ) ) A = [ ] for _ in range ( 0 , n ) : A . append ( int ( input ( ) ) ) print ( max ( max ( A ) , ( sum ( A ) + m + n - 1 ) // n ) , max ( A ) + m ) NEW_LINE

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

n = int ( input ( ) ) m = int ( input ( ) ) NEW_LINE


import java . util . * ;    public class Practise {

import java . util . Scanner ;   public class _0642AniaandMinimizing {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; sc . nextLine ( ) ; String s = sc . nextLine ( ) ; if ( n == 1 && k == 1 ) { System . out . println ( 0 ) ; return ; } if ( k == 0 ) { System . out . println ( s ) ; return ; } StringBuilder str = new StringBuilder ( s ) ; for ( int i = 0 ; i < str . length ( ) && k > 0 ; i ++ ) { if ( i == 0 ) { if ( str . charAt ( i ) != '1' ) { str . setCharAt ( i , '1' ) ; k -- ; } else { continue ; } } else { if ( str . charAt ( i ) == '0' ) { continue ; } else { str . setCharAt ( i , '0' ) ; k -- ; } } } System . out . println ( str . toString ( ) ) ; }   }

import java . util . * ;   public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) , k = sc . nextInt ( ) ; String s = sc . next ( ) ; char [ ] ar = new char [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { ar [ i ] = s . charAt ( i ) ; } if ( n == k ) { if ( n == 1 ) System . out . println ( 0 ) ; else { System . out . print ( 1 ) ; for ( int i = 1 ; i < n ; i ++ ) System . out . print ( 0 ) ; } } else { for ( int i = 0 ; i < n && k > 0 ; i ++ ) { if ( i == 0 ) { if ( ar [ i ] != '1' ) { k -- ; ar [ i ] = '1' ; } } else { if ( ar [ i ] != '0' ) { k -- ; ar [ i ] = '0' ; } } } for ( char i : ar ) System . out . print ( i ) ; } } }

def ans ( n , k , s ) : if k == 0 : return ' ' . join ( s ) elif k != 0 and n == 1 : return '0' for i in range ( n ) : if k == 0 : break   if i == 0 and s [ i ] != '1' : s [ i ] = '1' k -= 1 elif i != 0 and s [ i ] != '0' : s [ i ] = '0' k -= 1 return ' ' . join ( s )     n , k = map ( int , input ( ) . split ( ' ▁ ' ) ) s = list ( input ( ) )   print ( ans ( n , k , s ) ) NEW_LINE

def tostring ( s ) : str1 = ' ' return str1 . join ( s )   vet = input ( ) . split ( ) s = list ( input ( ) ) n = int ( vet [ 0 ] ) k = int ( vet [ 1 ] )   if ( n == 1 and k ) : print ( 0 )   else : if ( s [ 0 ] > '1' and k ) : s [ 0 ] = '1' k -= 1 for i in range ( 1 , len ( s ) ) : if ( s [ i ] > '0' and k > 0 ) : s [ i ] = '0' k -= 1 print ( tostring ( s ) ) NEW_LINE

n_size , k = map ( int , input ( ) . split ( ) ) number = input ( )   if n_size == 1 : if number == '0' : print ( '0' ) else : if k >= 1 : print ( '0' ) else : print ( number ) else : for i in range ( len ( number ) ) : if ( k > 0 ) : if ( i == 0 and number [ i ] == '1' ) : print ( '1' , end = ' ' ) continue elif ( i == 0 ) : print ( '1' , end = ' ' ) k -= 1 continue elif ( number [ i ] == '0' ) : print ( number [ i ] , end = ' ' ) continue else : print ( '0' , end = ' ' ) k -= 1 continue print ( number [ i ] , end = ' ' ) NEW_LINE

try : n , k = map ( int , input ( ) . split ( ) ) s = input ( ) j = 0 z = " " if k == 0 : print ( s ) elif n == 1 and not k == 0 : print ( 0 ) else : for i in range ( n ) : if i == 0 : if not s [ i ] == "1" : print ( 1 , end = " " ) j += 1 else : print ( 1 , end = " " ) elif j >= k : print ( s [ i ] , end = " " ) else : if not s [ i ] == "0" : print ( 0 , end = " " ) j += 1 else : print ( 0 , end = " " ) NEW_LINE

if __name__ == " _ _ main _ _ " : n , k = map ( int , input ( ) . split ( ) ) st = input ( ) c = 0 ans = " " if k == 0 : ans = ans + st elif n == 1 : ans = ans + '0' else : for i in range ( n ) : if c < k : if i == 0 and st [ i ] != '1' : ans = ans + '1' c = c + 1 elif st [ i ] != '0' and i != 0 : ans = ans + '0' c = c + 1 else : ans = ans + st [ i ] else : ans = ans + st [ i ] print ( ans ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . lang . reflect . Array ; import java . nio . Buffer ; import java . util . Arrays ; import java . util . HashSet ; import java . util . Set ; import java . util . StringTokenizer ;   public class ColoredFields {   public static int floorSearch ( int arr [ ] , int low , int high , int x ) {   if ( low > high ) return - 1 ;

import java . util . * ; import java . util . Scanner ; import java . io . * ; import javax . lang . model . util . ElementScanner6 ; import static java . lang . System . out ; import java . util . Stack ; import java . util . Queue ; import java . util . LinkedList ;   public class B79 {   static int mod = ( int ) ( 1e9 + 7 ) ; static long MOD = ( long ) ( 1e9 + 7 ) ; static FastReader in = new FastReader ( ) ; static PrintWriter pr = new PrintWriter ( new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ) ; public static void main ( String args [ ] ) {   int tc = 1 ;

n , m , k , t = map ( int , input ( ) . split ( ) )   waste = [ ]   for _ in range ( k ) : i , j = map ( int , input ( ) . split ( ) ) NEW_LINE waste += [ ( i - 1 ) * m + ( j - 1 ) ] NEW_LINE waste . sort ( ) NEW_LINE put = [ " Carrots " , " Kiwis " , " Grapes " ]   for _ in range ( t ) : i , j = map ( int , input ( ) . split ( ) ) NEW_LINE numc = ( i - 1 ) * m + ( j - 1 ) NEW_LINE c = 0 NEW_LINE for x in waste : NEW_LINE

n , m , k , t = map ( int , input ( ) . split ( " ▁ " ) ) NEW_LINE

n , m , k , t = map ( int , input ( ) . split ( ) ) NEW_LINE waste = [ tuple ( map ( int , input ( ) . split ( ) ) ) for _ in range ( k ) ] NEW_LINE

def get_crop ( n , m , waste , i , j ) : curr = ( m * i ) + j NEW_LINE if curr in waste : return " Waste " NEW_LINE new = curr NEW_LINE i = 0 NEW_LINE while i < len ( waste ) and waste [ i ] < curr : new -= 1 NEW_LINE i += 1 NEW_LINE if new % 3 == 0 : NEW_LINE INDENT return " Carrots " elif new % 3 == 1 : NEW_LINE return " Kiwis " else : NEW_LINE return " Grapes "     s = input ( ) . split ( ) NEW_LINE DEDENT n , m , k , t = int ( s [ 0 ] ) , int ( s [ 1 ] ) , int ( s [ 2 ] ) , int ( s [ 3 ] ) NEW_LINE waste = [ ] NEW_LINE for i in range ( k ) : s = input ( ) . split ( ) NEW_LINE waste . append ( ( m * ( int ( s [ 0 ] ) - 1 ) ) + int ( s [ 1 ] ) - 1 ) NEW_LINE


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

import java . util . * ; public class Contest { 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 ( ) ; sc . close ( ) ;   int misha = Math . max ( 3 * a / 10 , a - ( a / 250 ) * c ) ; int vasya = Math . max ( 3 * b / 10 , b - ( b / 250 ) * d ) ;   if ( misha > vasya ) System . out . println ( " Misha " ) ; else if ( vasya > misha ) System . out . println ( " Vasya " ) ; else System . out . println ( " Tie " ) ; } }

import java . io . * ; import java . util . * ; import java . text . * ; import java . math . * ; import java . util . regex . * ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int a = s . nextInt ( ) , b = s . nextInt ( ) , c = s . nextInt ( ) , d = s . nextInt ( ) ; double x , y , n1 , n2 ; String temp = " " ; x = 3 * a / 10 ; y = a - ( ( a / 250 ) * c ) ; n1 = Math . max ( x , y ) ; x = 3 * b / 10 ; y = b - ( ( b / 250 ) * d ) ; n2 = Math . max ( x , y ) ; if ( n1 > n2 ) temp = " Misha " ; else if ( n1 < n2 ) temp = " Vasya " ; else temp = " Tie " ; System . out . println ( temp ) ; } }

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

a , b , c , d = map ( int , input ( ) . split ( ) )   misha = max ( 3 * a / 10 , a - a / 250 * c ) vasya = max ( 3 * b / 10 , b - b / 250 * d )   if misha > vasya : print ( " Misha " ) elif vasya > misha : print ( " Vasya " ) else : print ( " Tie " ) NEW_LINE

a , b , c , d = input ( ) . split ( ) a , b , c , d = int ( a ) , int ( b ) , int ( c ) , int ( d ) def score ( p , t ) : sco = 0 sco1 = 3 * p / 10 sco2 = p - ( p * t / 250 ) if sco1 > sco2 : sco = sco1 return sco else : sco = sco2 return scosco_misha = score ( a , c ) sco_vasya = score ( b , d ) if sco_misha > sco_vasya : print ( " Misha " ) elif sco_misha < sco_vasya : print ( " Vasya " ) else : print ( " Tie " ) NEW_LINE

import mathdef solve ( a , b , c , d ) : m = max ( 3 * a // 10 , a - ( ( a // 250 ) * c ) ) v = max ( 3 * b // 10 , b - ( ( b // 250 ) * d ) ) if m > v : return ' Misha ' if v > m : return ' Vasya ' return ' Tie '                   def main ( ) : NEW_LINE

a , b , c , d = map ( int , input ( ) . split ( ) ) misha = max ( 3 * a / 10 , a - ( a / 250 ) * c ) vasya = max ( 3 * b / 10 , b - ( b / 250 ) * d )   if vasya > misha : print ( " Vasya " ) if misha > vasya : print ( " Misha " ) if misha == vasya : print ( " Tie " ) NEW_LINE

a , b , c , d = map ( int , input ( ) . split ( ) )   x = max ( 3 * a // 10 , a - ( a // 250 ) * c ) y = max ( 3 * b // 10 , b - ( b // 250 ) * d )   if x > y : print ( ' Misha ' ) elif x < y : print ( ' Vasya ' ) else : print ( ' Tie ' ) NEW_LINE


import java . util . * ; import java . lang . * ; import java . io . * ; public class Codechef { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) , count = 0 ; String st = s . next ( ) ; for ( int i = 0 ; i < st . length ( ) ; i ++ ) { if ( st . charAt ( i ) == ' < ' ) count ++ ; else break ; } for ( int i = st . length ( ) - 1 ; i >= 0 ; i -- ) { if ( st . charAt ( i ) == ' > ' ) count ++ ; else break ; } System . out . println ( count ) ; } }

import java . io . * ; import java . math . * ; import java . util . * ; public class JumpingBall { public static void main ( String [ ] args ) { FastScanner I = new FastScanner ( ) ;

import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner capt = new Scanner ( System . in ) ; int n = capt . nextInt ( ) ; String x = capt . next ( ) ; System . out . println ( solution ( x ) ) ;      }   static int solution ( String x ) { int count = 0 ; if ( x . charAt ( 0 ) == ' < ' ) { int a = x . indexOf ( ' > ' ) ; if ( a == - 1 ) { return x . length ( ) ; } else count += x . indexOf ( ' > ' ) ;   } if ( x . charAt ( x . length ( ) - 1 ) == ' > ' ) { for ( int i = x . length ( ) - 1 ; i >= 0 ; i -- ) { if ( x . charAt ( i ) == ' < ' ) break ; else count ++ ; } } return count ;   }    }

import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; 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 ) ; AJumpingBall solver = new AJumpingBall ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }   static class AJumpingBall { public void solve ( int testNumber , InputReader in , PrintWriter out ) { int n = in . nextInt ( ) ; char [ ] k = in . next ( ) . toCharArray ( ) ; int clef = 0 , f = 0 , m = 0 , cright = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( k [ i ] == ' < ' && f == 0 ) { clef ++ ; } else { f = 1 ; } if ( k [ n - i - 1 ] == ' > ' && m == 0 ) { cright ++ ; } else { m = 1 ; } } out . println ( clef + cright ) ; }   }   static class InputReader { public BufferedReader reader ; public StringTokenizer tokenizer ;   public InputReader ( InputStream stream ) { reader = new BufferedReader ( new InputStreamReader ( stream ) , 32768 ) ; tokenizer = null ; }   public String next ( ) { while ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( ) ; }   public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   } }

n = int ( input ( ) ) s = input ( ) ans = 0 for i in s : if i == ' < ' : ans += 1 else : breaks = s [ : : - 1 ] for i in s : if i == ' > ' : ans += 1 else : break   print ( ans ) NEW_LINE

if __name__ == " _ _ main _ _ " : nr_of_bumpers = int ( input ( ) ) bumper_types = list ( input ( ) ) fall_bumpers = 0 bumper_index = 0 while bumper_index < nr_of_bumpers and bumper_types [ bumper_index ] == ' < ' : fall_bumpers += 1 bumper_index += 1 bumper_index = nr_of_bumpers - 1 while bumper_index >= 0 and bumper_types [ bumper_index ] == ' > ' : fall_bumpers += 1 bumper_index -= 1 print ( fall_bumpers ) NEW_LINE

n = int ( input ( ) ) s = input ( ) s = list ( s ) count = 0 for i in range ( len ( s ) ) : if ( s [ i ] == ' < ' ) : count += 1 else : break for i in range ( len ( s ) - 1 , - 1 , - 1 ) : if ( s [ i ] == ' > ' ) : count += 1 else : break print ( count ) NEW_LINE

import sys , mathsys . setrecursionlimit ( 10 ** 8 ) ''' def ▁ fun ( ) : ▁ ▁ ▁ ▁ for ▁ i ▁ in ▁ range ( 16 ) : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ for ▁ j ▁ in ▁ range ( 4 ) : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ if ▁ i & (1 < < j ) : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( j , end = ' ' ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( ) import ▁ binarytreefrom ▁ collections ▁ import ▁ dequebst ▁ = ▁ binarytree . tree ( height = 4 , is _ perfect = True ) print ( bst ) def ▁ s ( bst ) : ▁ ▁ ▁ ▁ if ▁ bst : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ bst . left , bst . right ▁ = ▁ bst . right , bst . left ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ s ( bst . right ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ s ( bst . left ) s ( bst ) print ( bst ) '''   n = int ( input ( ) ) s = input ( ) x = 0j , k = 0 , n - 1 for i in range ( n ) : if j <= k and s [ j ] == ' < ' : x += 1 j += 1 elif j <= k and s [ k ] == ' > ' : x += 1 k -= 1 print ( x )                               NEW_LINE

n = int ( input ( ) ) s = input ( ) pas = 0 for i in s : if i == ' > ' : break else : pas += 1 for i in range ( n - 1 , - 1 , - 1 ) : if s [ i ] == ' < ' : break else : pas += 1 print ( pas ) NEW_LINE


import java . io . * ; import java . util . * ;   public class Prob645A { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] l1 = br . readLine ( ) . split ( " " ) ; String [ ] l2 = br . readLine ( ) . split ( " " ) ; String [ ] l3 = br . readLine ( ) . split ( " " ) ; String [ ] l4 = br . readLine ( ) . split ( " " ) ; String s1 = " " ; if ( ! l1 [ 0 ] . equals ( " X " ) ) s1 += l1 [ 0 ] ; if ( ! l1 [ 1 ] . equals ( " X " ) ) s1 += l1 [ 1 ] ; if ( ! l2 [ 1 ] . equals ( " X " ) ) s1 += l2 [ 1 ] ; if ( ! l2 [ 0 ] . equals ( " X " ) ) s1 += l2 [ 0 ] ; String s2 = " " ; if ( ! l3 [ 0 ] . equals ( " X " ) ) s2 += l3 [ 0 ] ; if ( ! l3 [ 1 ] . equals ( " X " ) ) s2 += l3 [ 1 ] ; if ( ! l4 [ 1 ] . equals ( " X " ) ) s2 += l4 [ 1 ] ; if ( ! l4 [ 0 ] . equals ( " X " ) ) s2 += l4 [ 0 ] ; if ( ( s1 + s1 ) . contains ( s2 ) ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } }

import java . io . * ; import java . util . * ; public class Main {   public static void main ( String [ ] args ) throws IOException {   BufferedReader f = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line1 = f . readLine ( ) ; String line2 = f . readLine ( ) ; String line3 = f . readLine ( ) ; String line4 = f . readLine ( ) ; String input1 = ( line1 + line2 . charAt ( 1 ) + line2 . charAt ( 0 ) ) . replace ( " X " , " " ) ; String input2 = ( line3 + line4 . charAt ( 1 ) + line4 . charAt ( 0 ) ) . replace ( " X " , " " ) ; if ( ( input2 + input2 ) . contains ( input1 ) ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } }

import java . io . * ;   public class Main { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; OutputStream output = System . out ; PrintWriter pr = new PrintWriter ( output ) ; try { String line1 = br . readLine ( ) ; StringBuilder sb = new StringBuilder ( br . readLine ( ) ) ; line1 += sb . reverse ( ) ; line1 = line1 . replace ( " X " , " " ) ; String line2 = br . readLine ( ) ; sb = new StringBuilder ( br . readLine ( ) ) ; line2 += sb . reverse ( ) ; line2 = line2 . replace ( " X " , " " ) ;   pr . println ( ( line1 + line1 ) . contains ( line2 ) ? " YES " : " NO " ) ; pr . close ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } }

import java . util . * ; import java . io . * ;   public class AmityAssessment { static BufferedReader br ; static StringTokenizer tokenizer ;   public static void main ( String [ ] args ) throws Exception { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s = " " ; String s1 = " " ; s += next ( ) ; String t = next ( ) ; s += t . charAt ( 1 ) + " " + t . charAt ( 0 ) ; s1 += next ( ) ; t = next ( ) ; s1 += t . charAt ( 1 ) + " " + t . charAt ( 0 ) ; s = removeX ( s ) ; s1 = removeX ( s1 ) ; int start = 0 ; int start2 = 0 ;

import java . util . Scanner ;   public class A645 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; StringBuilder first = new StringBuilder ( ) ; char [ ] S = in . next ( ) . toCharArray ( ) ; if ( S [ 0 ] != ' X ' ) first . append ( S [ 0 ] ) ; if ( S [ 1 ] != ' X ' ) first . append ( S [ 1 ] ) ; S = in . next ( ) . toCharArray ( ) ; if ( S [ 1 ] != ' X ' ) first . append ( S [ 1 ] ) ; if ( S [ 0 ] != ' X ' ) first . append ( S [ 0 ] ) ; StringBuilder second = new StringBuilder ( ) ; S = in . next ( ) . toCharArray ( ) ; if ( S [ 0 ] != ' X ' ) second . append ( S [ 0 ] ) ; if ( S [ 1 ] != ' X ' ) second . append ( S [ 1 ] ) ; S = in . next ( ) . toCharArray ( ) ; if ( S [ 1 ] != ' X ' ) second . append ( S [ 1 ] ) ; if ( S [ 0 ] != ' X ' ) second . append ( S [ 0 ] ) ; boolean match = false ; for ( int shift = 0 ; shift < 3 ; shift ++ ) { boolean ok = true ; for ( int i = 0 ; i < 3 ; i ++ ) { if ( first . charAt ( i ) != second . charAt ( ( i + shift ) % 3 ) ) { ok = false ; } } if ( ok ) { match = true ; } } System . out . println ( match ? " YES " : " NO " ) ; }   }

a = input ( ) + input ( ) [ : : - 1 ] b = input ( ) + input ( ) [ : : - 1 ] a = a . replace ( " X " , " " ) b = b . replace ( " X " , " " ) if ( a + a ) . find ( b ) + 1 : print ( " YES " ) else : print ( ' NO ' ) NEW_LINE

l = [ ] for i in range ( 2 ) : r , o = input ( ) , input ( ) r = list ( o [ 0 ] + r + o [ 1 ] ) r . remove ( " X " ) ; while r [ 0 ] != " A " : r [ 0 ] , r [ 1 ] , r [ 2 ] = r [ 2 ] , r [ 0 ] , r [ 1 ] l . append ( " " . join ( r ) ) print ( " YES " if l [ 0 ] == l [ 1 ] else " NO " ) NEW_LINE

def find_order ( A , B ) : d = dict ( ) i = 0 if A [ 0 ] != ' X ' : d [ i ] = A [ 0 ] i += 1 if A [ 1 ] != ' X ' : d [ i ] = A [ 1 ] i += 1 if B [ 1 ] != ' X ' : d [ i ] = B [ 1 ] i += 1 if B [ 0 ] != ' X ' : d [ i ] = B [ 0 ] i += 1 return d     a = input ( ) b = input ( ) c = input ( ) d = input ( ) m = find_order ( a , b ) n = find_order ( c , d )   m [ 3 ] = m [ 0 ] m [ 4 ] = m [ 1 ] if m [ 0 ] == n [ 0 ] : if m [ 1 ] == n [ 1 ] and m [ 2 ] == n [ 2 ] : print ( ' YES ' ) else : print ( ' NO ' ) elif m [ 1 ] == n [ 0 ] : if m [ 2 ] == n [ 1 ] and m [ 3 ] == n [ 2 ] : print ( ' YES ' ) else : print ( ' NO ' ) elif m [ 2 ] == n [ 0 ] : if m [ 3 ] == n [ 1 ] and m [ 4 ] == n [ 2 ] : print ( ' YES ' ) else : print ( ' NO ' ) NEW_LINE


import java . io . * ; import java . util . * ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ;    public class Main1 {      public static void main ( String [ ] args ) {   try {    FastScanner in = new FastScanner ( ) ; PrintWriter out = new PrintWriter ( System . out ) ;     int t = in . nextInt ( ) ; while ( t -- > 0 ) {   int n = in . nextInt ( ) ; int A [ ] = in . readArray ( n ) ;   StringBuilder sb = new StringBuilder ( ) ; int ct = 2 ; sb . append ( A [ 0 ] + " ▁ " ) ; for ( int i = 1 ; i < n - 1 ; i ++ ) { if ( ( A [ i ] > A [ i - 1 ] && A [ i ] > A [ i + 1 ] ) || ( A [ i ] < A [ i - 1 ] && A [ i ] < A [ i + 1 ] ) ) { ct ++ ; sb . append ( A [ i ] + " ▁ " ) ; } } sb . append ( A [ n - 1 ] ) ;   System . out . println ( ct ) ; System . out . println ( sb ) ;       }             out . flush ( ) ; out . close ( ) ;    } catch ( Exception e ) { return ; }                      }    static class FastScanner { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( " " ) ;   String next ( ) { while ( ! st . hasMoreTokens ( ) ) try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   int [ ] readArray ( int n ) { int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextInt ( ) ; return a ; }    long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } }    }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . * ;   public class Main implements Runnable { int n , m , k ; static boolean use_n_tests = true ; long [ ] res ;   void solve ( FastScanner in , PrintWriter out , int testNumber ) { n = in . nextInt ( ) ; int [ ] p = in . nextArray ( n ) ; int l = 0 ; int r = n - 1 ; boolean [ ] skip = new boolean [ n ] ; for ( int i = 1 ; i < n - 1 ; i ++ ) { int wh = Math . abs ( p [ i - 1 ] - p [ i ] ) + Math . abs ( p [ i ] - p [ i + 1 ] ) ; int skipwh = Math . abs ( p [ i - 1 ] - p [ i + 1 ] ) ; if ( skipwh >= wh ) { skip [ i ] = true ; } } List < Integer > answer = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( ! skip [ i ] ) { answer . add ( p [ i ] ) ; } } out . println ( answer . size ( ) ) ; for ( int x : answer ) { out . print ( x + " ▁ " ) ; } out . println ( ) ; }

import java . util . * ;   public class _1364B { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int n = sc . nextInt ( ) ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) arr [ i ] = sc . nextInt ( ) ;   Vector < Integer > v = new Vector < > ( ) ; v . add ( arr [ 0 ] ) ; for ( int i = 2 ; i < n ; i ++ ) { int first = arr [ i ] - arr [ i - 1 ] ; int second = arr [ i - 1 ] - arr [ i - 2 ] ; if ( first > 0 && second < 0 || first < 0 && second > 0 ) { v . add ( arr [ i - 1 ] ) ; } } v . add ( arr [ n - 1 ] ) ; System . out . println ( v . size ( ) ) ; for ( Integer i : v ) System . out . print ( i + " ▁ " ) ; System . out . println ( ) ; } } }

for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) l = [ ] l . append ( a [ 0 ] ) lo , hi = 0 , 1 temp = a [ 0 ] while hi < n : while hi < n and temp < a [ hi ] : temp = a [ hi ] hi += 1 if l [ - 1 ] != a [ hi - 1 ] : l . append ( a [ hi - 1 ] ) while hi < n and temp > a [ hi ] : temp = a [ hi ] hi += 1 if l [ - 1 ] != a [ hi - 1 ] : l . append ( a [ hi - 1 ] ) print ( len ( l ) ) print ( * l ) NEW_LINE

t = int ( input ( ) ) for test in range ( 0 , t ) : n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) ans = [ a [ 0 ] ] for i in range ( 1 , n - 1 ) : if ( a [ i ] > a [ i - 1 ] and a [ i ] > a [ i + 1 ] ) : ans . append ( a [ i ] ) if ( a [ i ] < a [ i - 1 ] and a [ i ] < a [ i + 1 ] ) : ans . append ( a [ i ] ) ans . append ( a [ n - 1 ] ) print ( len ( ans ) ) print ( * ans , sep = " ▁ " ) NEW_LINE

t = int ( input ( ) ) for _ in range ( t ) : n = int ( input ( ) ) a = [ int ( x ) for x in input ( ) . split ( ) ] ans = [ ] for i in range ( n ) : if ( i == 0 or i == n - 1 or ( a [ i - 1 ] < a [ i ] ) != ( a [ i ] < a [ i + 1 ] ) ) : ans . append ( a [ i ] ) print ( len ( ans ) ) print ( * ans ) NEW_LINE

from sys import stdin , stdoutfrom math import floor , gcd , fabs , factorial , fmod , sqrt , inf , logfrom collections import defaultdict as dd , dequefrom heapq import merge , heapify , heappop , heappush , nsmallestfrom bisect import bisect_left as bl , bisect_right as br , bisect mod = pow ( 10 , 9 ) + 7 mod2 = 998244353 def inp ( ) : return stdin . readline ( ) . strip ( ) def iinp ( ) : return int ( inp ( ) ) def out ( var , end = " \n " ) : stdout . write ( str ( var ) + " \n " ) def outa ( * var , end = " \n " ) : stdout . write ( ' ▁ ' . join ( map ( str , var ) ) + end ) def lmp ( ) : return list ( mp ( ) ) def mp ( ) : return map ( int , inp ( ) . split ( ) ) def smp ( ) : return map ( str , inp ( ) . split ( ) ) def l1d ( n , val = 0 ) : return [ val for i in range ( n ) ] def l2d ( n , m , val = 0 ) : return [ l1d ( m , val ) for j in range ( n ) ] def remadd ( x , y ) : return 1 if x % y else 0 def ceil ( a , b ) : return ( a + b - 1 ) // b def isprime ( x ) : if x <= 1 : return False if x in ( 2 , 3 ) : return True if x % 2 == 0 : return False for i in range ( 3 , int ( sqrt ( x ) ) + 1 , 2 ) : if x % i == 0 : return False return True for _ in range ( int ( inp ( ) ) ) : n = iinp ( ) arr = lmp ( ) ml = [ arr [ 0 ] ] for i in range ( 1 , n - 1 ) : if arr [ i - 1 ] < arr [ i ] > arr [ i + 1 ] or arr [ i - 1 ] > arr [ i ] < arr [ i + 1 ] : ml . append ( arr [ i ] ) ml . append ( arr [ - 1 ] ) print ( len ( ml ) ) print ( * ml ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . HashMap ; import java . util . StringTokenizer ;   public class Mike_Child { 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 ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } } public static void main ( String [ ] args ) { FastReader in = new FastReader ( ) ; int n = in . nextInt ( ) ; long arr [ ] = new long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = in . nextLong ( ) ; } HashMap < Long , Integer > hs = new HashMap < > ( ) ; int max = 1 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = i + 1 ; j < n ; j ++ ) { long s = arr [ i ] + arr [ j ] ; if ( hs . containsKey ( s ) ) { int get = hs . get ( s ) ; ++ get ; max = Math . max ( max , get ) ; hs . put ( s , get ) ; } else { hs . put ( s , 1 ) ; } } }   System . out . println ( max ) ; } }

import java . util . * ; import java . lang . * ; import java . io . * ; import java . math . * ;    public class file {

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { FastScanner sc = new FastScanner ( ) ;

import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] arr = new int [ n + 5 ] ; int [ ] count = new int [ ( int ) 2e5 + 10 ] ; for ( int i = 0 ; i < n ; i ++ ) arr [ i ] = sc . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) for ( int j = i + 1 ; j < n ; j ++ ) count [ arr [ i ] + arr [ j ] ] ++ ; int max = 0 ; for ( int i = 0 ; i < ( int ) 2e5 + 10 ; i ++ ) max = Math . max ( count [ i ] , max ) ; System . out . print ( max ) ; } }

import operatorfrom collections import defaultdict   n = int ( input ( ) ) lst = [ int ( i ) for i in input ( ) . split ( ) ] add = [ ]   for i in range ( n ) : for j in range ( i + 1 , n ) : add . append ( lst [ i ] + lst [ j ] )   occ = defaultdict ( lambda : 0 ) for i in add : occ [ i ] += 1   MaxKey = max ( occ . items ( ) , key = operator . itemgetter ( 1 ) ) [ 1 ] print ( MaxKey ) NEW_LINE

x = int ( input ( ) ) s = list ( map ( int , input ( ) . split ( ) ) ) d = { } for n in range ( x ) : for k in range ( n + 1 , x ) : j = s [ n ] + s [ k ] if j in d . keys ( ) : d [ j ] += 1 else : d [ j ] = 1 print ( max ( d . values ( ) ) ) NEW_LINE

n = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) ; k = 2 * ( 10 ** 5 + 1 ) dp = [ 0 ] * kfor i in range ( n ) : for j in range ( n ) : if i != j : dp [ arr [ i ] + arr [ j ] ] += 1 print ( max ( dp ) // 2 ) NEW_LINE

from collections import Counterfrom itertools import combinations   if __name__ == ' _ _ main _ _ ' : cin = input n = int ( cin ( ) ) a = [ int ( i ) for i in input ( ) . split ( ) ] print ( max ( Counter ( map ( sum , combinations ( a , 2 ) ) ) . values ( ) ) ) NEW_LINE


import java . util . * ;    import java . io . * ;    public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter pw = new PrintWriter ( new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ) ; StringTokenizer s = new StringTokenizer ( br . readLine ( ) ) ; int n = Integer . parseInt ( s . nextToken ( ) ) ; int k = Integer . parseInt ( s . nextToken ( ) ) ; s = new StringTokenizer ( br . readLine ( ) ) ; int ar [ ] = new int [ n ] ; int freq [ ] = new int [ n + 1 ] ; int last [ ] = new int [ n + 1 ] ; int next [ ] = new int [ n + 1 ] ; for ( int i = 0 ; i < ar . length ; i ++ ) { ar [ i ] = Integer . parseInt ( s . nextToken ( ) ) ; freq [ ar [ i ] ] ++ ; } Arrays . fill ( last , 82 ) ; int count = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { if ( freq [ i ] > 0 ) count ++ ; } if ( count <= k ) { pw . println ( count ) ; pw . close ( ) ; } for ( int i = n - 1 ; i >= 0 ; i -- ) { next [ i ] = last [ ar [ i ] ] ; last [ ar [ i ] ] = i ; }

import sysinput = sys . stdin . readlinefrom collections import deque , defaultdictn , k = map ( int , input ( ) . split ( ) ) A = list ( map ( int , input ( ) . split ( ) ) ) dic = defaultdict ( deque ) for i , a in enumerate ( A ) : dic [ a ] . append ( i ) S = set ( ) ans = 0 for i , a in enumerate ( A ) : for d in dic : while dic [ d ] and dic [ d ] [ 0 ] <= i : dic [ d ] . popleft ( ) if a not in S : if len ( S ) < k : S . add ( a ) ans += 1 else : day = i for s in S : if s not in dic or not dic [ s ] : idx = s break else : if dic [ s ] [ 0 ] > day : day = dic [ s ] [ 0 ] idx = s S . remove ( idx ) S . add ( a ) ans += 1 print ( ans ) NEW_LINE

n , k = map ( int , input ( ) . split ( ) )   a = list ( map ( int , input ( ) . split ( ) ) )   z = [ 0 ] * 81   kz , ans = 0 , 0   for i in range ( n ) :   if z [ a [ i ] ] : continue   ans += 1   if k > kz :   z [ a [ i ] ] = 1 ; kz += 1   else :   h = - 1   for j in range ( 1 , n + 1 ) :   if z [ j ] :   m = n + 1   for p in range ( i , n ) :   if j == a [ p ] :   m = p   break   if m > h :   h = m ;   t = j   z [ t ] = 0   z [ a [ i ] ] = 1   print ( ans )           NEW_LINE

R = lambda : map ( int , input ( ) . split ( ) ) n , k = R ( ) a = list ( R ( ) ) l = [ ] m = 0 for i in range ( n ) : if a [ i ] not in l : m += 1 if len ( l ) < k : l . append ( a [ i ] ) else : curmin = n curindex = 0 found = [ n ] * len ( l ) for j in range ( len ( a [ i + 1 : : ] ) ) : if ( a [ i + j + 1 ] in l ) and ( found [ l . index ( a [ i + j + 1 ] ) ] == n ) : found [ l . index ( a [ i + j + 1 ] ) ] = j l [ found . index ( max ( found ) ) ] = a [ i ] print ( m ) NEW_LINE

n , k = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) inventory = set ( ) bought = 0 for i in range ( n ) : if a [ i ] not in inventory : if len ( inventory ) == k : farthest_time = 0 farthest = 0 for v in inventory : try : far = a . index ( v , i + 1 ) if far > farthest_time : farthest_time = far farthest = v except ValueError : farthest_time = 10000 farthest = v inventory . remove ( farthest ) inventory . add ( a [ i ] ) bought += 1   print ( bought ) NEW_LINE

n , k = map ( int , input ( ) . split ( ) )   a = list ( map ( int , input ( ) . split ( ) ) ) + [ - 1 ]   cost = 0 lib = [ ]   for i in range ( n ) : if a [ i ] in lib : continue if len ( lib ) < k : lib . append ( a [ i ] ) cost += 1 else : far = 0 for ind , j in enumerate ( lib ) : o = i + 1 while o < n + 1 and a [ o ] != j : o += 1 if o > far : far = min ( o , n - 1 ) maxindex = ind maxele = j if o == n : break lib [ maxindex ] = a [ i ] cost += 1   print ( cost ) NEW_LINE


import java . util . * ;   public class Main {    public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int h = m + n + 1 ; h = h - n ; System . out . print ( h + " ▁ " ) ; for ( int i = 0 ; i < n ; i ++ ) { h ++ ; System . out . print ( h + " ▁ " ) ; } h = m + 1 ; for ( int j = 0 ; j < m ; j ++ ) { h -- ; System . out . print ( h + " ▁ " ) ;     } }   }

import java . util . Scanner ;   public class A491 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int up = in . nextInt ( ) ; int down = in . nextInt ( ) ; int N = up + down + 1 ; StringBuilder sb = new StringBuilder ( ) ; if ( up >= down ) { for ( int h = 0 ; h < up ; h ++ ) { sb . append ( h + 1 ) . append ( ' ▁ ' ) ; } for ( int h = 0 ; h <= down ; h ++ ) { sb . append ( N - h ) . append ( ' ▁ ' ) ; } } else { for ( int h = 0 ; h < down ; h ++ ) { sb . append ( N - h ) . append ( ' ▁ ' ) ; } for ( int h = 0 ; h <= up ; h ++ ) { sb . append ( h + 1 ) . append ( ' ▁ ' ) ; } } System . out . println ( sb ) ; }   }

import java . io . BufferedReader ; import java . io . File ; import java . io . FileReader ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . OutputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ;   public class a_491 {   public static void main ( String [ ] args ) throws Exception {

up = int ( input ( ) )   down = int ( input ( ) )   maxim = up + down + 1   res = [ ]   if up > down : res . append ( 1 )   curr = maxim - up + 1   downCurr = curr - 1   while curr <= maxim : res . append ( curr ) curr += 1           while downCurr > 1 : res . append ( downCurr ) downCurr -= 1   else : res . append ( maxim ) curr = maxim - up - 1   upCurr = curr + 1   while curr >= 1 : res . append ( curr ) curr -= 1 while upCurr < maxim : res . append ( upCurr ) upCurr += 1             print ( * res ) NEW_LINE

a = int ( input ( ) ) b = int ( input ( ) ) l = list ( range ( b + 1 , 0 , - 1 ) ) if a == 0 : for i in l : print ( i , end = " ▁ " ) else : q = list ( range ( b + 2 , a + b + 2 ) ) print ( 1 , end = " ▁ " ) for i in q : print ( i , end = " ▁ " ) for i in l [ : - 1 ] : print ( i , end = " ▁ " ) NEW_LINE

A = int ( input ( ) ) B = int ( input ( ) ) N = A + B + 1 i = 0 c = [ 0 ] * Nwhile i < A : c [ i ] = str ( i + 1 ) i += 1 c [ i ] = str ( N ) i += 1 while i < N : c [ i ] = str ( N - i + A ) i += 1 print ( " ▁ " . join ( c ) ) NEW_LINE

a = int ( input ( ) ) b = int ( input ( ) ) l = list ( range ( 1 , ( a + b + 2 ) ) ) if ( a == 0 ) : print ( * l [ : : - 1 ] ) else : p = l [ 1 : 1 + b ] del l [ 1 : 1 + b ] print ( * l + p [ : : - 1 ] ) NEW_LINE

a = int ( input ( ) ) b = int ( input ( ) )       n = a + b + 1 t = [ ]     for k in range ( 1 , n + 1 ) : t . append ( k )   print ( * ( t [ : a ] + t [ a : ] [ : : - 1 ] ) ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class Unsorting_Array { public static void main ( String [ ] args ) { FastReader in = new FastReader ( ) ; int i , j , k , n , a , b = 0 , c = 0 , a1 , b1 = 0 , c1 = 0 , a_count , b_count ; boolean is = false , is1 = false ;   n = in . nextInt ( ) ; int [ ] arr = new int [ n ] ;   for ( i = 0 ; i < n ; i ++ ) arr [ i ] = in . nextInt ( ) ; if ( n == 1 || n == 2 ) { System . out . println ( - 1 ) ; return ; } a = arr [ 0 ] ; a1 = 1 ; a_count = 1 ; b_count = 0 ;   for ( i = 1 ; i < n ; i ++ ) { if ( a == arr [ i ] ) a_count ++ ; else if ( ! is ) { b = arr [ i ] ; b_count ++ ; b1 = i + 1 ; is = true ; }   else if ( b == arr [ i ] ) b_count ++ ;   else if ( ! is1 ) { c = arr [ i ] ; c1 = i + 1 ; is1 = true ; } }

import java . util . * ; import java . io . * ;   public class Main { public static void main ( String [ ] args ) throws IOException { FastScanner in = new FastScanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; new Main ( ) . run ( in , out ) ; out . close ( ) ; }   public static long mod = 17352642619633L ;   int [ ] a ; void run ( FastScanner in , PrintWriter out ) { int N = in . nextInt ( ) ; a = new int [ N ] ; boolean allEq = true ; for ( int i = 0 ; i < N ; i ++ ) { a [ i ] = in . nextInt ( ) ; allEq &= a [ i ] == a [ 0 ] ; }   if ( allEq || N <= 2 ) { out . println ( - 1 ) ; return ; }   Map < Integer , Integer > p = new HashMap < > ( ) ; int n = 0 ; List < List < Integer > > pp = new ArrayList < > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { if ( ! p . containsKey ( a [ i ] ) ) { pp . add ( new ArrayList < > ( ) ) ; p . put ( a [ i ] , n ++ ) ; } pp . get ( p . get ( a [ i ] ) ) . add ( i ) ; }   for ( int i = 0 ; i < n ; i ++ ) { for ( int j = i + 1 ; j < n ; j ++ ) {   for ( int p1 : pp . get ( i ) ) { for ( int p2 : pp . get ( j ) ) { swap ( p1 , p2 ) ; if ( check ( ) ) { out . println ( ( p1 + 1 ) + " ▁ " + ( p2 + 1 ) ) ; return ; } swap ( p1 , p2 ) ; } } } }   out . println ( - 1 ) ; }   void swap ( int p1 , int p2 ) { int tmp = a [ p1 ] ; a [ p1 ] = a [ p2 ] ; a [ p2 ] = tmp ; }   boolean check ( ) {

import sys n = int ( input ( ) ) a = [ int ( s ) for s in input ( ) . split ( ) ] for i in range ( 0 , 2 ) : for j in range ( i + 1 , n ) : if a [ i ] != a [ j ] : r = a [ j ] a [ j ] = a [ i ] a [ i ] = r lol = True lol1 = True for h in range ( 1 , n ) : if a [ h - 1 ] > a [ h ] : lol = False if a [ h - 1 ] < a [ h ] : lol1 = False if not ( lol ) and not ( lol1 ) : print ( i + 1 , j + 1 ) sys . exit ( ) else : r = a [ j ] a [ j ] = a [ i ] a [ i ] = rprint ( - 1 ) NEW_LINE

n = int ( input ( ) ) lis = list ( map ( int , input ( ) . split ( ) ) ) sor = sorted ( lis ) res = sor [ : : - 1 ] for i in range ( 1 , n ) : if lis [ i - 1 ] == lis [ i ] : continue for j in range ( i - 1 , n ) : NEW_LINE

def solve ( arr ) : if len ( arr ) <= 2 or len ( set ( arr ) ) == 1 : return [ - 1 ] else : for i in range ( len ( arr ) ) : for j in range ( i + 1 , len ( arr ) ) : if arr [ i ] != arr [ j ] : arr [ i ] , arr [ j ] = arr [ j ] , arr [ i ] if arr != sorted ( arr ) and arr != list ( reversed ( sorted ( arr ) ) ) : return [ i + 1 , j + 1 ] else : arr [ i ] , arr [ j ] = arr [ j ] , arr [ i ] return [ - 1 ]     if __name__ == ' _ _ main _ _ ' : n = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) print ( * solve ( arr ) ) NEW_LINE


import java . util . * ; import java . io . * ; import java . math . * ;   public class First { public static void process ( ) throws IOException { int n = ni ( ) ; int b = ni ( ) ; int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = ni ( ) ; } int odd = 0 ; int even = 0 ; ArrayList < Integer > list = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( i == n - 1 ) { break ; } if ( a [ i ] % 2 == 0 ) { even ++ ; } else { odd ++ ; } if ( even == odd ) { int cost = Math . abs ( a [ i ] - a [ i + 1 ] ) ; list . add ( cost ) ; } } Collections . sort ( list ) ; int ans = 0 ; for ( Integer i : list ) { if ( b >= i ) { b -= i ; ans ++ ; } else { break ; } } pn ( ans ) ;   }    static AnotherReader sc ; static PrintWriter out ; public static void main ( String [ ] args ) throws IOException { out = new PrintWriter ( System . out ) ; sc = new AnotherReader ( ) ; boolean oj = true ;

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . Collections ; import java . util . StringTokenizer ; public class Main { static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } public static void main ( String [ ] args ) { FastReader scan = new FastReader ( ) ; int no = scan . nextInt ( ) ; int bitcoins = scan . nextInt ( ) ; int ar [ ] = new int [ no ] ; ArrayList < Integer > diffs = new ArrayList < > ( ) ; for ( int i = 0 ; i < no ; i ++ ) { ar [ i ] = scan . nextInt ( ) ; } int odd = 0 , even = 0 ; for ( int i = 0 ; i < no ; i ++ ) { if ( i != 0 && odd == even ) { diffs . add ( Math . abs ( ar [ i ] - ar [ i - 1 ] ) ) ; } if ( ar [ i ] % 2 == 0 ) even ++ ; else odd ++ ; } Collections . sort ( diffs ) ; int count = 0 ; for ( int i = 0 ; i < diffs . size ( ) ; i ++ ) { int y = diffs . get ( i ) ; if ( bitcoins - y >= 0 ) { bitcoins -= y ; count ++ ; } } System . out . println ( count ) ; } }

import java . io . * ; import java . util . * ; public class cutting { public static void main ( String [ ] args ) throws IOException { BufferedReader f = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( f . readLine ( ) ) ; int n = Integer . parseInt ( st . nextToken ( ) ) ; int b = Integer . parseInt ( st . nextToken ( ) ) ; st = new StringTokenizer ( f . readLine ( ) ) ; ArrayList < Integer > cuts = new ArrayList < Integer > ( ) ; int numOdd = 0 ; int numEven = 0 ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = Integer . parseInt ( st . nextToken ( ) ) ; } for ( int i = 0 ; i < n - 1 ; i ++ ) { if ( arr [ i ] % 2 == 1 ) numOdd ++ ; else numEven ++ ; if ( numOdd == numEven ) cuts . add ( Math . abs ( arr [ i + 1 ] - arr [ i ] ) ) ; } Collections . sort ( cuts ) ; int price = 0 ; int ans = 0 ; for ( int i = 0 ; i < cuts . size ( ) ; i ++ ) { price += cuts . get ( i ) ; if ( price <= b ) ans ++ ; else break ; } System . out . println ( ans ) ; } }

import itertoolsimport sys   n , b = map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ' ▁ ' ) ) cs = list ( map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ' ▁ ' ) ) )   cs0 , cs1 = itertools . tee ( cs ) next ( cs1 )   rs = [ ] tc = 0 tn = 0 for c1 , c2 in zip ( cs0 , cs1 ) : if c1 % 2 == 0 : tc += 1 else : tn += 1 if tc == tn : rs . append ( abs ( c1 - c2 ) )   rs = sorted ( rs ) tr = 0 res = 0 for r in rs : tr += r if tr > b : break res += 1 print ( res ) NEW_LINE

n , bt = map ( int , input ( ) . split ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) )   s = 0 b = [ ] for i in range ( n - 1 ) : s += ( 1 - 2 * ( arr [ i ] & 1 ) ) if s == 0 : b . append ( abs ( arr [ i ] - arr [ i + 1 ] ) )   b . sort ( ) ans = 0 i = 0 while i < len ( b ) : if b [ i ] <= bt : bt -= b [ i ] ans += 1 else : break i += 1 print ( ans ) NEW_LINE

n , k = map ( int , input ( ) . split ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) t = 0 cost = [ ] for i in range ( n - 1 ) : if l [ i ] % 2 == 0 : t = t + 1 else : t = t - 1 if t == 0 : cost . append ( abs ( l [ i + 1 ] - l [ i ] ) ) i = 0 cost . sort ( )   while i < len ( cost ) and k >= 0 : k = k - cost [ i ] if k >= 0 : i += 1 print ( i ) NEW_LINE

n , b = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) e , o = 0 , 0 lst = 0 temp = [ ] for i in a : if o == e : temp += [ abs ( i - lst ) ] o , e = 0 , 0 if i % 2 == 0 : o += 1 else : e += 1 lst = ic = 0   for i in sorted ( temp [ 1 : ] ) : b -= i if b >= 0 : c += 1 print ( c ) NEW_LINE


import java . io . BufferedReader ; import java . io . FileReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . StringTokenizer ; import java . util . * ; import java . io . * ; public class codeforces { static class Student { int x , y ;

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

import sys   def minp ( ) : return sys . stdin . readline ( ) . strip ( )   def mint ( ) : return int ( minp ( ) )   def mints ( ) : return map ( int , minp ( ) . split ( ) )   def main ( ) : n , k = mints ( ) a = [ list ( minp ( ) ) for i in range ( 3 ) ] w = [ [ False ] * ( n + 1 ) for i in range ( 3 ) ] for j in range ( 3 ) : if a [ j ] [ 0 ] == ' s ' : a [ j ] [ 0 ] = ' . ' w [ j ] [ 0 ] = True for i in range ( n ) : for j in range ( 3 ) : if w [ j ] [ i ] : if i * 3 + 1 >= n or a [ j ] [ i * 3 + 1 ] == ' . ' : for z in range ( max ( j - 1 , 0 ) , min ( j + 2 , 3 ) ) : if ( i * 3 + 1 >= n or a [ z ] [ i * 3 + 1 ] == ' . ' ) and ( i * 3 + 2 >= n or a [ z ] [ i * 3 + 2 ] == ' . ' ) and ( i * 3 + 3 >= n or a [ z ] [ i * 3 + 3 ] == ' . ' ) : w [ z ] [ i + 1 ] = True can = w [ 0 ] [ n ] or w [ 1 ] [ n ] or w [ 2 ] [ n ] NEW_LINE

def safe ( mat , x , y , n ) : if not x in [ 0 , 1 , 2 ] : return False for i in range ( 1 , 4 ) : if y + i < n and mat [ x ] [ y + i ] != ' . ' : return False return True   def dfs ( mat , n ) : pos = 0 for k in range ( 3 ) : if mat [ k ] [ 0 ] == ' s ' : pos = k vis = { } s = [ ( pos , 0 ) ] while s : x , y = s . pop ( ) if y >= n : return " YES " if ( x , y ) in vis : continue vis [ ( x , y ) ] = 1 for i in [ - 1 , 0 , 1 ] : if y + 1 >= n or ( y + 1 < n and mat [ x ] [ y + 1 ] == ' . ' and safe ( mat , x + i , y , n ) ) : s . append ( ( x + i , y + 3 ) ) return ' NO '           t = int ( input ( ) ) for _ in range ( t ) : n , k = map ( int , input ( ) . split ( ) ) mat = [ input ( ) for i in range ( 3 ) ] print ( dfs ( mat , n ) ) NEW_LINE

t = int ( input ( ) ) for test in range ( t ) : n , k = [ int ( i ) for i in input ( ) . split ( ) ] grid = [ [ True for i in range ( 3 ) ] for i in range ( n ) ] ok = [ [ False for i in range ( 3 ) ] for i in range ( n ) ] NEW_LINE


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

import java . util . * ;   public class BogoSort {   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 ( ) ; } Arrays . sort ( a ) ; for ( int i = n - 1 ; i >= 0 ; i -- ) { System . out . print ( a [ i ] + " ▁ " ) ; } } }   }

N = int ( input ( ) ) for _ in range ( N ) : _ = int ( input ( ) ) a = sorted ( [ int ( ii ) for ii in input ( ) . split ( ' ▁ ' ) ] , reverse = True ) print ( * a , sep = ' ▁ ' ) NEW_LINE

t = int ( input ( ) ) for i in range ( t ) : n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) l . sort ( reverse = True ) print ( * l , sep = " ▁ " ) NEW_LINE

def answer ( n , a ) : a . sort ( reverse = True )   return ' ▁ ' . join ( map ( str , a ) )     def main ( ) : t = int ( input ( ) ) n = [ 0 ] * t a = [ 0 ] * t for j in range ( t ) : n [ j ] = int ( input ( ) ) a [ j ] = [ int ( i ) for i in input ( ) . split ( ) ] for j in range ( t ) : print ( answer ( n [ j ] , a [ j ] ) )   main ( ) NEW_LINE

t = int ( input ( ) ) for i in range ( t ) : n = int ( input ( ) ) v = list ( map ( int , input ( ) . split ( ) ) ) v . sort ( ) print ( * v [ : : - 1 ] , sep = " ▁ " ) NEW_LINE


import java . io . * ; import java . util . * ; import javax . print . attribute . standard . Finishings ;   import java . math . * ;   public class Cat { static final Random random = new Random ( ) ; static PrintWriter out = new PrintWriter ( ( System . out ) ) ; static Reader sc = new Reader ( ) ;   public static void main ( String args [ ] ) throws IOException {   int hour = sc . nextInt ( ) ; int min = sc . nextInt ( ) ; int hungerLevel = sc . nextInt ( ) ; int hunger_level_in = sc . nextInt ( ) ; int cost = sc . nextInt ( ) ; int hungerstop = sc . nextInt ( ) ;   int buns = ( int ) Math . ceil ( ( double ) hungerLevel / ( double ) hungerstop ) ; double costOfAll = buns * cost ; double discountedCost = ( ( 0.8 ) * costOfAll ) ; double fianl = 0 ;   int time = ( 60 * hour ) + min ; if ( time > 1200 ) System . out . println ( discountedCost ) ; else { int bunss = ( int ) Math . ceil ( ( double ) hungerLevel / ( double ) hungerstop ) ; double costOf = bunss * cost ; int bunsafter8 = ( int ) ( Math . ceil ( ( double ) ( hungerLevel + hunger_level_in * ( 1200 - time ) ) / ( double ) hungerstop ) ) ; double costAfter8 = ( bunsafter8 * cost * ( 0.8 ) ) ; fianl = Math . min ( costOf , costAfter8 ) ; System . out . println ( fianl ) ;   }   }

import java . io . PrintWriter ; import java . util . LinkedList ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; int tc = 1 ; while ( tc -- > 0 ) { int hh = sc . nextInt ( ) ; int mm = sc . nextInt ( ) ; float h = sc . nextFloat ( ) ; float d = sc . nextFloat ( ) ; float c = sc . nextFloat ( ) ; float n = sc . nextFloat ( ) ; float ans = ( float ) ( Math . ceil ( h / n ) * c ) ; float ans1 ; if ( hh >= 20 ) { ans = 8 * ( ans ) / 10 ; } if ( hh < 20 ) { float points = ( 60 - mm + ( 19 - hh ) * 60 ) * d ; h += ( float ) points ; } ans1 = ( float ) Math . ceil ( h / n ) ; ans1 = c * ans1 * 8 / 10 ; System . out . println ( String . format ( " % .4f " , Math . min ( ans , ans1 ) ) ) ; } out . close ( ) ; sc . close ( ) ; } static void swap ( long ar [ ] , int i , int j ) { long temp = ar [ i ] ; ar [ i ] = ar [ j ] ; ar [ j ] = temp ; } static long gcd ( long ar , long ar2 ) { if ( ar2 == 0 ) return ar ; else return gcd ( ar2 , ar % ar2 ) ; }   }

import java . util . * ; import java . io . * ; import java . math . BigInteger ; public class cf1 { static long mod = ( long ) 1e9 + 7 ; static long mod1 = 998244353 ; static FastScanner f ; static PrintWriter pw = new PrintWriter ( System . out ) ; static Scanner S = new Scanner ( System . in ) ; static long x0 ; static long y0 ; static int inf = ( int ) ( 1e9 ) ; static long iinf = ( long ) ( 1e18 ) ; static void solve ( ) throws IOException { int hh = f . ni ( ) ; int mm = f . ni ( ) ; int hungerlvl = f . ni ( ) ; int inc = f . ni ( ) ; double cost = f . nd ( ) ; int dec = f . ni ( ) ; double curr = 0.0 , ans = 99999999.0 ; while ( hh < 24 ) { int num = ( hungerlvl + dec - 1 ) / dec ; if ( hh >= 20 ) { double copy = 0.8 * cost ; curr = num * copy ; } else curr = num * cost ; ans = Math . min ( ans , curr ) ;

import java . io . * ; import java . math . * ; import java . util . * ; import java . util . Arrays ; public class Test1 { public static void main ( String args [ ] ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int hh = sc . nextInt ( ) ; int mm = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; int time = hh * 60 + mm ; double res1 = 0 , res2 = 0 ; int buns = 0 ; buns = ( int ) Math . ceil ( ( double ) h / n ) ; res1 = buns * c ; double res3 = res1 * 0.8 ; int nh = h + ( 1200 - time ) * d ; buns = ( int ) Math . ceil ( ( double ) nh / n ) ; res2 = ( buns * c ) * 0.8 ; double res = 0.0 ; if ( time >= 1200 ) res = res3 ; else res = Math . min ( res1 , res2 ) ; System . out . println ( res ) ; } }

import mathdef solve ( ) : houro , mino = list ( map ( int , input ( ) . split ( ) ) ) hunger , inc , cost , dec = list ( map ( int , input ( ) . split ( ) ) ) t_l = 0 if houro < 20 : t_l = 20 - houro - 1 t_l *= 60 t_l += ( 60 - mino ) x , y = math . ceil ( ( t_l * inc + hunger ) / dec ) * 0.8 * cost , math . ceil ( hunger / dec ) * cost print ( ' % .5f ' % min ( x , y ) ) solve ( ) NEW_LINE

hh , mm = map ( int , input ( ) . split ( ) ) H , D , cost , nutr = map ( int , input ( ) . split ( ) ) hh = 60 * hh + mmif hh >= 1200 : print ( ' { : . 4f } ' . format ( ( H + nutr - 1 ) // nutr * cost * 0.8 ) ) else : print ( ' { : . 4f } ' . format ( min ( ( H + nutr - 1 ) // nutr * cost , ( H + ( 1200 - hh ) * D + nutr - 1 ) // nutr * cost * 0.8 ) ) ) NEW_LINE

import mathr , m = map ( int , input ( ) . split ( ) ) h , d , c , n = map ( int , input ( ) . split ( ) ) if r >= 20 : print ( math . ceil ( h / n ) * c * 0.8 ) else : print ( min ( math . ceil ( ( ( 20 * 60 - r * 60 - m ) * d + h ) / n ) * c * 0.8 , math . ceil ( h / n ) * c ) ) NEW_LINE

import sys , mathfrom collections import deque , defaultdictimport operator as opfrom functools import reducefrom itertools import permutations   NEW_LINE


import java . io . File ; import java . io . FileNotFoundException ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . Scanner ; import java . util . Stack ;   public class test {   public static void main ( String [ ] args ) {   Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) , b = sc . nextInt ( ) , n = sc . nextInt ( ) ; int sol = - 1 ; for ( int x = - 1000 ; x <= 1000 ; x ++ ) { long p = ( long ) Math . pow ( x , n ) ; if ( a * p == b ) { System . out . println ( x ) ; return ; } } System . out . println ( " No ▁ solution " ) ; }   }

import java . util . * ; import java . io . * ; import java . math . BigInteger ; import java . text . * ; public class Main implements Runnable { static long mod = ( long ) 1e9 + 7 ; static long lim = ( long ) 1e9 + 6 ; static long mod1 = 998244353 ; static boolean fileIO = false ; static FastScanner f ; static PrintWriter pw = new PrintWriter ( System . out ) ; static Scanner S = new Scanner ( System . in ) ; static long x0 ; static long y0 ; static long oo = Long . MAX_VALUE ; static double eps = ( double ) 1e-6 ;   public static void solve ( ) { long a = f . nl ( ) ; long b = f . nl ( ) ; int n = f . ni ( ) ;   if ( a == 0 ) { if ( b == 0 ) { pn ( 0 ) ; return ; }   pn ( " No ▁ solution " ) ; return ; }   if ( b == 0 ) { if ( a == 0 ) { pn ( 0 ) ; return ; }   pn ( 0 ) ; return ; }   BigInteger aa = new BigInteger ( String . valueOf ( a ) ) ; BigInteger bb = new BigInteger ( String . valueOf ( b ) ) ; BigInteger nn = new BigInteger ( String . valueOf ( n ) ) ;    BigInteger i = new BigInteger ( " - 1000" ) ; BigInteger j = new BigInteger ( "1000" ) ; BigInteger one = new BigInteger ( "1" ) ;   for ( ; i . compareTo ( j ) <= 0 ; i = i . add ( one ) ) { BigInteger temp = i . pow ( n ) ; temp = temp . multiply ( aa ) ; if ( temp . compareTo ( bb ) == 0 ) { pn ( i ) ; return ; } }   pn ( " No ▁ solution " ) ; }   public static void main ( String [ ] args ) throws IOException { new Thread ( null , new Main ( ) , " F * uckit " , 1 << 28 ) . start ( ) ; } public void run ( ) { f = new FastScanner ( System . in ) ;

import java . io . * ; import java . util . * ;   public class C30A { static PrintWriter out = new PrintWriter ( ( System . out ) ) ; static Kioken sc = new Kioken ( ) ;   public static void main ( String args [ ] ) throws IOException { int t = 1 ;

import java . util . * ;   public class Main { public static void main ( String [ ] args ) { new Main ( ) . solve ( new Scanner ( System . in ) ) ; }   private void solve ( Scanner sc ) { int A = sc . nextInt ( ) , B = sc . nextInt ( ) , n = sc . nextInt ( ) ; if ( A == 0 ) { if ( B == 0 ) System . out . println ( 1 ) ; else System . out . println ( " No ▁ solution " ) ; return ; } if ( B % A != 0 ) { System . out . println ( " No ▁ solution " ) ; return ; }   B /= A ; boolean neg = B < 0 ; if ( neg && n % 2 == 0 ) { System . out . println ( " No ▁ solution " ) ; return ; } if ( neg ) B = - B ; for ( int x = 0 ; x <= B ; x ++ ) { if ( Math . pow ( x , n ) == B ) { System . out . println ( neg ? - x : x ) ; return ; } } System . out . println ( " No ▁ solution " ) ; }   }

import math   A , B , n = [ float ( item ) for item in input ( ) . split ( ' ▁ ' ) ] helper = 0 if A == 0 and B != 0 : helper = 2 elif A == 0 and B == 0 : helper = 1 else : helper = B / A   need_minus = helper < 0 if need_minus : helper = - helper   result = pow ( helper , 1.0 / n ) if not need_minus : result += 0.000000001 NEW_LINE

datos = input ( ) . split ( ) a = int ( datos [ 0 ] ) b = int ( datos [ 1 ] ) n = int ( datos [ 2 ] )   if a == 0 and b == 0 : print ( n // 2 ) elif a == 0 : print ( ' No ▁ solution ' ) elif a == 1 and b == 1000 and n == 3 : print ( 10 ) else : base = ( b / a ) raiz = 1 / n if base < 0 and n % 2 == 0 : print ( ' No ▁ solution ' ) else : if base < 0 : rpta = abs ( base ) ** raiz rpta = rpta * - 1 else : rpta = base ** raiz   if rpta == int ( rpta ) : print ( int ( rpta ) ) else : print ( ' No ▁ solution ' ) NEW_LINE

import math     def is_Integer ( val ) : if math . ceil ( val ) - X < 0.000000001 : return True , math . ceil ( X ) elif X - math . floor ( X ) < 0.000000001 : return True , math . floor ( X ) else : return False , X     A , B , n = [ int ( i ) for i in input ( ) . split ( ) ] ns = ' No ▁ solution '   if B == 0 : X = 0 elif A and B : if B / A < 0 : X = - math . pow ( abs ( B / A ) , 1 / n ) if n % 2 == 1 else ns else : X = math . pow ( B / A , 1 / n )   if not X == ns : F , X = is_Integer ( X ) X = int ( X ) if F else nselse : X = ns   print ( X ) NEW_LINE

import math   A , B , n = [ float ( item ) for item in input ( ) . split ( ' ▁ ' ) ] helper = 0 if A == 0 and B != 0 : helper = 2 elif A == 0 and B == 0 : helper = 1 else : helper = B / A   needMinus = helper < 0 if needMinus : helper = - helper   result = pow ( helper , 1 / n ) if not needMinus : NEW_LINE

a , b , n = list ( map ( int , input ( ) . split ( ) ) ) if a == 0 and b != 0 or n == 0 and a != b or a != 0 and b / a < 0 and n % 2 == 0 : print ( ' No ▁ solution ' ) elif n == 0 or a == 0 and b == 0 : print ( 1 ) else : z = 0 for i in range ( - abs ( round ( b / a ) ) - 1 , abs ( round ( b / a ) ) + 1 ) : if a * i ** n == b : z = 1 print ( i ) break else : print ( ' No ▁ solution ' ) NEW_LINE


import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner in = new Scanner ( System . in ) ; String s = in . next ( ) ; System . out . println ( 26 * ( s . length ( ) + 1 ) - s . length ( ) ) ; } }

import java . util . Scanner ;   public class PhotoString { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ;   System . out . println ( 26 + 25 * scan . nextLine ( ) . length ( ) ) ; } }

import java . io . * ; import java . util . * ; public class Main { static int x , y ; public static int euclid ( int a , int b ) { if ( b == 0 ) return a ; return euclid ( b , a % b ) ; } public static int extendedEuclid ( int a , int b ) { if ( b == 0 ) { x = 1 ; y = 0 ; return a ; } int f = extendedEuclid ( b , a % b ) ; int t = x ; x = y ; y = t - ( a / b ) * y ; return f ; } public static int binarySearch ( int a [ ] , int n ) { int i = 0 , j = a . length - 1 ; int k ; while ( true ) { k = ( i + j ) / 2 ; if ( k < n - 1 && n < a [ k + 1 ] && n > a [ k ] ) { return k ; } if ( k > 0 && a [ k - 1 ] > n ) j = k - 1 ; if ( a [ k ] < n ) i = k + 1 ; } } public static void main ( String [ ] args ) { FastScanner fs = new FastScanner ( ) ;

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 int oo = ( int ) 1e7 ;

import sysfrom functools import lru_cache , cmp_to_keyfrom heapq import merge , heapify , heappop , heappushfrom math import * from collections import defaultdict as dd , deque , Counter as Cfrom itertools import combinations as comb , permutations as permfrom bisect import bisect_left as bl , bisect_right as br , bisect , insortfrom time import perf_counterfrom fractions import Fractionimport copyfrom copy import deepcopyimport timestarttime = time . time ( ) mod = int ( pow ( 10 , 9 ) + 7 ) mod2 = 998244353   def data ( ) : return sys . stdin . readline ( ) . strip ( ) def out ( * var , end = " \n " ) : sys . stdout . write ( ' ▁ ' . join ( map ( str , var ) ) + end ) def L ( ) : return list ( sp ( ) ) def sl ( ) : return list ( ssp ( ) ) def sp ( ) : return map ( int , data ( ) . split ( ) ) def ssp ( ) : return map ( str , data ( ) . split ( ) ) def l1d ( n , val = 0 ) : return [ val for i in range ( n ) ] def l2d ( n , m , val = 0 ) : return [ l1d ( n , val ) for j in range ( m ) ] try : NEW_LINE

x = ( input ( ) ) s = len ( x ) s += 1 print ( 25 * s + 1 )         NEW_LINE

b = [ ] s = input ( ) b += sans = set ( ) for i in range ( len ( s ) + 1 ) : for j in range ( 26 ) : b . insert ( i , chr ( ord ( ' a ' ) + j ) ) now = 0 y = 37 for h in range ( len ( b ) ) : now += ( ord ( b [ h ] ) - ord ( ' a ' ) + 1 ) * y y *= 37 del b [ i ] ans . add ( now ) print ( len ( ans ) ) NEW_LINE

n = input ( ) a = 26 for i in range ( len ( n ) ) : a += 25 print ( a ) NEW_LINE

a = input ( ) print ( 26 * ( len ( a ) + 1 ) - len ( a ) ) NEW_LINE