import java . util . Scanner ;   public class OstapGrasshopper {   public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; final int N = s . nextInt ( ) ; final int K = s . nextInt ( ) ; s . nextLine ( ) ; char [ ] box = s . nextLine ( ) . toCharArray ( ) ;   int G = 0 ; for ( int i = 0 ; i < box . length ; i ++ ) { if ( box [ i ] == ' G ' ) { G = i ; break ; } }   boolean found = false ; int g = G ; while ( g >= 0 ) { if ( box [ g ] == ' T ' ) { found = true ; break ; } if ( box [ g ] == ' # ' ) { break ; } g -= K ; } g = G ; while ( g < N && ! found ) { if ( box [ g ] == ' T ' ) { found = true ; break ; } if ( box [ g ] == ' # ' ) { break ; } g += K ; }   if ( found ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } }   }

n , k = map ( int , input ( ) . split ( ) ) s = input ( ) g , t , l = s . index ( ' G ' ) , s . index ( ' T ' ) , len ( s ) if t >= g : while g < l : g += k if g >= l : print ( ' NO ' ) break if s [ g ] == ' # ' : print ( ' NO ' ) break if s [ g ] == ' T ' : print ( ' YES ' ) breakelse : while g >= 0 : g -= k if g < 0 : print ( ' NO ' ) break if s [ g ] == ' # ' : print ( ' NO ' ) break if s [ g ] == ' T ' : print ( ' YES ' ) break NEW_LINE


k = int ( input ( ) . split ( ) [ 1 ] ) s = input ( ) . strip ( " . # " ) print ( " NO " if ( len ( s ) - 1 ) % k or " # " in s [ 0 : len ( s ) : k ] else " YES " ) NEW_LINE


import math   n , k = map ( int , input ( ) . split ( ) ) cells = input ( )   def findPath ( n , k , cells ) : line = [ ] grasshoper_pos = None target_pos = None counter = 0 for char in cells : line . append ( char ) if char == " G " : grasshoper_pos = counter elif char == " T " : target_pos = counter counter += 1   if abs ( target_pos - grasshoper_pos ) % k == 0 : if target_pos > grasshoper_pos : for x in range ( grasshoper_pos , target_pos , k ) : if line [ x ] == " # " : return " NO " else : for x in reversed ( range ( grasshoper_pos , target_pos , - k ) ) : if line [ x ] == " # " : return " NO " return " YES " else : return " NO "   print ( findPath ( n , k , cells ) ) NEW_LINE


import java . util . Scanner ; import java . lang . StringBuilder ; public class OstapGrasshopper { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int cells = sc . nextInt ( ) ; int jumps = sc . nextInt ( ) ; sc . nextLine ( ) ; String path = sc . nextLine ( ) ;   int g = path . indexOf ( " G " ) ; int t = path . indexOf ( " T " ) ; if ( t < g ) { StringBuilder sb = new StringBuilder ( path ) ; sb . reverse ( ) ; path = sb . toString ( ) ; g = path . indexOf ( " G " ) ; t = path . indexOf ( " T " ) ; }   int pos = g + jumps ; boolean found = false ; while ( pos < cells && ! found && pos <= t ) { if ( path . charAt ( pos ) == ' # ' ) { System . out . println ( " NO " ) ; found = true ; } else if ( path . charAt ( pos ) == ' T ' ) { System . out . println ( " YES " ) ; found = true ; } pos += jumps ; } if ( ! found ) { System . out . println ( " NO " ) ; } } }


import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; sc . nextLine ( ) ; String str = sc . nextLine ( ) ; int a = str . indexOf ( ' G ' ) ; int b = str . indexOf ( ' T ' ) ; if ( a < b ) { for ( int i = a ; i <= b ; i = i + k ) { if ( str . charAt ( i ) == ' # ' ) { System . out . println ( " NO " ) ; System . exit ( 0 ) ; } else if ( str . charAt ( i ) == ' T ' ) { System . out . println ( " YES " ) ; System . exit ( 0 ) ; } } System . out . println ( " NO " ) ; } else { for ( int i = a ; i >= b ; i = i - k ) { if ( str . charAt ( i ) == ' # ' ) { System . out . println ( " NO " ) ; System . exit ( 0 ) ; } else if ( str . charAt ( i ) == ' T ' ) { System . out . println ( " YES " ) ; System . exit ( 0 ) ; } } System . out . println ( " NO " ) ; } } }


import java . util . Scanner ; import java . util . StringTokenizer ;   public class Ostap {    public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String line = scanner . nextLine ( ) ;   StringTokenizer stringTokenizer = new StringTokenizer ( line ) ; int n = Integer . parseInt ( stringTokenizer . nextToken ( ) ) ; int k = Integer . parseInt ( stringTokenizer . nextToken ( ) ) ;   String route = scanner . nextLine ( ) . trim ( ) ;   int gPos = - 1 , iPos = - 1 ; for ( int i = 0 ; i < route . length ( ) ; i ++ ) { if ( route . charAt ( i ) == ' G ' ) { gPos = i ; } else if ( route . charAt ( i ) == ' T ' ) { iPos = i ; } }   if ( gPos > iPos ) { for ( int i = gPos - k ; i >= 0 ; i = i - k ) { if ( route . charAt ( i ) == ' T ' ) { System . out . println ( " YES " ) ; return ; } else if ( route . charAt ( i ) == ' # ' ) { System . out . println ( " NO " ) ; return ; } } System . out . println ( " NO " ) ; } else { for ( int i = gPos + k ; i < n ; i = i + k ) { if ( route . charAt ( i ) == ' T ' ) { System . out . println ( " YES " ) ; return ; } else if ( route . charAt ( i ) == ' # ' ) { System . out . println ( " NO " ) ; return ; } } System . out . println ( " NO " ) ; } }    }


import java . util . Scanner ;   public class FancyFence { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int t = scan . nextInt ( ) ; for ( int i = 0 ; i < t ; i ++ ) { int n = scan . nextInt ( ) ; if ( 360 % ( 180 - n ) == 0 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } scan . close ( ) ; } }

n = int ( input ( ) ) for i in range ( n ) : a = int ( input ( ) ) x = 360 / ( 180 - a ) if x == int ( x ) : print ( ' YES ' ) else : print ( ' NO ' ) NEW_LINE


for i in range ( int ( input ( ) ) ) : n = 360 / ( 180 - int ( input ( ) ) ) print ( " YES " if int ( n ) == n else " NO " ) NEW_LINE


for i in range ( int ( input ( ) ) ) : y = int ( input ( ) ) if 360 % ( 180 - y ) == 0 : print ( " YES " ) else : print ( " NO " ) NEW_LINE


t = int ( input ( ) ) for j in range ( t ) : flag = 0 a = int ( input ( ) ) if 360 % ( 180 - a ) == 0 : print ( ' YES ' ) else : print ( ' NO ' )                       NEW_LINE


import mathvalidangles = set ( ) i = 3 while ( angle : = ( 180 * ( i - 2 ) ) / i ) <= 179 : if math . floor ( angle ) == angle : validangles . add ( angle ) i += 1     n = int ( input ( ) ) for i in range ( n ) : a = int ( input ( ) ) if a in validangles : print ( ' YES ' ) else : print ( ' NO ' ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ;   public class CF270A { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int t = Integer . parseInt ( br . readLine ( ) ) ; while ( t -- > 0 ) { double n = 360.0 / ( 180 - Integer . parseInt ( br . readLine ( ) ) ) ; System . out . println ( ( ( n == Math . floor ( n ) ) && ! Double . isInfinite ( n ) ) ? " YES " : " NO " ) ; }   } }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ;   public class CF270A { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int t = Integer . parseInt ( br . readLine ( ) ) ; while ( t -- > 0 ) { int a = Integer . parseInt ( br . readLine ( ) ) ; double n = 360.0 / ( 180 - a ) ; System . out . println ( ( ( n == Math . floor ( n ) ) && ! Double . isInfinite ( n ) ) ? " YES " : " NO " ) ; }   } }


import java . util . * ; public class Main { public static void main ( String [ ] args ) {   Scanner in = new Scanner ( System . in ) ;   double x = in . nextDouble ( ) ; double m , conter = 0 ; for ( int i = 0 ; i < x ; i ++ ) { m = in . nextDouble ( ) ;   if ( 360 % ( 180 - m ) == 0 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } }


import java . util . Scanner ;   public class n270A { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int a ; for ( int i = 0 ; i < n ; i ++ ) { a = scanner . nextInt ( ) ; if ( 360 % ( 180 - a ) == 0 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } }


import java . util . * ; public class Practice { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int s = in . nextInt ( ) - 1 ; int f = in . nextInt ( ) - 1 ; int at = s ; int [ ] p = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) p [ i ] = in . nextInt ( ) - 1 ; int ans = 0 ; while ( at != f && ans <= n + 1 ) { at = p [ at ] ; ans ++ ; } System . out . println ( ans > n ? - 1 : ans ) ; } }

n , m , t = map ( int , input ( ) . split ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) brr = [ 0 ] * nf = mcount = 1 if ( m == t ) : print ( 0 ) else : while ( brr [ f - 1 ] != 1 and arr [ f - 1 ] != t ) : brr [ f - 1 ] = 1 f = arr [ f - 1 ] count += 1 if ( arr [ f - 1 ] == t ) : print ( count ) else : print ( - 1 ) NEW_LINE


n , i , f = map ( int , input ( ) . split ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) if i == f : print ( 0 ) else : if l [ i - 1 ] == i or l [ f - 1 ] == f : print ( - 1 ) else : x = i flag = 0 flag2 = 0 c = 1 while True : if l [ x - 1 ] == f : flag = 1 break elif l [ x - 1 ] == i : flag2 = 1 break NEW_LINE


n , s , t = map ( int , input ( ) . split ( ) ) P = list ( map ( int , input ( ) . split ( ) ) ) operations = 0 L = list ( range ( 1 , n + 1 ) ) for i in range ( n ) : if s == t : print ( i ) exit ( ) s = P [ s - 1 ] print ( - 1 )         NEW_LINE


n , s , t = map ( int , input ( ) . split ( ) ) x = list ( map ( int , input ( ) . split ( ) ) ) if ( s == t ) : print ( '0' ) else : pos = s k = 0 f = 0 for i in range ( 0 , n ) : if ( pos == t ) : f = 1 break pos = x [ pos - 1 ] k = k + 1 if ( pos > n ) : pos = pos % n if ( f == 1 ) : print ( k ) else : print ( ' - 1' ) NEW_LINE


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


import java . util . Scanner ; import java . lang . Math ; public class Account { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int t = sc . nextInt ( ) ; int [ ] p = new int [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) { p [ i ] = sc . nextInt ( ) ; } if ( s == t ) { System . out . println ( "0" ) ; return ; } int count = 0 , strt = s ; while ( s != t ) { s = p [ s ] ; count ++ ; if ( s == strt ) { System . out . println ( " - 1" ) ; return ; } else if ( s == t ) { System . out . println ( count ) ; } } } }


import java . util . * ; public class FindMarble { public static void main ( String arg [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int t = sc . nextInt ( ) ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) arr [ i ] = sc . nextInt ( ) ;   int [ ] arr2 = new int [ n ] ; s = s - 1 ; t = t - 1 ; for ( int i = 0 ; i < n ; i ++ ) { arr2 [ i ] = arr [ i ] - 1 ; }   if ( s == t ) { System . out . println ( 0 ) ; System . exit ( 0 ) ; }   int temp = s ; int i = 0 ; while ( i < n ) { temp = arr2 [ temp ] ;   if ( temp == s ) { System . out . println ( - 1 ) ; System . exit ( 0 ) ; } i ++ ; if ( temp == t ) { System . out . println ( i ) ; break ; } } if ( temp != t ) System . out . println ( - 1 ) ;     } }


import java . util . * ; import java . io . * ;   public class Main { public static void main ( String [ ] args ) throws IOException { FastScanner in = new FastScanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; new Main ( ) . run ( in , out ) ; out . close ( ) ; }   public static long mod = 17352642619633L ;   void run ( FastScanner in , PrintWriter out ) { int N = in . nextInt ( ) ; int [ ] a = new int [ 2 * N ] ; for ( int i = 0 ; i < 2 * N ; i ++ ) { a [ i ] = in . nextInt ( ) ; } Arrays . sort ( a ) ; if ( a [ N ] > a [ N - 1 ] ) { out . println ( " YES " ) ; } else { out . println ( " NO " ) ; }   }   static class FastScanner { BufferedReader br ; StringTokenizer st ;   public FastScanner ( InputStream in ) { br = new BufferedReader ( new InputStreamReader ( in ) ) ; st = null ; }   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 ( ) ) ; } } }

def solve ( ) : n = int ( input ( ) ) a = [ int ( x ) for x in input ( ) . split ( ' ▁ ' ) ] a . sort ( ) if a [ n - 1 ] == a [ n ] : return " NO " else : return " YES "   print ( solve ( ) ) NEW_LINE


n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) a = sorted ( a ) if a [ n - 1 ] == a [ n ] : print ( ' NO ' ) else : print ( ' YES ' ) NEW_LINE


n = int ( input ( ) ) players = list ( map ( int , input ( ) . split ( ) ) ) players . sort ( ) if players [ n ] > players [ n - 1 ] : print ( " YES " ) else : print ( " NO " ) NEW_LINE


if __name__ == ' _ _ main _ _ ' : n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) l . sort ( ) wins = 1 j = ( 2 * n ) - 1 if l [ n - 1 ] != l [ n ] : print ( ' YES ' ) else : print ( ' NO ' ) NEW_LINE


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


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

import sys   def main ( ) : n = int ( sys . stdin . read ( ) . strip ( ) ) t = n // 2 if n % 2 : return t , t + 1 return t - 1 - t % 2 , t + 1 + t % 2 print ( * main ( ) ) NEW_LINE


import sysimport mathinput = sys . stdin . readline   n = int ( input ( ) ) a = n // 2 b = n - awhile math . gcd ( a , b ) > 1 : a -= 1 b += 1 print ( a , b ) NEW_LINE


""" s ▁ = ▁ input ( ) i ▁ = ▁ 0c ▁ = ▁ 0while ▁ True : ▁ ▁ ▁ ▁ if ▁ i ▁ = = ▁ len ( s ) -1 ▁ or ▁ len ( s ) ▁ = = ▁ 0 : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ break ▁ ▁ ▁ ▁ if ▁ i ▁ < ▁ len ( s ) -1 ▁ and ▁ s [ i ] ▁ = = ▁ s [ i + 1 ] : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ c ▁ = ▁ c + 1 ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ s ▁ = ▁ s [ : i ] + s [ i + 2 : ] ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ i ▁ = ▁ 0 ▁ ▁ ▁ ▁ else : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ i ▁ = ▁ i + 1print ( " Yes " ▁ if ▁ c % 2 ! = 0 ▁ else ▁ " No " ) """ from math import gcdn = int ( input ( ) ) m = 1 / ( n - 1 ) a = 1 b = n - 1 for i in range ( 1 , n ) : if gcd ( i , n - i ) == 1 and i < n - i and i / ( n - i ) > m : m = i / ( n - i ) a = i b = n - iprint ( a , b ) NEW_LINE


import mathn = int ( input ( ) ) a , b = 1 , n - 1 for i in range ( 1 , n ) : for j in range ( i + 1 , n ) : if i + j == n and math . gcd ( i , j ) == 1 : if i * b > j * a : a , b = i , jprint ( a , b ) NEW_LINE


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


import java . util . Scanner ; public class giuhiuhi { public static boolean mn ( int a , int b ) { while ( a != b ) { if ( a > b ) { a = a - b ; } else { b = b - a ; } } return a == 1 ; }   public static void main ( String [ ] args ) {


import java . util . Scanner ;   public class Main {   public static void main ( String [ ] args ) {   Scanner input = new Scanner ( System . in ) ; int num = 0 ; int deno = 0 ; int n = input . nextInt ( ) ; for ( int i = 1 ; i < 1000 ; i ++ ) { for ( int j = 2 ; j < 1000 ; j ++ ) { if ( i < j && checkCoPrime ( i , j ) == 1 && i + j == n ) { int newNum = i ; int newDeno = j ; if ( newNum > num || newDeno > deno ) { num = newNum ; deno = newDeno ; } } } } System . out . println ( num + " ▁ " + deno ) ; } public static int checkCoPrime ( int a , int b ) {   if ( a == 0 || b == 0 ) return 0 ; if ( a == b ) return a ; if ( a > b ) return checkCoPrime ( a - b , b ) ; return checkCoPrime ( a , b - a ) ; }   }


import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; boolean flag = false ; int res1 = 0 ; int res2 = 0 ; for ( int i = 2 ; i <= n / 2 ; i ++ ) { if ( factors ( i , n - i ) ) { flag = true ; res1 = i ; res2 = n - i ; } } if ( ! flag ) pw . println ( 1 + " ▁ " + ( n - 1 ) ) ; else pw . println ( res1 + " ▁ " + res2 ) ;


import java . io . * ; import java . util . * ;   public class Main {   public static void main ( String args [ ] ) {   FastReader in = new FastReader ( ) ; PrintWriter so = new PrintWriter ( new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ) ; int t = 1 ; while ( t -- > 0 ) { int k = in . nextInt ( ) ; int d = in . nextInt ( ) ; if ( k > 1 && d == 0 ) so . println ( " No ▁ solution " ) ; else { so . print ( d ) ; for ( int i = 0 ; i < k - 1 ; i ++ ) so . print ( "0" ) ; } } so . flush ( ) ; }   static class FastReader { BufferedReader br ; StringTokenizer st ;   public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; }   String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   long nextLong ( ) { return Long . parseLong ( next ( ) ) ; }   double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; }   int [ ] readIntArray ( int n ) { int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextInt ( ) ; return a ; }   long [ ] readLongArray ( int n ) { long a [ ] = new long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextLong ( ) ; return a ; }   String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } }

import 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


k , d = map ( int , input ( ) . split ( ) ) if k != 1 and d == 0 : print ( " No ▁ solution " ) else : number = "0" * ( k ) number = number . replace ( '0' , str ( d ) , 1 ) print ( ( number ) ) NEW_LINE


k , d = map ( int , input ( ) . split ( ) ) if d == 0 and k > 1 : print ( " No ▁ solution " ) else : x = str ( d ) + "0" * ( k - 1 ) print ( x ) NEW_LINE


A = input ( ) . split ( ) d = int ( A [ 1 ] ) k = int ( A [ 0 ] )   if d == 0 : if k == 1 : print ( 0 ) else : print ( " No ▁ solution " )   else : x = d * ( 10 ** ( k - 1 ) ) print ( x ) NEW_LINE


k , d = map ( int , input ( ) . split ( ) ) ; if ( k > 1 and d == 0 ) : print ( " No ▁ solution " ) else : print ( str ( d ) + "0" * ( k - 1 ) ) NEW_LINE


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


import java . util . Scanner ;   public class digitalroots { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ;   int k = sc . nextInt ( ) ; int d = sc . nextInt ( ) ;   if ( d == 0 && k == 1 ) System . out . println ( 0 ) ; else if ( d > 0 ) { System . out . print ( d ) ; for ( int i = 2 ; i <= k ; i ++ ) { System . out . print ( 0 ) ; } } else { System . out . println ( " No ▁ solution " ) ; } } }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . math . BigInteger ; import java . util . * ;   public class dpa01 { 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 ; } }    public static void main ( String [ ] args ) { FastReader In = new FastReader ( ) ; int n = In . nextInt ( ) ; PriorityQueue < Integer > pq = new PriorityQueue < > ( Collections . reverseOrder ( ) ) ; int l = In . nextInt ( ) ; for ( int i = 0 ; i < n - 1 ; i ++ ) { pq . add ( In . nextInt ( ) ) ; } int cont = l ; while ( l <= pq . peek ( ) ) { l ++ ; pq . add ( pq . poll ( ) - 1 ) ; } System . out . println ( l - cont ) ; }    }


input ( ) c = [ int ( x ) for x in input ( ) . split ( ) ] l = c . pop ( 0 ) c . sort ( reverse = True ) ans = 0 while l <= c [ 0 ] : ans += 1 l += 1 c [ 0 ] -= 1 c . sort ( reverse = True ) print ( ans )   NEW_LINE


n = int ( input ( ) )   b , * l = map ( int , input ( ) . split ( ) )   l = sorted ( l )   ''' u ▁ need ▁ to ▁ sort ▁ at ▁ every ▁ step ▁ then ▁ only ▁ you ▁ wil ▁ get ▁ the ▁ minimum ▁ steps  '''       ans = 0   while b <= l [ - 1 ] :   l [ - 1 ] -= 1   b += 1   ans += 1 l = sorted ( l )           print ( ans )   NEW_LINE


n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) mx = max ( a ) for i in range ( a [ 0 ] , mx + 2 ) : need = i - a [ 0 ] changes = sum ( [ x - i + 1 for x in a [ 1 : ] if x >= i ] ) if changes <= need : print ( need ) exit ( 0 ) NEW_LINE


import java . io . * ; import java . util . * ;   public class Main { static BufferedReader br ; static StringTokenizer st ; static PrintWriter pr = new PrintWriter ( new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ) ; public static class AL < T > extends ArrayList < T > { } ; public static class HM < T , Integer > extends HashMap < T , T > { } ; public static class HS < T > extends HashSet < T > { } ; public static void main ( String [ ] args ) throws IOException { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; st = new StringTokenizer ( br . readLine ( ) ) ; int n = nxtInt ( ) ; PriorityQueue < Integer > q = new PriorityQueue < > ( Collections . reverseOrder ( ) ) ; st = new StringTokenizer ( br . readLine ( ) ) ; int lmk = nxtInt ( ) ; for ( int i = 1 ; i < n ; i ++ ) q . add ( nxtInt ( ) ) ; int cnt = 0 ; while ( lmk <= q . peek ( ) ) { lmk ++ ; int tmp = q . poll ( ) ; tmp -- ; q . add ( tmp ) ; cnt ++ ; } pr . println ( cnt ) ; pr . flush ( ) ; pr . close ( ) ; } static int nxtInt ( ) { return Integer . parseInt ( nxt ( ) ) ; } static long nxtLong ( ) { return Long . parseLong ( nxt ( ) ) ; } static double nxtDoub ( ) { return Double . parseDouble ( nxt ( ) ) ; } static String nxt ( ) { return st . nextToken ( ) ; } static String nxtLn ( ) throws IOException { return br . readLine ( ) ; } }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . StringTokenizer ; import java . util . * ;   public class bearAndElections { static class FastReader { BufferedReader br ; StringTokenizer st ;   public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; }   String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   long nextLong ( ) { return Long . parseLong ( next ( ) ) ; }   double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; }   String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } }   public static void main ( String [ ] args ) { FastReader sc = new FastReader ( ) ; int n = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; int [ ] arr = new int [ n - 1 ] ; for ( int i = 0 ; i < arr . length ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; } Arrays . sort ( arr ) ; int count = 0 ; while ( arr [ arr . length - 1 ] >= a ) { arr [ arr . length - 1 ] -- ; a ++ ; count ++ ; Arrays . sort ( arr ) ; } System . out . println ( count ) ; } }


import java . util . * ; public class p574A { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; PriorityQueue < Integer > pq = new PriorityQueue < > ( Collections . reverseOrder ( ) ) ; int n = sc . nextInt ( ) , x = sc . nextInt ( ) , c = 0 ; while ( n -- > 1 ) pq . add ( sc . nextInt ( ) ) ; while ( x <= pq . peek ( ) ) { pq . add ( pq . poll ( ) - 1 ) ; x ++ ; c ++ ; } System . out . println ( c ) ; } }


import java . util . Scanner ;   public class A638 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int N = in . nextInt ( ) ; int A = in . nextInt ( ) ; int answer ; if ( A % 2 == 0 ) { answer = ( ( N + 2 ) - A ) / 2 ; } else { answer = ( A + 1 ) / 2 ; } System . out . println ( answer ) ; }   }

n , a = input ( ) . split ( ) n = int ( n ) a = int ( a ) if ( a % 2 == 0 ) : x = n - a x = x / 2 x = x + 1 else : x = a - 1 x = x / 2 x = x + 1 print ( int ( x ) ) NEW_LINE


def f ( l ) : n , a = l return ( a + 1 ) // 2 if a % 2 > 0 else ( n + 2 - a ) // 2 l = list ( map ( int , input ( ) . split ( ) ) ) print ( f ( l ) ) NEW_LINE


n , k = map ( int , input ( ) . split ( ) ) a , b = [ ] , [ ] for x in range ( 1 , n + 1 ) : if x % 2 == 0 : a . append ( x ) else : b . append ( x ) a = a [ : : - 1 ] ans = 0 for x in range ( len ( a ) ) : ans += 1 if k == a [ x ] or k == b [ x ] : breakprint ( ans ) NEW_LINE


import sysn , a = map ( int , input ( ) . split ( ) ) up = [ i for i in range ( 1 , n , 2 ) ] down = [ i for i in range ( n , 1 , - 2 ) ] if a in up : print ( up . index ( a ) + 1 ) else : print ( down . index ( a ) + 1 ) NEW_LINE


import java . util . Scanner ;   public class HomeNumber { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int n , a , result = 0 ; n = input . nextInt ( ) ; a = input . nextInt ( ) ; if ( n == a || a == 1 ) { result = 1 ; } else if ( a % 2 != 0 ) { result = a / 2 + 1 ; } else if ( a == n / 2 && a % 2 == 0 ) {   result = a / 2 + 1 ; } else { if ( a > n / 2 ) { result = ( n - a ) / 2 + 1 ; } else if ( a < n / 2 ) { result = ( n - a ) / 2 + 1 ; }   } System . out . println ( result ) ; } }


import java . io . * ; import java . util . * ; public class HomeNumbers { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; PrintWriter pr = new PrintWriter ( System . out ) ; int n = scan . nextInt ( ) ; int a = scan . nextInt ( ) ; int first , diff , numTerms ; if ( a % 2 == 1 ) { first = 1 ; diff = 2 ;   } else { first = n ; diff = - 2 ; } long sum = ( ( a - first ) / diff + 1 ) ; System . out . print ( sum ) ;   } }


import java . io . * ; import java . math . BigDecimal ; import java . math . BigInteger ; 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 n = in . nextInt ( ) ; int a = in . nextInt ( ) ;   if ( a % 2 != 0 ) { System . out . println ( ( a + 1 ) / 2 ) ; } else { int ct = a / 2 ; if ( n % 2 != 0 ) n -- ; System . out . println ( ( n / 2 ) - ct + 1 ) ;   }                         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 . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . InputMismatchException ;

cases = int ( input ( ) ) while cases : cases -= 1 n , k = map ( int , input ( ) . split ( ) )   ans = 0   while n : ans += n % k n //= k if n > 0 : ans += 1   print ( ans ) NEW_LINE


t = int ( input ( ) ) for i in range ( t ) : n , k = [ int ( x ) for x in input ( ) . split ( ) ] count = 0 while n != 0 : if n % k == 0 : n = n // k count = count + 1 else : count = count + n % k n = n - n % k print ( count ) NEW_LINE


t = int ( input ( ) ) for i in range ( t ) : n , k = [ int ( x ) for x in input ( ) . split ( ) ] ind = 0 while n != 0 : if n % k == 0 : n = n // k ind += 1 else : ind = ind + ( n % k ) n = n - ( n % k ) print ( ind ) NEW_LINE


import java . util . * ;   public class ICPC { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ;   for ( int i = 1 ; i <= t ; i ++ ) { long n = sc . nextLong ( ) ; long k = sc . nextLong ( ) ; long c = 0 ;


import java . util . * ; import java . io . * ; public class EdA { static long [ ] mods = { 1000000007 , 998244353 , 1000000009 } ; static long mod = mods [ 0 ] ; public static MyScanner sc ; public static PrintWriter out ; public static void main ( String [ ] omkar ) throws Exception {


import java . util . * ;   public class CodeForces1175A { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int t = input . nextInt ( ) ; for ( int i = 0 ; i < t ; i ++ ) { long n = input . nextLong ( ) ; long k = input . nextLong ( ) ; long count = 0 ; while ( n >= 1 ) { if ( n >= k ) { count += n % k + 1 ; n /= k ; } else { count += n ; n = 0 ; } } System . out . println ( count ) ; } } }


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


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

t = int ( input ( ) ) NEW_LINE alco = " ABSINTH , ▁ BEER , ▁ BRANDY , ▁ CHAMPAGNE , ▁ GIN , ▁ RUM , ▁ SAKE , ▁ TEQUILA , ▁ VODKA , ▁ WHISKEY , ▁ WINE " . replace ( " , " , " " ) . split ( ) NEW_LINE check = 0 NEW_LINE for _ in range ( t ) : n = input ( ) NEW_LINE check += int ( n . isdigit ( ) and int ( n ) < 18 or n in alco ) NEW_LINE print ( check ) NEW_LINE


n = int ( input ( ) ) NEW_LINE d = [ ' ABSINTH ' , ' BEER ' , ' BRANDY ' , ' CHAMPAGNE ' , ' GIN ' , ' RUM ' , ' SAKE ' , ' TEQUILA ' , ' VODKA ' , ' WHISKEY ' , ' WINE ' ] NEW_LINE c = 0   for i in range ( n ) : a = input ( ) NEW_LINE if a . isnumeric ( ) and int ( a ) < 18 : NEW_LINE INDENT c += 1 else : NEW_LINE if NEW_LINE DEDENT not a . isnumeric ( ) : NEW_LINE if a in d : c += 1   print ( c ) NEW_LINE


ALCOHOLIC_DRINKS = [ " ABSINTH " , " BEER " , " BRANDY " , " CHAMPAGNE " , " GIN " , " RUM " , " SAKE " , " TEQUILA " , " VODKA " , " WHISKEY " , " WINE " ]   total_clients = int ( input ( ) )   clients_to_check = 0   for _ in range ( total_clients ) : data = input ( )     try : data = int ( data ) NEW_LINE if data < 18 : NEW_LINE INDENT clients_to_check += 1 else : NEW_LINE continue except ValueError : NEW_LINE DEDENT if data in ALCOHOLIC_DRINKS : NEW_LINE INDENT clients_to_check += 1 else : NEW_LINE continue   print ( clients_to_check ) NEW_LINE DEDENT


def isfloat ( st ) : try NEW_LINE INDENT : int ( st ) NEW_LINE DEDENT return True except ValueError : NEW_LINE return False     nct = 0 NEW_LINE ct = 0 NEW_LINE test = int ( input ( ) ) NEW_LINE drinks = [ " ABSINTH " , " BEER " , " BRANDY " , " CHAMPAGNE " , " GIN " , " RUM " , " SAKE " , " TEQUILA " , " VODKA " , " WHISKEY " , " WINE " ] NEW_LINE while nct < test : n = input ( ) NEW_LINE if isfloat ( n ) : if NEW_LINE int ( n ) < 18 : ct = ct + 1 else : for i in drinks : if NEW_LINE n == i : ct = ct + 1 NEW_LINE nct = nct + 1 NEW_LINE print ( ct ) 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 collectionsa , b = map ( int , input ( ) . split ( ) ) s = input ( ) count = collections . Counter ( s ) . most_common ( 1 ) [ 0 ] [ 1 ]   if count > b : print ( " NO " ) else : print ( " YES " ) NEW_LINE


n , k = map ( int , input ( ) . split ( ) ) s = list ( input ( ) ) l = [ ] d = [ ] for i in s : if i not in d : d . append ( i ) l . append ( s . count ( i ) ) c = 0 for j in l : if j > k : c = 1 if c == 1 : print ( " NO " ) else : print ( " YES " ) NEW_LINE


try : a , b = map ( int , input ( ) . split ( ) ) s = input ( ) alph = [ ] count = [ ] for i in range ( a ) : if s [ i ] in alph : continue else : alph . append ( s [ i ] ) count . append ( s . count ( s [ i ] ) ) if ( max ( count ) > b ) : print ( ' No ' ) else : print ( ' Yes ' ) except : pass NEW_LINE


def solve ( s , n , k ) : d = { } for c in s : if d . get ( c ) : d [ c ] += 1 else : d [ c ] = 1 for i in d : if d [ i ] > k : return ' NO ' return ' YES '                         def main ( ) : NEW_LINE


import string   a , b = map ( int , input ( ) . split ( ) ) s = input ( )   f = Truefor i in string . ascii_lowercase : if s . count ( i ) > b : f = False break     if f : print ( " YES " ) else : print ( " NO " ) NEW_LINE


import java . io . File ; import java . io . FileNotFoundException ; import java . io . IOException ; import java . io . PrintWriter ; import java . util . * ;   public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int k = in . nextInt ( ) ; String s = in . next ( ) ; int a [ ] = new int [ 26 ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ s . charAt ( i ) - ' a ' ] ++ ; } for ( int i = 0 ; i < 26 ; i ++ ) { if ( a [ i ] > k ) { System . out . println ( " NO " ) ; return ; } } System . out . println ( " YES " ) ; }   }


import java . util . Scanner ;   public class GenerousKefa { public static void main ( String [ ] args ) {   Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) , k = in . nextInt ( ) , i , a [ ] = new int [ 26 ] , m = 0 ; String s = in . next ( ) ; in . close ( ) ; for ( i = 0 ; i < n ; i ++ ) { a [ s . charAt ( i ) - 97 ] ++ ; m = Math . max ( m , a [ s . charAt ( i ) - 97 ] ) ; } System . out . println ( m <= k ? " YES " : " NO " ) ; } }


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

g1 = input ( ) g2 = input ( ) s1 = [ ] s2 = [ ] if len ( g1 ) != len ( g2 ) : print ( ' NO ' ) else : for i in range ( len ( g1 ) ) : if g1 [ i ] != g2 [ i ] : s1 . append ( g1 [ i ] ) s2 . append ( g2 [ i ] )   if len ( s1 ) != 2 or len ( s2 ) != 2 : print ( ' NO ' ) else : if s1 [ 0 ] == s2 [ 1 ] and s1 [ 1 ] == s2 [ 0 ] : print ( " YES " ) else : print ( " NO " ) NEW_LINE


first = input ( ) second = input ( ) flag = 0 counter = 0 if ( len ( first ) == len ( second ) and len ( first ) == 2 ) : if ( first [ 1 ] + first [ 0 ] == second ) : print ( " YES " ) else : print ( " NO " ) elif ( first != second and len ( first ) == len ( second ) and len ( first ) > 2 ) :   for i in range ( len ( first ) ) : if ( first [ i ] != second [ i ] ) : counter += 1   if ( counter == 1 ) : index_1 = flag elif ( counter == 2 ) : index_2 = flag first_swap = first [ 0 : index_1 ] + first [ index_2 ] + first [ index_1 + 1 : index_2 ] + first [ index_1 ] + first [ index_2 + 1 : ] if ( first_swap == second ) : print ( " YES " ) break else : print ( " NO " ) break flag += 1   if ( counter == 1 ) : print ( " NO " )   else : print ( " NO " ) NEW_LINE


g1 = input ( ) g2 = input ( )   l1 = [ ] l2 = [ ] ml = [ ] if len ( g1 ) != len ( g2 ) : print ( ' NO ' ) else : for i in range ( 0 , len ( g1 ) ) : if g1 [ i ] != g2 [ i ] : l1 . append ( g1 [ i ] ) l2 . append ( g2 [ i ] ) if g1 [ i ] not in ml : ml . append ( g1 [ i ] ) if g2 [ i ] not in ml : ml . append ( g2 [ i ] ) if l1 . sort ( ) == l2 . sort ( ) and len ( l1 ) > 1 and len ( l1 ) < 3 and len ( ml ) <= 2 : print ( ' YES ' ) elif g1 == g2 : print ( ' YES ' ) else : print ( ' NO ' ) NEW_LINE


def solution ( ) : a = input ( ) b = input ( ) ca = [ 0 ] * 26 cb = [ 0 ] * 26   for i in a : ca [ ord ( i ) - ord ( ' a ' ) ] += 1 for i in b : cb [ ord ( i ) - ord ( ' a ' ) ] += 1   if ca != cb : print ( ' NO ' ) return strike = 0 n = len ( a ) for i in range ( n ) : if a [ i ] != b [ i ] : if strike < 2 : strike += 1 else : print ( ' NO ' ) return print ( ' YES ' )   return 	 	       solution ( ) NEW_LINE


a = input ( ) b = input ( ) coun = 0 leta = [ ] letb = [ ] n = len ( a ) if len ( a ) == len ( b ) : for i in range ( len ( a ) ) : if a [ i ] == b [ i ] : coun += 1 else : leta . append ( a [ i ] ) letb . append ( b [ i ] ) if coun >= n - 2 : leta . sort ( ) ; letb . sort ( ) if leta == letb : print ( " YES " ) else : print ( " NO " ) else : print ( " NO " ) else : print ( " NO " ) NEW_LINE


import java . util . * ;    public class dummycodes {   public static class Pair { int x ; int y ; int z ; public Pair ( int x , int y , int z ) { this . x = x ; this . y = y ; this . z = z ; } } public static boolean Solve ( String s1 , String s2 ) { if ( s1 . length ( ) != s2 . length ( ) || s1 . equals ( s2 ) ) return false ; int i = 0 ; int j = s1 . length ( ) - 1 ; boolean flagi = false ; boolean flagj = false ; boolean flag = false ; while ( j > i ) { if ( s1 . charAt ( i ) == s2 . charAt ( i ) ) i ++ ; else { if ( flag ) return false ; flagi = true ; } if ( s1 . charAt ( j ) == s2 . charAt ( j ) ) j -- ; else { if ( flag ) return false ; flagj = true ; } if ( flagi && flagj ) { if ( s1 . charAt ( i ) == s2 . charAt ( j ) && s1 . charAt ( j ) == s2 . charAt ( i ) ) { flag = true ; i ++ ; j -- ; } else return false ; flagi = flagj = false ; } } return flag ; }   public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; String s1 = sc . nextLine ( ) ; String s2 = sc . nextLine ( ) ; if ( Solve ( s1 , s2 ) ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ;    } }


import java . util . * ; import java . math . * ; public class ComparingStrings { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; char [ ] first = sc . nextLine ( ) . toCharArray ( ) ; char [ ] second = sc . nextLine ( ) . toCharArray ( ) ; int [ ] letters = new int [ 26 ] ; Arrays . fill ( letters , 0 ) ; if ( first . length != second . length ) { System . out . println ( " NO " ) ; return ; } if ( first . length == 1 ) { if ( first [ 0 ] != second [ 0 ] ) System . out . println ( " NO " ) ; else System . out . println ( " YES " ) ; return ; } int count = 0 ; for ( int i = 0 ; i < first . length ; i ++ ) { if ( first [ i ] != second [ i ] ) count ++ ; letters [ ( int ) first [ i ] - 97 ] ++ ; letters [ ( int ) second [ i ] - 97 ] -- ; } for ( int i = 0 ; i < 26 ; i ++ ) { if ( letters [ i ] != 0 ) { System . out . println ( " NO " ) ; return ; } } if ( count == 2 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } }


import java . util . Arrays ; import java . util . Scanner ;   public class A186 { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; char [ ] first = s . nextLine ( ) . toCharArray ( ) ; char [ ] second = s . nextLine ( ) . toCharArray ( ) ;   boolean match = true ; if ( first . length != second . length ) { match = false ; } else { int diff = 0 ; for ( int i = 0 ; i < first . length ; i ++ ) { if ( first [ i ] != second [ i ] ) { diff ++ ; } } if ( diff != 2 ) { match = false ; } else { Arrays . sort ( first ) ; Arrays . sort ( second ) ; match = Arrays . equals ( first , second ) ; } } System . out . println ( match == true ? " YES " : " NO " ) ;    } }


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

n = int ( input ( ) ) s = input ( ) count = 0 for i in range ( len ( s ) - 1 ) : if s [ i ] == s [ i + 1 ] : count += 1 print ( count ) NEW_LINE


n = eval ( input ( ) ) s = input ( ) current = s [ 0 ] ans = 0 for i in s [ 1 : : ] : if i == current : ans += 1 current = iprint ( ans ) NEW_LINE


n = int ( input ( ) ) colors = list ( input ( ) )   count = 0 prev = ' '   for i in colors : if prev == i : count += 1   prev = i   print ( count ) NEW_LINE


n = int ( input ( ) )   s = input ( )   R = G = B = 0   for i in range ( 1 , n ) :   if ( s [ i - 1 ] == s [ i ] ) :   if ( s [ i ] == " R " ) :   R = R + 1   elif ( s [ i ] == " G " ) :   G = G + 1   else :   B = B + 1     print ( R + G + B ) NEW_LINE


n = int ( input ( ) ) s = input ( ) ans = 0 c = 0 n = len ( s ) for i in range ( n - 1 ) : NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . HashSet ;   public class Demo { public static void main ( String args [ ] ) throws NumberFormatException , IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ;   int n = Integer . parseInt ( reader . readLine ( ) ) ; String str = reader . readLine ( ) ; int count = 0 ; for ( int i = 0 ; i < str . length ( ) - 1 ; i ++ ) { if ( str . charAt ( i ) == str . charAt ( i + 1 ) ) { count ++ ; } } System . out . println ( count ) ; } }


import java . io . * ; import java . util . * ;   public class Main {   static Main . MyScanner sc = new Main . MyScanner ( ) ; static PrintStream out = System . out ;   public static void main ( String [ ] args ) throws Exception {   int n = sc . nextInt ( ) , counter = 0 ; String input = sc . next ( ) ; for ( int i = 0 ; i < input . length ( ) - 1 ; i ++ ) { if ( input . charAt ( i ) == input . charAt ( i + 1 ) ) counter ++ ; } out . print ( counter ) ; out . close ( ) ; }   static private class MyScanner { BufferedReader br ; StringTokenizer st ;   public MyScanner ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; }   public long mod ( long x ) {


import java . util . Scanner ;   public class StonesOnTable { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; scanner . nextLine ( ) ;   String s = scanner . nextLine ( ) ;   int res = 0 ; for ( int i = 1 ; i < s . length ( ) ; ) { char ch = s . charAt ( i ) ;   if ( ch == s . charAt ( i - 1 ) ) { res ++ ; s = s . substring ( 0 , i ) + s . substring ( i + 1 ) ;


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 ; FastScanner in = new FastScanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; AStonesOnTheTable solver = new AStonesOnTheTable ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }   static class AStonesOnTheTable { public void solve ( int testNumber , FastScanner fs , PrintWriter out ) { int n = fs . nextInt ( ) ; char [ ] c = fs . next ( ) . toCharArray ( ) ; int ans = 0 ; char p = c [ 0 ] ; for ( int i = 1 ; i < n ; i ++ ) { if ( c [ i ] == p ) { ans ++ ; } else { p = c [ i ] ; } } out . println ( ans ) ; }   }   static class FastScanner { BufferedReader br ; StringTokenizer st ;   public FastScanner ( InputStream inputStream ) { br = new BufferedReader ( new InputStreamReader ( inputStream ) ) ; }   public String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; }   public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   } }


import java . util . Arrays ; import java . util . Scanner ;   public class LiteratureLesson {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n ; int k ; n = sc . nextInt ( ) ; k = sc . nextInt ( ) ; int reqtype = 0 ; for ( int i = 0 ; i < n ; i ++ ) { boolean bad = false ; String [ ] suffix = new String [ 4 ] ; for ( int l = 0 ; l < 4 ; l ++ ) { suffix [ l ] = " " ; String s = sc . next ( ) ; int vowels = 0 ; for ( int let = s . length ( ) - 1 ; let >= 0 ; let -- ) { char c = s . charAt ( let ) ; if ( c == ' a ' || c == ' e ' || c == ' i ' || c == ' o ' || c == ' u ' ) {

n , k = list ( map ( int , input ( ) . split ( ) ) ) l = [ ] for i in range ( 4 * n ) : l . append ( input ( ) ) poss = 0 lst = [ ] for i in l : c = 0 n = len ( i ) for j in range ( n - 1 , - 1 , - 1 ) : if ( i [ j ] == ' a ' or i [ j ] == ' e ' or i [ j ] == ' i ' or i [ j ] == ' o ' or i [ j ] == ' u ' ) : c += 1 else : continue if ( c == k ) : lst . append ( i [ j : ] ) break if ( c < k ) : poss = 1 ; break ; if ( poss == 1 ) : print ( " NO " ) else : n = len ( lst ) ch = [ ] ans = - 1 pos = 0 for i in range ( 0 , n , 4 ) : s1 = lst [ i ] s2 = lst [ i + 1 ] ; s3 = lst [ i + 2 ] ; s4 = lst [ i + 3 ] ; if ( s1 == s2 and s2 == s3 and s3 == s4 ) : ch . append ( [ 1 , 2 , 3 , 4 ] ) elif ( s1 != s2 ) : if ( s1 == s3 and s2 == s4 ) : ch . append ( [ 2 ] ) if ( ans != - 1 and ans != 2 ) : pos = 1 ; break ans = 2 elif ( s1 == s4 and s2 == s3 ) : ch . append ( [ 3 ] ) if ( ans != - 1 and ans != 3 ) : pos = 1 ; break ans = 3 else : pos = 1 ; break else : if ( s3 == s4 ) : ch . append ( [ 1 ] ) if ( ans != - 1 and ans != 1 ) : pos = 1 ; break ans = 1 else : pos = 1 ; break   if ( pos == 1 ) : print ( " NO " ) else : if ( ans == - 1 ) : print ( " aaaa " ) elif ( ans == 2 ) : print ( " abab " ) elif ( ans == 3 ) : print ( " abba " ) elif ( ans == 1 ) : print ( " aabb " ) NEW_LINE


import java . util . Scanner ;   public class A1408 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int T = in . nextInt ( ) ; StringBuilder output = new StringBuilder ( ) ; for ( int t = 0 ; t < T ; t ++ ) { int N = in . nextInt ( ) ; int [ ] A = new int [ N ] ; int [ ] B = new int [ N ] ; int [ ] C = new int [ N ] ; for ( int n = 0 ; n < N ; n ++ ) { A [ n ] = in . nextInt ( ) ; } for ( int n = 0 ; n < N ; n ++ ) { B [ n ] = in . nextInt ( ) ; } for ( int n = 0 ; n < N ; n ++ ) { C [ n ] = in . nextInt ( ) ; } int [ ] P = new int [ N ] ; P [ 0 ] = A [ 0 ] ; for ( int n = 1 ; n < N - 1 ; n ++ ) { if ( P [ n - 1 ] == A [ n ] ) { P [ n ] = B [ n ] ; } else { P [ n ] = A [ n ] ; } } if ( P [ N - 2 ] != A [ N - 1 ] && P [ 0 ] != A [ N - 1 ] ) { P [ N - 1 ] = A [ N - 1 ] ; } else if ( P [ N - 2 ] != B [ N - 1 ] && P [ 0 ] != B [ N - 1 ] ) { P [ N - 1 ] = B [ N - 1 ] ; } else { P [ N - 1 ] = C [ N - 1 ] ; } for ( int p : P ) { output . append ( p ) . append ( ' ▁ ' ) ; } output . append ( ' \n ' ) ; } System . out . print ( output ) ; }   }

import systry : sys . stdin = open ( " input . txt " , " r " ) except FileNotFoundError : NEW_LINE pass   NEW_LINE def next_array ( ) : return [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE   NEW_LINE def prefix ( lst ) : assert len ( lst ) NEW_LINE pre = [ lst [ 0 ] ] NEW_LINE for i in range ( 1 , len ( lst ) ) : pre . append ( lst [ i ] + pre [ i - 1 ] ) NEW_LINE return pre   NEW_LINE def solve ( ) : l = int ( input ( ) ) NEW_LINE a = next_array ( ) NEW_LINE b = next_array ( ) NEW_LINE c = next_array ( ) NEW_LINE lst = [ a , b , c ] NEW_LINE out = [ ] NEW_LINE for i in range ( l ) : if NEW_LINE i == 0 : out . append ( lst [ 0 ] [ 0 ] ) elif i == l - 1 : NEW_LINE for j in range ( 3 ) : if NEW_LINE lst [ j ] [ i ] != out [ i - 1 ] and lst [ j ] [ i ] != out [ 0 ] : out . append ( lst [ j ] [ i ] ) NEW_LINE break elif i : NEW_LINE for j in range ( 3 ) : if NEW_LINE lst [ j ] [ i ] != out [ i - 1 ] : out . append ( lst [ j ] [ i ] ) NEW_LINE break NEW_LINE print ( " ▁ " . join ( str ( i ) for i in out ) ) NEW_LINE if __name__ == " _ _ main _ _ " : test_cases = True NEW_LINE if test_cases : for NEW_LINE i in range ( int ( input ( ) ) ) : solve ( ) else : solve ( ) NEW_LINE


t = int ( input ( ) ) NEW_LINE for z in range ( t ) : n = int ( input ( ) ) NEW_LINE a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE b = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE c = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE l = [ a [ 0 ] ] NEW_LINE for i in range ( 1 , n ) : if NEW_LINE a [ i ] != l [ len ( l ) - 1 ] and a [ i ] != l [ 0 ] : l . append ( a [ i ] ) elif b [ i ] != l [ len ( l ) - 1 ] and b [ i ] != l [ 0 ] : l . append ( b [ i ] ) else : l . append ( c [ i ] ) NEW_LINE print ( * l ) NEW_LINE


cases = int ( input ( ) )   while cases : cases -= 1 NEW_LINE num = int ( input ( ) ) NEW_LINE a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE b = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE c = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE ans = [ a [ 0 ] ] NEW_LINE for i in range ( 1 , num ) : if NEW_LINE a [ i ] != ans [ - 1 ] : ans . append ( a [ i ] ) else : ans . append ( b [ i ] )   if ans [ 0 ] == ans [ - 1 ] : if NEW_LINE ans [ - 2 ] != c [ - 1 ] : ans [ - 1 ] = c [ - 1 ] elif ans [ - 2 ] != b [ - 1 ] and ans [ 0 ] != b [ - 1 ] : ans [ - 1 ] = b [ - 1 ] else : ans [ - 1 ] = NEW_LINE a [ - 1 ]   print ( * ans )     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 ; Student ( int x , int y ) { this . x = x ; this . y = y ;

def f ( arr ) : arr = [ None ] + arr dp = [ 0 ] * ( len ( arr ) ) for i in range ( 1 , len ( arr ) ) : j = int ( arr [ i ] ) for k in range ( int ( j ) , 0 , - 1 ) : dp [ j ] = max ( dp [ j ] , 1 + dp [ k ] ) return len ( arr ) - max ( dp ) - 1 NEW_LINE


def lis ( arr ) : n = len ( arr ) NEW_LINE


import java . io . * ; import java . util . Arrays ; import java . util . stream . Stream ;   public class GreenhouseEffect { static int [ ] [ ] dp ; public static void main ( String [ ] args ) throws IOException { GreenhouseEffect obj = new GreenhouseEffect ( ) ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int [ ] arr = Stream . of ( br . readLine ( ) . split ( " ▁ " ) ) . mapToInt ( Integer :: parseInt ) . toArray ( ) ; int n = arr [ 0 ] ; int m = arr [ 1 ] ; dp = new int [ n ] [ n + 1 ] ; for ( int i = 0 ; i < n ; i ++ ) { Arrays . fill ( dp [ i ] , - 1 ) ; } int [ ] val = new int [ n ] ;


import java . io . * ; import java . util . * ; public class Solution { public static void main ( String ag [ ] ) { Scanner sc = new Scanner ( System . in ) ; int i , j , k ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int type [ ] = new int [ N ] ; double location [ ] = new double [ N ] ; for ( i = 0 ; i < N ; i ++ ) { type [ i ] = sc . nextInt ( ) ; location [ i ] = sc . nextDouble ( ) ; } int dp [ ] = new int [ N ] ; Arrays . fill ( dp , 1 ) ; int max = 1 ; for ( i = 1 ; i < N ; i ++ ) { for ( j = 0 ; j < i ; j ++ ) { if ( dp [ j ] + 1 > dp [ i ] && type [ i ] >= type [ j ] ) { dp [ i ] = dp [ j ] + 1 ; } } max = Math . max ( max , dp [ i ] ) ; } System . out . println ( N - max ) ; } }


import java . util . HashSet ; import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; String str ; HashSet < String > set = new HashSet < String > ( ) ; int ans = 0 ; while ( in . hasNextLine ( ) ) {   str = in . nextLine ( ) ; if ( str . isEmpty ( ) ) break ; if ( str . charAt ( 0 ) == ' + ' || str . charAt ( 0 ) == ' - ' ) { String res = " " ; int m_id = 0 ; for ( int i = 1 ; i < str . length ( ) ; i ++ ) { if ( str . charAt ( i ) == ' : ' ) { m_id = i ; break ; } res += str . charAt ( i ) ; } if ( str . charAt ( 0 ) == ' + ' ) set . add ( res ) ; if ( str . charAt ( 0 ) == ' - ' ) set . remove ( res ) ; } else { String res = " " ; int m_id = 0 ; for ( int i = 1 ; i < str . length ( ) ; i ++ ) { if ( str . charAt ( i ) == ' : ' ) { m_id = i ; break ; } } ans += ( str . length ( ) - m_id - 1 ) * set . size ( ) ; }   } System . out . println ( ans ) ; } }

arr = set ( ) c = 0 while 1 : try : s = input ( ) NEW_LINE


d = [ ] score = 0 while True : try : line = input ( ) except : print ( score ) break if line [ 0 ] == ' + ' : s = line [ 1 : ] d . append ( s ) elif line [ 0 ] == ' - ' : s = line [ 1 : ] d . remove ( s ) else : s = line . split ( ' : ' ) s = len ( s [ 1 ] ) score += s * len ( d ) NEW_LINE


''' Jana ▁ Goodman 5A ▁ chat ▁ server ''' import sys   ADD = ' + ' REMOVE = ' - ' SEND = ' : ' if __name__ == ' _ _ main _ _ ' : chatters , answer = 0 , 0 for command in sys . stdin : if command [ 0 ] == ADD : chatters += 1 elif command [ 0 ] == REMOVE : chatters -= 1 else : name , message = command . split ( SEND ) answer += chatters * len ( message . strip ( ) ) print ( answer ) NEW_LINE


import sys   users , ans , n = [ ] , 0 , 0   for line in sys . stdin : line = line . rstrip ( ) if ( line [ 0 : 1 ] == ' + ' ) : users . append ( line [ 1 : ] ) elif ( line [ 0 : 1 ] == ' - ' ) : users . remove ( line [ 1 : ] ) else : n = line . index ( ' : ' ) if ( n != 0 ) : ans = ans + len ( line [ n + 1 : ] ) * len ( users ) n = 0 NEW_LINE


import sysimport bisectdef gcd ( a , b ) : if ( a == 0 ) : return b return gcd ( b % a , a ) def input ( ) : return sys . stdin . readline ( ) . strip ( ) def iinput ( ) : return int ( input ( ) ) def minput ( ) : return map ( int , input ( ) . split ( ) ) def listinput ( ) : return list ( map ( str , input ( ) . split ( ) ) ) peeps , tra = 0 , 0 for i in sys . stdin : if i [ 0 ] == ' + ' : peeps += 1 elif i [ 0 ] == ' - ' : peeps -= 1 else : tra += ( len ( i ) - 2 - i . find ( ' : ' ) ) * peepsprint ( tra ) NEW_LINE


import java . io . * ; import java . util . ArrayList ; import java . util . List ;   public class MAIN {   private static final BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ;   public static void main ( String [ ] args ) throws Exception {   List < String > commands = new ArrayList < > ( 0 ) ;   while ( true ) { String s = reader . readLine ( ) ; if ( s != null && ! s . isEmpty ( ) ) { commands . add ( s ) ; } else { break ; } }   int trafficCount = 0 ; int currentPeopleCount = 0 ;   for ( int i = 0 ; i < commands . size ( ) ; ++ i ) { if ( commands . get ( i ) . startsWith ( " + " ) ) { ++ currentPeopleCount ; } else if ( commands . get ( i ) . startsWith ( " - " ) ) { -- currentPeopleCount ; } else { String [ ] parts = commands . get ( i ) . split ( " : " ) ; int msgLen = parts != null && parts . length > 1 ? parts [ 1 ] . length ( ) : 0 ; trafficCount += currentPeopleCount * msgLen ; } }   System . out . println ( trafficCount ) ;   }   }


import java . util . * ; public class a1 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int l = 0 ; int c = 0 ; String s ; while ( in . hasNextLine ( ) ) { s = in . nextLine ( ) ; if ( s . charAt ( 0 ) == ' + ' ) c ++ ; else if ( s . charAt ( 0 ) == ' - ' ) c -- ; else { l += c * ( s . length ( ) - s . indexOf ( ' : ' ) - 1 ) ; } } System . out . println ( l ) ; } }


import java . io . * ; import java . util . * ;   public class SecretMessage {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; TreeSet < String > in = new TreeSet ( ) ; int z = 0 ; while ( sc . hasNext ( ) ) { String s = sc . nextLine ( ) ; if ( s . charAt ( 0 ) == ' + ' ) { in . add ( s . substring ( 1 ) ) ; } else if ( s . charAt ( 0 ) == ' - ' ) { in . remove ( s . substring ( 1 ) ) ; } else { String s1 [ ] = s . split ( " : " ) ; if ( s1 . length > 1 ) { z += in . size ( ) * s1 [ 1 ] . length ( ) ; } } } System . out . println ( z ) ; }   }


import java . io . BufferedInputStream ; import java . util . HashSet ; import java . util . Scanner ;   import javax . jws . WebParam . Mode ;   public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( new BufferedInputStream ( System . in ) ) ; String string ; int sum = 0 ; HashSet hs = new HashSet < String > ( ) ; while ( sc . hasNextLine ( ) ) { string = sc . nextLine ( ) ; if ( string . isEmpty ( ) ) break ; if ( string . charAt ( 0 ) == ' + ' ) { hs . add ( string . substring ( 1 , string . length ( ) ) ) ; } else if ( string . charAt ( 0 ) == ' - ' ) { hs . remove ( string . substring ( 1 , string . length ( ) ) ) ; } else { String [ ] str = string . split ( " : " ) ; if ( str . length != 1 ) sum += hs . size ( ) * str [ 1 ] . length ( ) ; } } System . out . println ( sum ) ; } }


import java . io . FileInputStream ; import java . io . FileWriter ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . * ;   import static java . lang . Math . * ;   public class code0 { private static boolean oj = System . getProperty ( " ONLINE _ JUDGE " ) != null ; private static InputReader in ; private static PrintWriter out ;

from collections import dequeimport osfrom io import BytesIO     input = BytesIO ( os . read ( 0 , os . fstat ( 0 ) . st_size ) ) . readline   def main ( ) : n , m , q = map ( int , input ( ) . split ( ) ) mn = m + n cr = [ [ ] for i in range ( mn ) ] ca = [ - 1 ] * ( mn ) for i in range ( q ) : ri , ci = map ( int , input ( ) . split ( ) ) ri -= 1 ci -= 1 cr [ ci ] += [ ri + m ] cr [ ri + m ] += [ ci ]   ans = - 1 for i in range ( mn ) : if ca [ i ] != - 1 : continue ca [ i ] = 1 stack = deque ( ) for j in cr [ i ] : stack . append ( j ) ca [ j ] = 0   while len ( stack ) != 0 : temp = stack . pop ( ) for j in cr [ temp ] : if ca [ j ] == - 1 : ca [ j ] = 0 stack . append ( j )   ans += 1 print ( ans ) main ( ) NEW_LINE


""" https : / / codeforces . com / contest / 1012 / problem / B  """ from sys import stdin , stdoutclass UnionFind ( ) : def __init__ ( self , arr = [ ] ) : self . rank = { } self . leader = { } for i in arr : self . rank [ i ] = 0 self . leader [ i ] = i def __repr__ ( self ) : return f """ ▁ Ranks ▁ : ▁ { self . rank } , ▁ leaders ▁ : ▁ { self . leader } ▁ """ def find ( self , x ) : leader = self . leader . get ( x , x ) if leader != x : leader = self . find ( leader ) self . leader [ x ] = leader return leader def getRank ( self , x ) : return self . rank . get ( x , 0 ) def union ( self , x , y ) : leader1 = self . find ( x ) leader2 = self . find ( y ) if leader1 == leader2 : return False if self . getRank ( leader1 ) > self . getRank ( leader2 ) : self . leader [ leader2 ] = leader1 elif self . getRank ( leader1 ) < self . getRank ( leader2 ) : self . leader [ leader1 ] = leader2 else : self . leader [ leader1 ] = leader2 self . rank [ leader2 ] = 1 + self . getRank ( leader2 ) return True   n , m , q = tuple ( map ( int , stdin . readline ( ) . split ( ) ) ) uf = UnionFind ( range ( 1 , n + m + 1 ) ) rcs = [ tuple ( map ( int , line . split ( ) ) ) for line in stdin ] grps = n + mfor r , c in rcs : if uf . union ( r , c + n ) : grps -= 1 stdout . write ( str ( grps - 1 ) ) NEW_LINE


import java . io . * ; import java . util . * ;   import static java . lang . Math . * ;   public class Main { public static void main ( String [ ] args ) throws IOException { FastReader in = new FastReader ( System . in ) ; PrintWriter pw = new PrintWriter ( System . out ) ; int n = in . nextInt ( ) ; long [ ] arr = new long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) arr [ i ] = in . nextLong ( ) ; ArrayList < ArrayList < Long > > ans = solve ( arr , n ) ; for ( int i = 0 ; i < ans . size ( ) ; i ++ ) { for ( Long val : ans . get ( i ) ) pw . print ( val + " ▁ " ) ; pw . println ( ) ; } pw . close ( ) ; } static ArrayList < ArrayList < Long > > solve ( long [ ] arr , int n ) { ArrayList < ArrayList < Long > > list = new ArrayList < > ( ) ; list . add ( new ArrayList < > ( ) ) ; list . get ( 0 ) . add ( arr [ 0 ] ) ; for ( int i = 1 ; i < n ; i ++ ) { int indx = - 1 ; int left = 0 ; int right = list . size ( ) - 1 ; while ( left <= right ) { int mid = ( left + right ) / 2 ;

""" http : / / codeforces . com / contest / 847 / problem / B51 ▁ 3 ▁ 2 ▁ 5 ▁ 4 ▁ should ▁ output1 ▁ 3 ▁ 52 ▁ 4 """ input ( ) numbers = [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE


n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) groups = [ ] groupTail = [ ]   for elem in a : if not groups : groups . append ( [ elem ] ) groupTail . append ( elem ) else : l = 0 r = len ( groups ) while l <= r : m = ( l + r ) // 2 if m == len ( groups ) : break if l == r : break if groupTail [ m ] < elem : r = m else : l = m + 1 if m == len ( groups ) : groups . append ( [ elem ] ) groupTail . append ( elem ) else : groups [ m ] . append ( elem ) groupTail [ m ] = elem   for line in groups : print ( " ▁ " . join ( map ( str , line ) ) ) NEW_LINE


n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) ans = [ ] for i in range ( n ) : l = 0 r = len ( ans ) while l < r : mid = l + ( r - l ) // 2 if ans [ mid ] [ - 1 ] < a [ i ] : r = mid else : l = mid + 1 if l == len ( ans ) : ans . append ( [ a [ i ] ] ) else : ans [ l ] . append ( a [ i ] ) for x in ans : print ( * x )     NEW_LINE


def readInt ( ) : return int ( input ( ) )   def readInts ( ) : return [ int ( i ) for i in input ( ) . split ( ) ] n = readInt ( ) a = readInts ( )   nexts = [ - 1 ] * nheads = [ - 1 ] * nlasts = [ - 1 ] * ncnt = 0   for i in range ( n ) : value = a [ i ] left = - 1 right = cnt while right - left > 1 : mid = ( right + left ) // 2 if a [ lasts [ mid ] ] < value : right = mid else : left = mid if right == cnt : heads [ right ] = i cnt += 1 else : last = lasts [ right ] nexts [ last ] = i lasts [ right ] = i   for i in range ( cnt ) : index = heads [ i ] while index != - 1 : print ( a [ index ] , end = ' ▁ ' ) index = nexts [ index ] print ( ) NEW_LINE


""" http : / / codeforces . com / contest / 847 / problem / B51 ▁ 3 ▁ 2 ▁ 5 ▁ 4 ▁ should ▁ output1 ▁ 3 ▁ 52 ▁ 4 """ input ( ) numbers = [ int ( i ) for i in input ( ) . split ( ) ]   runs = [ [ numbers [ 0 ] ] ] for n in numbers [ 1 : ] : if n < runs [ - 1 ] [ - 1 ] : runs . append ( [ n ] ) continue   lo = 0 hi = len ( runs ) - 1 valid = - 1 while lo <= hi : to_search = ( lo + hi ) // 2 if n > runs [ to_search ] [ - 1 ] : valid = to_search hi = to_search - 1 else : lo = to_search + 1 runs [ valid ] . append ( n )   for r in runs : print ( ' ▁ ' . join ( str ( n ) for n in r ) ) NEW_LINE


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


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


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . OutputStreamWriter ; import java . io . PrintWriter ; import java . util . * ;   public class Main { public static BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; public static StringTokenizer st = new StringTokenizer ( " " ) ; public static String nextStr ( ) throws IOException { while ( ! st . hasMoreTokens ( ) ) { st = new StringTokenizer ( br . readLine ( ) ) ; } return st . nextToken ( ) ; } static int nextInt ( ) throws NumberFormatException , IOException { return Integer . parseInt ( nextStr ( ) ) ; } static double nextDouble ( ) throws NumberFormatException , IOException { return Double . parseDouble ( nextStr ( ) ) ; } static long nextLong ( ) throws NumberFormatException , IOException { return Long . parseLong ( nextStr ( ) ) ; } public static PrintWriter pw = new PrintWriter ( new OutputStreamWriter ( System . out ) ) ; public static void printf ( String format , Object ... args ) { pw . printf ( format , args ) ; pw . flush ( ) ; } public static void debug ( String out ) { System . out . println ( out ) ; } public static final int maxn = ( int ) 1e5 + 5 ; public static final int inf = 0x7f7f7f7f ; public static int n , k , t ; public static void main ( String [ ] args ) throws IOException { n = nextInt ( ) ; k = nextInt ( ) ; t = nextInt ( ) ; if ( t <= k ) debug ( " " + t ) ; else if ( t <= n ) debug ( " " + k ) ; else debug ( " " + ( n + k - t ) ) ; }

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


n , k , t = map ( int , input ( ) . split ( ) )             if t < k : print ( t ) elif t > n : NEW_LINE


n , k , t = map ( int , input ( ) . split ( ) ) print ( min ( t , k , n + k - t ) ) NEW_LINE


n , k , t = map ( int , input ( ) . split ( " ▁ " ) ) v = min ( t , k , n + k - t ) print ( v ) NEW_LINE


import java . util . * ;   public class questionCF {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int t = sc . nextInt ( ) ; if ( t < k ) { System . out . print ( t ) ; } else if ( t >= k && t <= n ) { System . out . print ( k ) ; } else { System . out . print ( k - ( t - n ) ) ; } } }


import java . util . * ; import java . util . Arrays ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int t = sc . nextInt ( ) ; if ( t <= k ) { System . out . println ( t ) ; } else if ( t >= k && t <= n ) { System . out . println ( k ) ; } else { int d = n + k - t ; System . out . println ( d ) ; } } }


import java . util . * ; public class Solution { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; int k = s . nextInt ( ) ; int t = s . nextInt ( ) ; int count = 0 ; if ( t <= k ) count = t ; else if ( t > k && t < n ) count = k ; else if ( t >= n ) { count = k - ( t - n ) ; } else if ( n == k && k == t ) count = n ; System . out . println ( count ) ; } }


import java . util . ArrayList ; import java . util . Arrays ; import java . util . Scanner ;   public class Singleton_Pattern { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int t = sc . nextInt ( ) ;   if ( t <= k ) System . out . println ( t ) ; if ( t > k && t <= n ) System . out . println ( k ) ; if ( t > n ) System . out . println ( n + k - t ) ; } }


import java . util . Scanner ;   public class B1476 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int T = in . nextInt ( ) ; for ( int t = 0 ; t < T ; t ++ ) { int N = in . nextInt ( ) ; int K = in . nextInt ( ) ; int [ ] P = new int [ N ] ; for ( int n = 0 ; n < N ; n ++ ) { P [ n ] = in . nextInt ( ) ; } long minPrice = 0 ; for ( int n = N - 1 ; n > 0 ; n -- ) {

for _ in range ( int ( input ( ) ) ) : n , k = map ( int , input ( ) . split ( ) ) NEW_LINE p = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE res = k / 100 NEW_LINE count = 0 NEW_LINE sm = p [ 0 ] NEW_LINE for i in range ( 1 , n ) : sol = 100 * p [ i ] NEW_LINE if sol % k == 0 : NEW_LINE INDENT sol = sol // k else : NEW_LINE sol = sol // k + 1 NEW_LINE DEDENT


import math   NEW_LINE def read ( ) : return map ( int , input ( ) . split ( ) ) NEW_LINE   for _ in range ( int ( input ( ) ) ) : n , k = read ( ) NEW_LINE a = list ( read ( ) ) NEW_LINE x = [ ] NEW_LINE for i in range ( 1 , n ) : x . append ( math . ceil ( 100 * a [ i ] / k - sum ( a [ 1 : i ] ) ) ) NEW_LINE print ( max ( 0 , max ( x ) - a [ 0 ] ) ) NEW_LINE


import math   NEW_LINE def solve ( ) : n , k = map ( int , input ( ) . split ( ) ) NEW_LINE ps = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE sum1 = ps [ 0 ] NEW_LINE maximum = 0 NEW_LINE for i in range ( 1 , len ( ps ) ) : temp = math . ceil ( ( 100 * ps [ i ] - k * sum1 ) / k ) NEW_LINE if temp > maximum : maximum = temp NEW_LINE sum1 += ps [ i ] NEW_LINE print ( maximum )         t = int ( input ( ) ) NEW_LINE while t > 0 : solve ( ) NEW_LINE t = t - 1 NEW_LINE


import sysimport NEW_LINE mathinf = float ( ' inf ' ) NEW_LINE


import sys , mathfrom NEW_LINE collections NEW_LINE import defaultdict , dequeinput = sys . stdin . readline     t = int ( input ( ) ) NEW_LINE while ( t > 0 ) : n , k = map ( int , input ( ) . split ( ) ) NEW_LINE l = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE total = 0 NEW_LINE s = l [ 0 ] NEW_LINE percneeded = k / 100 NEW_LINE for i in range ( 1 , n ) : cur = l [ i ] / s NEW_LINE if ( cur > percneeded ) : need = math . ceil ( ( 100 * l [ i ] ) / k - s ) NEW_LINE total += need NEW_LINE s += need NEW_LINE s += l [ i ] NEW_LINE


import java . util . * ; public class temte { public static void main ( String args [ ] ) { Scanner in = new Scanner ( System . in ) ; int t = in . nextInt ( ) ; int i , j ; while ( t -- > 0 ) { int n = in . nextInt ( ) ; int k = in . nextInt ( ) ; long a [ ] = new long [ n ] ; long b [ ] = new long [ n ] ; for ( i = 0 ; i < n ; i ++ ) { a [ i ] = in . nextLong ( ) ; if ( i == 0 ) b [ i ] = a [ i ] ; else b [ i ] = b [ i - 1 ] + a [ i ] ; } double inf = 0 ; long sum = 0 ; for ( i = 1 ; i < n ; i ++ ) { inf = ( double ) a [ i ] / ( double ) ( b [ i - 1 ] + sum ) ;


import java . util . * ; import java . math . * ; public class Inflation { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int runs = sc . nextInt ( ) ; while ( runs -- > 0 ) { int n = sc . nextInt ( ) ; double k = sc . nextDouble ( ) ; long out = 0 ; double divisor = 0 ; for ( int i = 0 ; i < n ; i ++ ) { double temp = sc . nextDouble ( ) ; if ( i == 0 ) { divisor = temp ; } else { if ( temp / divisor > ( k / 100.0 ) ) { long num = ( long ) Math . ceil ( ( ( temp * 100 ) / ( k ) ) - divisor ) ;


import java . util . * ;   public class Test { static Scanner sc ; static Set < Integer > set ; public static void main ( String [ ] args ) { sc = new Scanner ( System . in ) ;   set = new HashSet < > ( ) ; set . add ( 0 ) ; set . add ( 1 ) ; set . add ( 2 ) ; set . add ( 5 ) ; set . add ( 8 ) ; int t = Integer . parseInt ( sc . next ( ) ) ;   while ( t -- > 0 ) solve ( ) ;   }   public static void solve ( ) { int n = sc . nextInt ( ) ; double k = sc . nextDouble ( ) ;   double [ ] p = new double [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { p [ i ] = sc . nextDouble ( ) ; }   long ans = 0 ;   double per , x = 0 ; for ( int i = 1 ; i < n ; i ++ ) {   per = p [ i ] * 100 / p [ i - 1 ] ; if ( per > k ) {   x = Math . ceil ( p [ i ] * 100 / k - p [ i - 1 ] ) ; ans += x ; p [ i - 1 ] += x ; }   p [ i ] += p [ i - 1 ] ; }   System . out . println ( ans ) ; } }


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


import java . util . * ; import java . io . * ; import java . lang . * ; import java . math . * ;   public class cp { static BufferedReader br ; static StringTokenizer st ;   public static void main ( String [ ] args ) throws IOException {   br = new BufferedReader ( new InputStreamReader ( System . in ) ) ;   st = readLine ( ) ; int n = tokenInt ( ) ; st = readLine ( ) ; int [ ] seq = new int [ n ] ; int i = 0 ; while ( st . hasMoreTokens ( ) ) { seq [ i ] = tokenInt ( ) ; i ++ ; } System . out . println ( new Solver ( ) . solve ( n , seq ) ) ;   }   static StringTokenizer readLine ( ) throws IOException { return new StringTokenizer ( br . readLine ( ) ) ; } static int tokenInt ( ) { return Integer . parseInt ( st . nextToken ( ) ) ; } static long tokenLong ( ) { return Long . parseLong ( st . nextToken ( ) ) ; } static double tokenDouble ( ) { return Double . parseDouble ( st . nextToken ( ) ) ; } static char [ ] tokenChar ( ) { return st . nextToken ( ) . toCharArray ( ) ; }   }    class Solver { public int solve ( int n , int [ ] seq ) throws IOException { int counter = 0 ; int sign = seq [ 0 ] ; List < Integer > arrList = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( seq [ i ] == sign ) { counter ++ ; } else { arrList . add ( counter ) ; sign = seq [ i ] ; counter = 1 ; } } arrList . add ( counter ) ;   int max = - 1 ; int min = 0 ; for ( int i = 0 ; i < arrList . size ( ) - 1 ; i ++ ) { min = Math . min ( arrList . get ( i ) , arrList . get ( i + 1 ) ) ; max = Math . max ( min , max ) ; } return max * 2 ; } }

n = int ( input ( ) ) array = [ int ( x ) for x in input ( ) . split ( ) ]   a = [ ] count = 1 Max = 0   for i in range ( len ( array ) - 1 ) : if ( array [ i ] == array [ i + 1 ] ) : count += 1 else : a . append ( count ) count = 1   a . append ( count )   for i in range ( 1 , len ( a ) ) : temp = min ( a [ i - 1 ] , a [ i ] ) Max = max ( temp , Max ) print ( Max * 2 ) NEW_LINE


n_pieces = int ( input ( ) ) sushi_array = map ( int , input ( ) . split ( ) )   previous_len = 1 curr_len = 1 previous_piece = 0 max_sushi = 0   for piece in sushi_array : if previous_piece != piece : max_sushi = max ( max_sushi , 2 * min ( previous_len , curr_len ) ) previous_len = curr_len curr_len = 1 previous_piece = piece   else : curr_len += 1 max_sushi = max ( max_sushi , 2 * min ( previous_len , curr_len ) )   print ( max_sushi ) NEW_LINE


from itertools import groupbyt = input ( ) row = input ( ) . split ( ) row = [ len ( list ( g ) ) for k , g in groupby ( row ) ]   ans = 2 * max ( min ( a , b ) for a , b in zip ( row , row [ 1 : ] ) ) print ( ans ) NEW_LINE


num = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) + [ 10 ]   summ = [ ] ct = 1 for i in range ( num ) : if arr [ i ] == arr [ i + 1 ] : ct += 1 else : summ . append ( ct ) ct = 1 NEW_LINE


import java . util . Scanner ;   public class _0501SushiforTwo { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; } int max = - 1 ; int prev = - 1 ; int len = 1 ; for ( int i = 1 ; i < n ; i ++ ) { if ( arr [ i ] == arr [ i - 1 ] ) { len ++ ; } else { if ( prev == - 1 ) { prev = len ; len = 1 ; } else { max = Math . max ( max , Math . min ( len , prev ) ) ; prev = len ; len = 1 ; } } max = Math . max ( max , Math . min ( len , prev ) ) ;


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . StringTokenizer ;   public class SushiForTwo {   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 ( ) ; int n = fr . nextInt ( ) ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = fr . nextInt ( ) ; }   int countOne = 1 , countTwo = 1 ; int prev = - 1 , cur = 1 ; int R = 0 ; int max = 0 ; boolean prevOne = false ;   while ( R <= ( n - 1 ) ) { while ( R < ( n - 1 ) && arr [ R ] == arr [ R + 1 ] ) { R ++ ; cur ++ ; if ( prev == cur && ( cur + prev > max ) ) { max = cur + prev ; } } if ( R == n - 1 ) { if ( Math . min ( cur , prev ) * 2 > max ) max = Math . min ( cur , prev ) * 2 ; System . out . println ( max ) ; return ; } if ( Math . min ( cur , prev ) * 2 > max ) max = 2 * Math . min ( cur , prev ) ;


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


import java . util . Scanner ;   public class A1469 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int T = in . nextInt ( ) ; for ( int t = 0 ; t < T ; t ++ ) { String S = in . next ( ) ; boolean possible = ( S . length ( ) % 2 == 0 ) && ( S . charAt ( 0 ) != ' ) ' ) && ( S . charAt ( S . length ( ) - 1 ) != ' ( ' ) ; System . out . println ( possible ? " YES " : " NO " ) ; } }   }

for i in range ( int ( input ( ) ) ) : s = str ( input ( ) ) NEW_LINE n = len ( s ) NEW_LINE if n % 2 != 0 : NEW_LINE INDENT print ( " NO " ) elif s [ 0 ] == " ) " or s [ n - 1 ] == " ( " : NEW_LINE print ( " NO " ) else : NEW_LINE print ( " YES " ) NEW_LINE DEDENT


for _ in range ( int ( input ( ) ) ) : s = input ( ) NEW_LINE n = len ( s ) NEW_LINE if n % 2 != 0 or s [ 0 ] == ' ) ' or s [ n - 1 ] == ' ( ' : NEW_LINE INDENT print ( ' No ' ) else : NEW_LINE print ( ' YEs ' ) NEW_LINE DEDENT


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


def solve ( s ) : if NEW_LINE INDENT ( s [ 0 ] == " ) " or s [ - 1 ] == " ( " or len ( s ) % 2 ) : NEW_LINE DEDENT return ( " NO " ) else : x = s . count ( " ? " ) NEW_LINE if ( x % 2 == 0 ) : return ( " YES " ) NEW_LINE return ( " NO " ) NEW_LINE for i in range ( int ( input ( ) ) ) : print ( solve ( input ( ) ) ) NEW_LINE


t = int ( input ( ) ) NEW_LINE for _ in range ( t ) : s = input ( ) NEW_LINE if ( s [ 0 ] == " ) " or s [ - 1 ] == " ( " or len ( s ) % 2 != 0 ) :     NEW_LINE print ( " NO " ) else : print ( " YES " )               NEW_LINE


import java . util . Scanner ;   public class RegularBracketSequence {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int t = in . nextInt ( ) ; for ( int i = 0 ; i < t ; i ++ ) { int leftB = 0 ; int rightB = 0 ; int qMark = 0 ; String str = in . next ( ) ; for ( int j = 0 ; j < str . length ( ) ; j ++ ) { if ( str . charAt ( j ) == ' ( ' ) { leftB ++ ; } else if ( str . charAt ( j ) == ' ) ' ) { rightB ++ ; } else { qMark ++ ; } } if ( str . charAt ( 0 ) != ' ) ' && str . charAt ( str . length ( ) - 1 ) != ' ( ' ) { if ( leftB == rightB ) { if ( qMark == 0 || qMark % 2 == 0 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } if ( leftB != rightB ) { if ( leftB % 2 == 1 || rightB % 2 == 1 ) { if ( qMark % 2 == 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } else { if ( qMark % 2 == 0 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } } else { System . out . println ( " NO " ) ; } } }   }


import java . util . Scanner ;   public class RegularBracketSequence { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String k = scanner . nextLine ( ) ; int testCases = Integer . parseInt ( k ) ; String s ; String [ ] result = new String [ testCases ] ; for ( int i = 0 ; i < testCases ; i ++ ) { s = scanner . nextLine ( ) ; result [ i ] = solve ( s ) ; }   for ( int i = 0 ; i < testCases ; i ++ ) { System . out . println ( result [ i ] ) ; } }   public static String solve ( String s ) { if ( s . startsWith ( " ) " ) || s . endsWith ( " ( " ) ) return " No " ; if ( s . length ( ) % 2 == 1 ) return " No " ; return " Yes " ; } }


import java . util . Scanner ;   public class RegularBracketSequence { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String testcases = scanner . nextLine ( ) ;   int testcases1 = Integer . parseInt ( testcases ) ; while ( testcases1 -- != 0 ) { String s = scanner . nextLine ( ) ; System . out . println ( solve ( s ) ) ; } }   public static String solve ( String s ) { String response = " " ; if ( s . length ( ) % 2 > 0 || s . charAt ( 0 ) == ' ) ' || s . charAt ( s . length ( ) - 1 ) == ' ( ' ) { return response = " NO " ; } int questionNumbers = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == ' ? ' ) { questionNumbers ++ ; } } if ( questionNumbers % 2 == 0 ) { response = " YES " ; } else { response = " NO " ; } return response ; } }


import java . util . * ; import java . io . IOException ;   public class Regex { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) { String s = sc . next ( ) ; char [ ] c = s . toCharArray ( ) ; if ( c . length % 2 == 0 && ( c [ 0 ] == ' ( ' || c [ 0 ] == ' ? ' ) && ( c [ c . length - 1 ] == ' ) ' || c [ c . length - 1 ] == ' ? ' ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } }


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

for x in range ( int ( input ( ) ) ) : a = input ( ) if a . endswith ( " po " ) : print ( " FILIPINO " ) if a . endswith ( " desu " ) or a . endswith ( " masu " ) : print ( " JAPANESE " ) if a . endswith ( " mnida " ) : print ( " KOREAN " ) NEW_LINE


import sys   def main ( ) : inp = sys . stdin . read ( ) . strip ( ) . split ( ' \n ' ) [ 1 : ] d = { ' po ' : ' FILIPINO ' , ' desu ' : ' JAPANESE ' , ' masu ' : ' JAPANESE ' , ' mnida ' : ' KOREAN ' } out = [ ] for s in inp : for k in d : if s . endswith ( k ) : out . append ( d [ k ] ) break return out   print ( * main ( ) , sep = ' \n ' ) NEW_LINE


for cas in range ( int ( input ( ) ) ) : print ( { ' o ' : " FILIPINO " , ' a ' : " KOREAN " , ' u ' : " JAPANESE " } [ input ( ) [ - 1 ] ] ) NEW_LINE


import java . util . * ;   public class questionCF {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int q = sc . nextInt ( ) ; while ( q -- > 0 ) { String s = sc . next ( ) ; int f = 0 , j = 0 , k = 0 ; int i = s . length ( ) - 1 ; char c = s . charAt ( i ) ; if ( c == ' o ' && s . charAt ( i - 1 ) == ' p ' ) System . out . println ( " FILIPINO " ) ; if ( c == ' u ' && s . charAt ( i - 1 ) == ' s ' && s . charAt ( i - 2 ) == ' e ' && s . charAt ( i - 3 ) == ' d ' ) System . out . println ( " JAPANESE " ) ; if ( c == ' u ' && s . charAt ( i - 1 ) == ' s ' && s . charAt ( i - 2 ) == ' a ' && s . charAt ( i - 3 ) == ' m ' ) System . out . println ( " JAPANESE " ) ;   if ( c == ' a ' && s . charAt ( i - 1 ) == ' d ' && s . charAt ( i - 2 ) == ' i ' && s . charAt ( i - 3 ) == ' n ' && s . charAt ( i - 4 ) == ' m ' ) System . out . println ( " KOREAN " ) ;   }   } }


import java . util . * ; import static java . lang . Math . pow ;   public class Test { public static void main ( String [ ] args ) {   Scanner input = new Scanner ( System . in ) ; int t = input . nextInt ( ) ; while ( t -- > 0 ) {   char [ ] s = input . next ( ) . toCharArray ( ) ; switch ( s [ s . length - 1 ] ) { case ' o ' : System . out . println ( " FILIPINO " ) ; break ; case ' u ' : System . out . println ( " JAPANESE " ) ; break ; default : System . out . println ( " KOREAN " ) ; } } } }


import java . util . Scanner ;   public class SuffixThree {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int size = sc . nextInt ( ) ; for ( int i = 0 ; i < size ; i ++ ) { String value = sc . next ( ) ; int length = value . toCharArray ( ) . length ; if ( length >= 4 ) { if ( value . substring ( length - 2 ) . equals ( " po " ) ) { System . out . println ( " FILIPINO " ) ; } else if ( value . substring ( length - 4 ) . equals ( " desu " ) || value . substring ( length - 4 ) . equals ( " masu " ) ) { System . out . println ( " JAPANESE " ) ; } else if ( value . substring ( length - 5 ) . equals ( " mnida " ) ) { System . out . println ( " KOREAN " ) ; } } else { System . out . println ( " FILIPINO " ) ; } } } }


import java . util . * ;   public class A { public static void main ( String ... args ) { final Scanner sc = new Scanner ( System . in ) ; final int a = sc . nextInt ( ) ; final int b = sc . nextInt ( ) ; long max = ( long ) a * a - ( long ) b * b ; int p = 1 ; for ( int i = 1 ; i <= a ; i ++ ) { long ans = ( long ) ( a - i + 1 ) * ( a - i + 1 ) + i - 1 ; final int r = b % ( i + 1 ) ; ans -= ( long ) ( b / ( i + 1 ) ) * ( b / ( i + 1 ) ) * ( i + 1 - r ) + ( long ) ( b / ( i + 1 ) + 1 ) * ( b / ( i + 1 ) + 1 ) * r ; if ( ans > max ) { max = ans ; p = i ; } } System . out . println ( max ) ; final int r = b % ( p + 1 ) ; final int d = b / ( p + 1 ) ; final char [ ] cs = new char [ a + b ] ; for ( int i = 0 , j = 0 ; i <= p ; i ++ ) { if ( i < r ) for ( int k = 0 ; k <= d ; j ++ , k ++ ) cs [ j ] = ' x ' ; else for ( int k = 0 ; k < d ; j ++ , k ++ ) cs [ j ] = ' x ' ;   if ( i == 0 ) for ( int k = 0 ; k <= a - p ; j ++ , k ++ ) cs [ j ] = ' o ' ; else if ( i < p ) { cs [ j ++ ] = ' o ' ; } } System . out . println ( cs ) ; } }


a , b = map ( int , input ( ) . split ( ) )   def sqr ( x ) : return x * x   def work ( num , flag = 0 ) : ans = sqr ( a - num + 1 ) + num - 1 could = min ( b , num + 1 )   cc = b // could res = b % could   ans -= res * sqr ( cc + 1 ) + ( could - res ) * sqr ( cc ) if flag : print ( ans ) list = ' '   res2 = could - res if could == num + 1 : list += ' x ' * cc res2 -= 1   ta = a list += ' o ' * ( a - num + 1 ) ta -= a - num + 1 while ta > 0 : u = cc + int ( res > 0 ) if res > 0 : res -= 1 else : res2 -= 1 list += ' x ' * u list += ' o ' ta -= 1 if res > 0 or res2 > 0 : list += ' x ' * ( cc + int ( res > 0 ) ) print ( str ( list ) ) return ans   if a == 0 : print ( - sqr ( b ) ) print ( ' x ' * b ) elif b == 0 : print ( sqr ( a ) ) print ( ' o ' * a ) else : now = 1 for i in range ( 1 , a + 1 ) : if i - 1 <= b and work ( i ) > work ( now ) : now = i work ( now , 1 ) NEW_LINE


import javax . sound . midi . Soundbank ; import java . io . BufferedInputStream ; import java . util . Arrays ; import java . util . HashMap ; import java . util . Map ; import java . util . PriorityQueue ; import java . util . Scanner ;   public class Solution1 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( new BufferedInputStream ( System . in ) ) ; int n = scanner . nextInt ( ) ; int m = scanner . nextInt ( ) ; Map < Integer , PriorityQueue < Integer > > map = new HashMap < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { int party = scanner . nextInt ( ) ; int money = scanner . nextInt ( ) ; map . putIfAbsent ( party , new PriorityQueue < > ( ) ) ; map . get ( party ) . add ( money ) ; } long res = Long . MAX_VALUE ; PriorityQueue < Integer > priorityQueue = map . get ( 1 ) ; PriorityQueue < Integer > ttt ; for ( int k = 1 ; k <= n ; k ++ ) { ttt = new PriorityQueue < > ( ) ; long cur = ( priorityQueue == null ? 0 : priorityQueue . size ( ) ) ; if ( cur <= k ) { long money = 0 ; for ( Map . Entry < Integer , PriorityQueue < Integer > > integerPriorityQueueEntry : map . entrySet ( ) ) { int key = integerPriorityQueueEntry . getKey ( ) ; PriorityQueue < Integer > queue = new PriorityQueue < > ( integerPriorityQueueEntry . getValue ( ) ) ; if ( key == 1 || queue . isEmpty ( ) ) { continue ; } while ( queue . size ( ) >= k ) { money += queue . poll ( ) ; cur ++ ; } if ( ! queue . isEmpty ( ) ) { ttt . addAll ( queue ) ; } if ( cur > k ) { break ; } } if ( cur < k ) { while ( cur < k && ! ttt . isEmpty ( ) ) { money += ttt . poll ( ) ; cur ++ ; } } if ( cur == k ) { res = Math . min ( res , money ) ; } }   } System . out . println ( res ) ; }   }

import sysfrom math import *   def minp ( ) : return sys . stdin . readline ( ) . strip ( )   def mint ( ) : return int ( minp ( ) )   def mints ( ) : return map ( int , minp ( ) . split ( ) )   n , m = mints ( ) A = [ 0 ] * nh = [ 0 ] * mfor i in range ( n ) : a , b = mints ( ) A [ i ] = ( b , a - 1 ) h [ a - 1 ] += 1 A . sort ( ) r = 1e100 for k in range ( 1 , n + 1 ) : b = h [ : : ] w = [ True ] * n c = 0 for i in range ( n ) : p , id = A [ i ] if id != 0 and b [ id ] >= k : b [ 0 ] += 1 b [ id ] -= 1 c += p w [ i ] = False for i in range ( n ) : p , id = A [ i ] if id != 0 and w [ i ] and b [ 0 ] < k : b [ 0 ] += 1 b [ id ] -= 1 c += p w [ i ] = False NEW_LINE


import sys   def pro ( ) : return sys . stdin . readline ( ) . strip ( )   def rop ( ) : return map ( int , pro ( ) . split ( ) )   a , s = rop ( ) q = [ 0 ] * aw = [ 0 ] * sfor i in range ( a ) : n , p = rop ( ) q [ i ] = ( p , n - 1 ) w [ n - 1 ] += 1 q . sort ( ) t = 1e100 for k in range ( 1 , a + 1 ) : p = w [ : : ] r = [ True ] * a m = 0 for i in range ( a ) : po , rty = q [ i ] if rty != 0 and p [ rty ] >= k : p [ 0 ] += 1 p [ rty ] -= 1 m += po r [ i ] = False for i in range ( a ) : po , rty = q [ i ] if rty != 0 and r [ i ] and p [ 0 ] < k : p [ 0 ] += 1 p [ rty ] -= 1 m += po r [ i ] = False t = min ( t , m ) print ( t ) NEW_LINE


import java . util . * ; import java . io . * ;   public class Main {   public static void main ( String [ ] args ) throws IOException { FastScanner in = new FastScanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; new Main ( ) . run ( in , out ) ; out . close ( ) ; }   public static int mod = 1_000_000_007 ;   void run ( FastScanner in , PrintWriter out ) {   char [ ] ca = in . next ( ) . toCharArray ( ) ; int n = ca . length ;   int [ ] c = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { c [ i ] = ca [ n - 1 - i ] - '0' ; }   long [ ] dp = new long [ n ] ; dp [ 0 ] = c [ 0 ] == 0 ? 0 : 1 ; int prevOnePos = c [ 0 ] == 0 ? - 1 : 0 ;

s = input ( ) new_s = " " n = len ( s ) for i in range ( n - 1 , - 1 , - 1 ) : new_s += s [ i ] s = new_skek = 0 for i in range ( n ) : kek += ( 1 << i ) * ( s [ i ] == '1' ) for i in range ( n - 1 ) : kek *= 2 print ( kek % ( 10 ** 9 + 7 ) ) NEW_LINE


MOD = int ( 1e9 + 7 ) x = input ( ) [ : : - 1 ] n = len ( x ) res = 0 for i , t in enumerate ( x ) : if t == '1' : res = ( res + ( 1 << ( n - 1 + i ) ) ) % MODprint ( res ) NEW_LINE


pri = pow ( 10 , 9 ) + 7   s = input ( ) m = len ( s ) val = int ( s , 2 ) print ( ( pow ( 2 , m - 1 , pri ) * val ) % pri ) 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 ; Student ( int x , int y ) { this . x = x ; this . y = y ;


import java . io . * ; import java . util . * ;   public class A {   static long find ( char [ ] x , int len , int curr ) { if ( len == 0 ) return 0 ;   if ( x [ curr ] == '1' ) { return ( ( pow_2 [ len - 1 ] * pow_2 [ len - 1 ] ) % mod + ( 2 * find ( x , len - 1 , curr + 1 ) ) % mod ) % mod ; } else { return ( 2 * ( find ( x , len - 1 , curr + 1 ) % mod ) ) % mod ; } }   static long [ ] pow_2 ; static long mod = ( int ) 1e9 + 7 ;   public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; char [ ] x = br . readLine ( ) . toCharArray ( ) ; int n = x . length ; pow_2 = new long [ n + 1 ] ; pow_2 [ 0 ] = 1 ; for ( int i = 1 ; i < n ; i ++ ) { pow_2 [ i ] = ( 2 * pow_2 [ i - 1 ] ) % mod ; } long ans = find ( x , n , 0 ) ; System . out . println ( ans ) ; } }


import java . util . * ; import java . io . * ;   public class Maximum_Absurdity {   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 shuffle ( int [ ] a ) { Random r = new Random ( ) ;   for ( int i = 0 ; i <= a . length - 2 ; i ++ ) { int j = i + r . nextInt ( a . length - i ) ;   swap ( a , i , j ) ; }   Arrays . sort ( a ) ; }   public static void swap ( int [ ] a , int i , int j ) { int temp = a [ i ] ; a [ i ] = a [ j ] ; a [ j ] = temp ; }   public static void main ( String [ ] args ) {

n , k = map ( int , input ( ) . split ( ) ) x = list ( map ( int , input ( ) . split ( ) ) ) y = [ ] s = sum ( x [ : k ] ) y . append ( s ) for i in range ( k , n ) : s += x [ i ] s -= x [ i - k ] y . append ( s ) u = y [ 0 ] v = y [ k ] ans = u + vl = 0 r = ka , b = l + 1 , r + 1 for i in range ( k + 1 , len ( y ) ) : v = y [ i ] r = i if u < y [ i - k ] : l = i - k u = y [ i - k ] if ans < u + v : a = l + 1 b = r + 1 ans = u + vprint ( a , b ) NEW_LINE


import mathimport timefrom collections import defaultdict , deque , Counterfrom sys import stdin , stdoutfrom bisect import bisect_left , bisect_rightimport sysfrom heapq import heapify , heappush , heappop n , k = map ( int , stdin . readline ( ) . split ( ) ) a = list ( map ( int , stdin . readline ( ) . split ( ) ) ) sarr = [ sum ( a [ : k ] ) ] for i in range ( 1 , n - k + 1 ) : sarr . append ( sarr [ - 1 ] - a [ i - 1 ] + a [ i + k - 1 ] ) l = len ( sarr ) m = [ 0 ] * l m [ l - 1 ] = sarr [ l - 1 ] for i in range ( l - 2 , - 1 , - 1 ) : m [ i ] = max ( m [ i + 1 ] , sarr [ i ] ) ans = 0 for i in range ( l - k ) : if ( sarr [ i ] + m [ i + k ] ) > ans : ans = sarr [ i ] + m [ i + k ] top = isec = sarr [ top + k : ] . index ( max ( sarr [ top + k : ] ) ) + top + kprint ( top + 1 , sec + 1 )   NEW_LINE


def main ( ) : wynik = 0 para = ( 0 , 0 ) n , k = input ( ) . split ( ) n , k = int ( n ) , int ( k ) odl = [ ] tab = list ( map ( int , input ( ) . split ( ) ) ) pocz = tab [ 0 ] odl = [ pocz ] for i in range ( 1 , n ) : if i < k : odl . append ( odl [ i - 1 ] + tab [ i ] ) else : odl . append ( odl [ i - 1 ] + tab [ i ] - tab [ i - k ] ) odl = odl [ k - 1 : ] maks = odl [ - 1 ] maksy = [ ] b = n - k + 1 for i in range ( len ( odl ) - 1 , - 1 , - 1 ) : if odl [ i ] >= maks : maks = odl [ i ] b = i + 1 maksy . append ( ( maks , b ) ) maksy . reverse ( ) for i in range ( 0 , len ( odl ) - k ) : if odl [ i ] + maksy [ i + k ] [ 0 ] > wynik : wynik = odl [ i ] + maksy [ i + k ] [ 0 ] para = ( i + 1 , maksy [ i + k ] [ 1 ] ) return f ' { para [ 0 ] } ▁ { para [ 1 ] } '     print ( main ( ) ) NEW_LINE


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