def main_function ( ) : dict = { " Power " : " purple " , " Time " : " green " , " Space " : " blue " , " Soul " : " orange " , " Reality " : " red " , " Mind " : " yellow " } reversed_dict = { " purple " : " Power " , " green " : " Time " , " blue " : " Space " , " orange " : " Soul " , " red " : " Reality " , " yellow " : " Mind " } colours = [ ] output_stones = [ ] e = [ ] t = int ( input ( ) ) for i in range ( t ) : colour = input ( ) colours . append ( colour ) for i in reversed_dict : if i not in colours : output_stones . append ( i ) for i in output_stones : e . append ( reversed_dict [ i ] ) return str ( len ( e ) ) + " \n " + " \n " . join ( e )   print ( main_function ( ) ) NEW_LINE


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

n = int ( input ( ) ) d = { ' purple ' : ' Power ' , ' green ' : ' Time ' , ' blue ' : ' Space ' , ' orange ' : ' Soul ' , ' red ' : ' Reality ' , ' yellow ' : ' Mind ' } for i in range ( n ) : s = input ( ) del d [ s ] print ( 6 - n ) for i in d : print ( d [ i ] ) NEW_LINE


l = { ' purple ' : ' Power ' , ' green ' : ' Time ' , ' blue ' : ' Space ' , ' orange ' : ' Soul ' , ' red ' : ' Reality ' , ' yellow ' : ' Mind ' } set1 = set ( ) n = int ( input ( ) )   for i in range ( n ) : s1 = input ( ) set1 . add ( s1 ) print ( 6 - n ) for ( key , value ) in l . items ( ) : if key not in set1 : print ( value )   NEW_LINE


n = int ( input ( ) ) l = [ ] d = { ' purple ' : ' Power ' , ' green ' : ' Time ' , ' blue ' : ' Space ' , ' orange ' : ' Soul ' , ' red ' : ' Reality ' , ' yellow ' : ' Mind ' } for i in range ( n ) : l . append ( input ( ) ) d1 = dict . fromkeys ( l ) print ( 6 - len ( l ) ) for i in d : if ( i not in d1 ) : print ( d [ i ] ) NEW_LINE


t = int ( input ( ) ) l = [ ] d = { " purple " : " Power ▁ " , " green " : " Time ▁ " , " blue " : " Space ▁ " , " orange " : " Soul ▁ " , " red " : " ▁ Reality " , " yellow " : " ▁ Mind ▁ " } for i in range ( t ) : s = input ( ) l . append ( s ) NEW_LINE


import java . util . * ; public class problem { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String [ ] c = new String [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { c [ i ] = sc . next ( ) ; } int m = 6 - n ; System . out . println ( m ) ; int p = 0 , r = 0 , g = 0 , b = 0 , o = 0 , y = 0 ; String s1 = " purple " , s2 = " green " , s3 = " blue " , s4 = " red " , s5 = " orange " ; for ( int i = 0 ; i < n ; i ++ ) { if ( c [ i ] . equals ( s1 ) ) p ++ ; else if ( c [ i ] . equals ( s2 ) ) g ++ ; else if ( c [ i ] . equals ( s3 ) ) b ++ ; else if ( c [ i ] . equals ( s4 ) ) r ++ ; else if ( c [ i ] . equals ( s5 ) ) o ++ ; else y ++ ; } if ( p == 0 ) System . out . println ( " Power " ) ; if ( g == 0 ) System . out . println ( " Time " ) ; if ( b == 0 ) System . out . println ( " Space " ) ; if ( r == 0 ) System . out . println ( " Reality " ) ; if ( o == 0 ) System . out . println ( " Soul " ) ; if ( y == 0 ) System . out . println ( " Mind " ) ; } }


import java . util . * ; public class Solution { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; String a [ ] = new String [ n ] ; ArrayList < Integer > b = new ArrayList < > ( ) ; s . nextLine ( ) ; int count = 0 ; String [ ] color = { " blue " , " green " , " orange " , " purple " , " red " , " yellow " } ; String [ ] gems = { " Space " , " Time " , " Soul " , " Power " , " Reality " , " Mind " } ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = s . nextLine ( ) ; } for ( int i = 0 ; i < color . length ; i ++ ) { boolean v = check ( color [ i ] , a ) ; if ( v == true ) { count ++ ; b . add ( i ) ; } } System . out . println ( count ) ; for ( int a2 : b ) { System . out . println ( gems [ a2 ] ) ; } } public static boolean check ( String s1 , String [ ] a ) { for ( int k = 0 ; k < a . length ; k ++ ) { if ( s1 . equals ( a [ k ] ) ) return false ; } return true ; } }


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 t = sc . nextInt ( ) ; sc . nextLine ( ) ; int n = 6 ; System . out . println ( n - t ) ; int a [ ] = new int [ 6 ] ; Arrays . fill ( a , 1 ) ; for ( int i = 0 ; i < t ; i ++ ) { String s = sc . nextLine ( ) ; if ( s . equals ( " purple " ) ) a [ 0 ] = - 1 ; if ( s . equals ( " green " ) ) a [ 1 ] = - 1 ; if ( s . equals ( " blue " ) ) a [ 2 ] = - 1 ; if ( s . equals ( " orange " ) ) a [ 3 ] = - 1 ; if ( s . equals ( " red " ) ) a [ 4 ] = - 1 ; if ( s . equals ( " yellow " ) ) a [ 5 ] = - 1 ; }   if ( a [ 0 ] != - 1 ) System . out . println ( " Power " ) ; if ( a [ 1 ] != - 1 ) System . out . println ( " Time " ) ; if ( a [ 2 ] != - 1 ) System . out . println ( " Space " ) ; if ( a [ 3 ] != - 1 ) System . out . println ( " Soul " ) ; if ( a [ 4 ] != - 1 ) System . out . println ( " Reality " ) ; if ( a [ 5 ] != - 1 ) System . out . println ( " Mind " ) ;    } }


import java . util . ArrayList ; import java . util . HashMap ; import java . util . Map ; import java . util . Scanner ;   public class WorkFile { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String str = scanner . next ( ) ; char [ ] s = str . toCharArray ( ) ; int k = scanner . nextInt ( ) ; HashMap < Character , Integer > d = new HashMap < > ( ) ; for ( char elem : s ) { d . putIfAbsent ( elem , 0 ) ; d . replace ( elem , d . get ( elem ) + 1 ) ; } HashMap < Integer , ArrayList < Character > > dict = new HashMap < > ( ) ; for ( Map . Entry < Character , Integer > pair : d . entrySet ( ) ) { dict . putIfAbsent ( pair . getValue ( ) , new ArrayList < Character > ( ) ) ; ArrayList list = new ArrayList ( dict . get ( pair . getValue ( ) ) ) ; list . add ( pair . getKey ( ) ) ; dict . replace ( pair . getValue ( ) , list ) ; } ArrayList < Integer > list = new ArrayList < > ( dict . keySet ( ) ) ; int result = 0 ; for ( int elem : list ) { for ( char element : dict . get ( elem ) ) { if ( k >= elem ) { result ++ ; k -= elem ; str = str . replaceAll ( Character . toString ( element ) , " " ) ; } } } System . out . println ( d . size ( ) - result ) ; System . out . println ( str ) ; } }

def solve ( ) : str0 = input ( ) k = int ( input ( ) ) NEW_LINE


import collectionss = input ( ) k = int ( input ( ) )   d = dict ( ) for i in s : if i in d : d [ i ] += 1 else : d [ i ] = 1 d = sorted ( d . items ( ) , key = lambda x : x [ 1 ] ) A = set ( ) ans = 0 NEW_LINE


# abacaba   m = raw_input ( ) n = input ( ) x = { } v = { } v1 = { } count = 0   for i in m : if i in x : x [ i ] += 1 else : x [ i ] = 1   sorted_set = sorted ( [ ( x [ i ] , i ) for i in x ] )   for ( v , i ) in sorted_set : if v > n : break ; n -= v m = m . replace ( i , '') # print len(set(m))# print m for j in m:	if j in v1:		pass	else:		v1[j]= 1print len(v1)print m


import java . util . Scanner ; import java . util . Arrays ; public class dever_de_casa { public static final int GAMBI = 100 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String linha = sc . nextLine ( ) ; int k = sc . nextInt ( ) ; sc . nextLine ( ) ; int [ ] ocorrencias = new int [ 26 ] ; for ( int i = 0 ; i < 26 ; i ++ ) ocorrencias [ i ] = i ; for ( int i = 0 ; i < linha . length ( ) ; i ++ ) ocorrencias [ linha . charAt ( i ) - ' a ' ] += GAMBI ; Arrays . sort ( ocorrencias ) ; int j = 0 , aux ; while ( k > 0 && j < 26 ) { aux = ( ocorrencias [ j ] - ( ocorrencias [ j ] % GAMBI ) ) / GAMBI ; if ( aux > k ) { ocorrencias [ j ] -= k * GAMBI ; k = 0 ; } else { ocorrencias [ j ] -= aux * GAMBI ; k -= aux ; j ++ ; } } int [ ] ocorrencias2 = new int [ 26 ] ; for ( int i = 0 ; i < 26 ; i ++ ) ocorrencias2 [ ocorrencias [ i ] % GAMBI ] = ( ocorrencias [ i ] - ( ocorrencias [ i ] % GAMBI ) ) / GAMBI ; aux = 0 ; for ( int i = 0 ; i < 26 ; i ++ ) if ( ocorrencias2 [ i ] > 0 ) aux ++ ; System . out . println ( aux ) ; for ( int i = 0 ; i < linha . length ( ) ; i ++ ) { if ( ocorrencias2 [ linha . charAt ( i ) - ' a ' ] > 0 ) { System . out . print ( linha . charAt ( i ) ) ; ocorrencias2 [ linha . charAt ( i ) - ' a ' ] -- ; } } System . out . print ( " \n " ) ; } }


import java . lang . reflect . Array ; import java . text . CollationElementIterator ; import java . util . * ; import java . util . Map . Entry ; import java . io . * ; import java . lang . Math . * ; import java . math . BigInteger ;   import static java . lang . System . * ; import static java . util . Arrays . fill ; import static java . lang . Math . log ; import static java . lang . Math . abs ; import static java . lang . Math . pow ; import static java . lang . Math . sqrt ; import static java . lang . Math . floor ; import static java . lang . Math . ceil ; import static java . lang . Math . sin ; import static java . lang . Math . cos ; import static java . lang . Math . tan ; import static java . util . Arrays . spliterator ; public class ContestMain implements Runnable { private static Reader in = new Reader ( ) ; private static StringBuilder ans = new StringBuilder ( ) ; private static long MOD = 998244353 ; private static final int N = ( int ) ( 2e5 + 7 ) ;

def STR ( ) : return list ( input ( ) ) def INT ( ) : return int ( input ( ) ) def MAP ( ) : return map ( int , input ( ) . split ( ) ) def MAP2 ( ) : return map ( float , input ( ) . split ( ) ) def LIST ( ) : return list ( map ( int , input ( ) . split ( ) ) ) def STRING ( ) : return input ( ) import stringimport sysfrom heapq import heappop , heappushfrom bisect import * from collections import deque , Counter , defaultdictfrom math import * from itertools import permutations , accumulatedx = [ - 1 , 1 , 0 , 0 ] dy = [ 0 , 0 , 1 , - 1 ] NEW_LINE


import sys , math , itertoolsfrom collections import Counter , deque , defaultdictfrom bisect import bisect_left , bisect_right from heapq import heappop , heappush , heapify , nlargestfrom copy import deepcopymod = 10 ** 9 + 7 INF = float ( ' inf ' ) def inp ( ) : return int ( sys . stdin . readline ( ) ) def inpl ( ) : return list ( map ( int , sys . stdin . readline ( ) . split ( ) ) ) def inpl_1 ( ) : return list ( map ( lambda x : int ( x ) - 1 , sys . stdin . readline ( ) . split ( ) ) ) def inps ( ) : return sys . stdin . readline ( ) def inpsl ( x ) : tmp = sys . stdin . readline ( ) ; return tmp [ : x ] def err ( x ) : print ( x ) ; exit ( )   mod = 998244353 n = inp ( ) s = inpsl ( n ) if len ( list ( Counter ( s ) ) ) == 1 : print ( ( ( n + 1 ) * n // 2 ) % mod ) else : l = r = 0 for i in range ( n ) : if s [ i ] != s [ 0 ] : l = i + 1 ; break for i in range ( n ) [ : : - 1 ] : if s [ i ] != s [ - 1 ] : r = n - i break if s [ 0 ] == s [ - 1 ] : print ( l * r % mod ) else : print ( ( l + r - 1 ) % mod ) NEW_LINE


from sys import stdin , stdout , setrecursionlimitfrom functools import lru_cache , cmp_to_keyfrom heapq import merge , heapify , heappop , heappush , nlargestfrom math import * from collections import defaultdict as dd , deque , Counter as Cfrom itertools import combinations as comb , permutations as perm , accumulatefrom bisect import bisect_left as bl , bisect_right as br , bisectfrom time import perf_counterfrom fractions import Fractionimport copyimport timesetrecursionlimit ( 10 ** 9 ) starttime = time . time ( ) mod = int ( pow ( 10 , 9 ) + 7 ) mod2 = 998244353 NEW_LINE


length = int ( input ( ) ) string = input ( ) m = 0 n = 0 temp1 = string [ 0 ] temp2 = string [ - 1 ] for i in string : if i == temp1 : m += 1 continue for j in range ( 1 , length + 1 ) : if string [ - j ] == temp2 : n += 1 continue break breakif n == 0 : print ( ( ( ( m + 1 ) * m ) / 2 ) % 998244353 ) elif temp1 == temp2 : print ( ( ( m + 1 ) * ( n + 1 ) ) % 998244353 ) else : print ( ( n + m + 1 ) % 998244353 ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . math . BigInteger ; import java . util . * ;   public class Main { static long mod = 998244353 ; public static void main ( String [ ] args ) {   FastScanner input = new FastScanner ( ) ; int n = input . nextInt ( ) ; String s = input . next ( ) ; long firstcount = 0 ; long lastcount = 0 ; char first = s . charAt ( 0 ) ; char last = s . charAt ( n - 1 ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( s . charAt ( i ) == first ) firstcount ++ ; else break ; } for ( int i = n - 1 ; i >= 0 ; i -- ) { if ( s . charAt ( i ) == last ) lastcount ++ ; else break ; } if ( first == last ) { System . out . println ( ( firstcount + 1 ) * ( lastcount + 1 ) % mod ) ; } else { System . out . println ( 1 + firstcount + lastcount ) ; }   }   static class FastScanner {   BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( " " ) ;   String next ( ) { while ( ! st . hasMoreTokens ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   long nextLong ( ) {   return Long . parseLong ( next ( ) ) ; }   double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; }   String nextLine ( ) throws IOException { return br . readLine ( ) ; } }   }


import java . io . * ; import java . util . * ; public class Asd { static PrintWriter w = new PrintWriter ( System . out ) ; static FastScanner s = new FastScanner ( ) ; static HashSet < Long > list = new HashSet < > ( ) ; public static void main ( String [ ] args ) { int t = 1 ;


import java . util . * ; public class Main { static HashMap < Long , Integer > h = new HashMap < > ( ) ; public static void query ( char c , long num ) { if ( c == ' ? ' ) { if ( h . containsKey ( num ) ) System . out . println ( h . get ( num ) ) ; else System . out . println ( "0" ) ; } else if ( c == ' + ' || c == ' - ' ) { String s = " " ; while ( num != 0 ) { long i = num % 10 ; if ( i % 2 == 0 ) s += "0" ; else s += "1" ; num = num / 10 ; } StringBuilder sb = new StringBuilder ( ) ; sb . append ( s ) ; sb = sb . reverse ( ) ; String temp = new String ( sb ) ; num = Long . parseLong ( temp , 10 ) ; if ( c == ' + ' ) { if ( h . containsKey ( num ) ) h . put ( num , h . get ( num ) + 1 ) ; else h . put ( num , 1 ) ; } else { h . put ( num , h . get ( num ) - 1 ) ; } }   } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) { char ch = sc . next ( ) . charAt ( 0 ) ; long num = sc . nextLong ( ) ; query ( ch , num ) ; } } }

from sys import stdinfrom sys import stdoutfrom collections import defaultdict r = set ( '02468' )   def mask ( n ) : result = ' ' for x in n : if x in r : result += '0' else : result += '1' return int ( result ) n = int ( stdin . readline ( ) ) a = defaultdict ( int ) for _ in range ( n ) : command , x = stdin . readline ( ) . strip ( ) . split ( ' ▁ ' ) m = mask ( x ) if command == ' + ' : a [ m ] += 1 if command == ' - ' : a [ m ] -= 1 if command == ' ? ' : stdout . write ( str ( a [ m ] ) + ' \n ' ) stdout . flush ( ) NEW_LINE


t = int ( input ( ) ) d = [ 0 ] * 262143 convert = str . maketrans ( '0123456789' , '0101010101' ) for _ in range ( t ) : c , a = input ( ) . split ( ) if c == ' ? ' : print ( d [ int ( a , 2 ) ] ) else : d [ int ( a . translate ( convert ) , 2 ) ] += 1 if c == ' + ' else - 1 NEW_LINE


t = str . maketrans ( "0123456789" , "0101010101" ) dct = { } for _ in range ( int ( input ( ) ) ) : q , a = input ( ) . split ( ) if ( q == " + " ) : c = int ( a . translate ( t ) ) try : dct [ c ] += 1 except : dct [ c ] = 1 elif ( q == " - " ) : c = int ( a . translate ( t ) ) try : dct [ c ] -= 1 except : dct [ c ] = 1 else : c = int ( a . translate ( t ) ) try : print ( dct [ c ] ) except : print ( 0 ) NEW_LINE


import java . util . * ; public class Sonya { public static String func ( long x ) { int i = 0 ; String p = " " ; while ( x != 0 ) { if ( x % 2 == 0 ) p = "0" + p ; else p = "1" + p ; x /= 10 ; } return p ; } public static void main ( String [ ] args ) {


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


# include < iostream > # include < stdio . h > # include < cstdio > # include < bits / stdc ++ . h > # include < limits > # include < algorithm > # include < set > # define pb push_back # define all ( v ) ( v ) . begin ( ) , ( v ) . end ( ) # define deb ( x ) cout << x << " \n " ; # define loop ( n ) for ( int i = 0 ; i < n ; i ++ ) # define ld long double # define ll long long # define pii pair < int , int > # define ff first # define ss second # define ump unordered_map # define mod 1000000007 # define pr ( n ) cout << n << endl ; # define inf INT_MAX # define FAST ios_base :: sync_with_stdio ( false ) ; cin . tie ( NULL ) ; using namespace std ;    int main ( ) { FAST int t = 1 ; cin >> t ; unordered_map < int , int > m ; while ( t -- ) { char op ; string s ; cin >> op >> s ; int a = 0 ; for ( int i = s . length ( ) - 1 ; i >= 0 ; i -- ) { int x = ( s [ i ] - '0' ) % 2 ; a += pow ( 2 , s . length ( ) - 1 - i ) * x ; }   if ( op == ' + ' ) m [ a ] ++ ; else if ( op == ' - ' ) m [ a ] -- ; else { pr ( m [ a ] ) ; } }    }


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

n = int ( input ( ) )   s = list ( input ( ) ) ans = 0   i = 0 while i < n - 1 : if s [ i ] != s [ i + 1 ] : ans += 1 i += 1 i += 1   print ( n - ans ) NEW_LINE


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


n = int ( input ( ) ) s = list ( input ( ) ) c = 0   for i in range ( n - 1 ) : if s [ i ] + s [ i + 1 ] == ' RU ' or s [ i ] + s [ i + 1 ] == ' UR ' : s [ i ] , s [ i + 1 ] = ' D ' , ' D ' c += 1   print ( len ( s ) - c ) NEW_LINE


n = int ( input ( ) ) s = input ( ) a = list ( s ) i = 0 c = 0 while i < n - 1 : if a [ i ] == ' U ' and a [ i + 1 ] == ' R ' : c = c + 1 a [ i ] = ' D ' a [ i + 1 ] = ' D ' elif a [ i ] == ' R ' and a [ i + 1 ] == ' U ' : a [ i ] = ' D ' a [ i + 1 ] = ' D ' c = c + 1 i = i + 1 print ( n - c ) NEW_LINE


n = int ( input ( ) ) s = list ( input ( ) ) x = 0 for i in range ( 0 , n - 1 ) : if s [ i ] == ' U ' and s [ i + 1 ] == ' R ' : s [ i ] = ' D ' s [ i + 1 ] = ' D ' x += 1 elif s [ i ] == ' R ' and s [ i + 1 ] == ' U ' : s [ i ] = ' D ' s [ i + 1 ] = ' D ' x += 1 print ( n - x ) NEW_LINE


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


import java . io . 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 _p000954A { static public void main ( final String [ ] args ) throws IOException { p000954A . _main ( args ) ; }


import java . util . * ;   public class questionCF {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int count = 0 ; StringBuilder sb = new StringBuilder ( sc . next ( ) ) ; for ( int i = 0 ; i < n - 1 ; i ++ ) { String s = sb . substring ( i , i + 2 ) ; if ( s . equals ( " UR " ) || s . equals ( " RU " ) ) { count ++ ; i ++ ; } } System . out . println ( ( sb . length ( ) - count ) ) ;   } }


import java . util . Scanner ;   public class _0719LaunchofCollider {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; sc . nextLine ( ) ; String s = sc . nextLine ( ) ; int min = Integer . MAX_VALUE ; int prev = - 1 ; for ( int i = 0 ; i < n ; i ++ ) { int curr = sc . nextInt ( ) ; if ( prev == - 1 ) { prev = curr ; continue ; } else { if ( s . charAt ( i - 1 ) == ' R ' && s . charAt ( i ) == ' L ' ) { min = Math . min ( min , curr - prev ) ; } } prev = curr ; } if ( min == Integer . MAX_VALUE ) { System . out . println ( - 1 ) ; } else { System . out . println ( min / 2 ) ; } }   }

n = int ( input ( ) )   directions = [ x for x in input ( ) ] points = [ int ( x ) for x in input ( ) . split ( ) ]   m = 9999999999999 flag = Falsefor x in range ( len ( directions ) - 1 ) : if directions [ x ] == " R " and directions [ x + 1 ] == " L " : a = ( ( points [ x ] + points [ x + 1 ] ) / 2 ) - points [ x ] flag = True if ( a < m ) : m = aif flag : print ( int ( m ) ) else : print ( - 1 ) NEW_LINE


from sys import stdinn = int ( stdin . readline ( ) ) s = stdin . readline ( ) [ : - 1 ] a = list ( map ( int , stdin . readline ( ) . split ( ) ) ) min_val = Nonefor i in range ( n - 1 ) : if s [ i ] == ' R ' and s [ i + 1 ] == ' L ' : val = abs ( a [ i ] - a [ i + 1 ] ) // 2 if not min_val : min_val = val min_val = min ( min_val , val ) if not min_val : print ( - 1 ) else : print ( min_val ) NEW_LINE


n = int ( input ( ) ) i = input ( ) arr = list ( map ( int , input ( ) . split ( ) ) ) if " RL " not in i : print ( - 1 ) else : ris = 999999999999999999999999999999 for x in range ( n - 1 ) : if i [ x ] == " R " and i [ x + 1 ] == " L " : ris = min ( ris , ( arr [ x + 1 ] - arr [ x ] ) // 2 ) print ( ris ) NEW_LINE


n = int ( input ( ) ) s = input ( ) a = list ( map ( int , input ( ) . split ( ) ) ) t = 10 ** 10 for i in range ( n - 1 ) : if s [ i : i + 2 ] == ' RL ' : t = min ( t , ( a [ i + 1 ] - a [ i ] ) // 2 ) if t == 10 ** 10 : print ( - 1 ) else : print ( t ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; import java . io . PrintWriter ;      public class A {    public static void main ( String [ ] args ) throws IOException { FastReader sc = new FastReader ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; int n = sc . nextInt ( ) ; String str = sc . next ( ) ; char [ ] dir = str . toCharArray ( ) ; int [ ] pos = sc . nextIntArray ( n ) ;   if ( str . replaceAll ( " RL " , " " ) . length ( ) == n ) out . println ( - 1 ) ;   else {   int min = Integer . MAX_VALUE ; for ( int i = 0 ; i < n - 1 ; i ++ ) { if ( dir [ i ] == ' R ' && dir [ i + 1 ] == ' L ' ) min = Math . min ( min , pos [ i + 1 ] - pos [ i ] ) ; } out . println ( min / 2 ) ; }   out . close ( ) ; }


import java . util . * ; import java . io . * ; public class MyClass { public static void main ( String args [ ] ) { try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( br . readLine ( ) ) ; String s = br . readLine ( ) ; String str [ ] = br . readLine ( ) . split ( " ▁ " ) ; int arr [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { int v = Integer . parseInt ( str [ i ] ) ; char ch = s . charAt ( i ) ; if ( ch == ' L ' ) { arr [ i ] = - v ; } else if ( ch == ' R ' ) { arr [ i ] = v ; } } int min = Integer . MAX_VALUE ; for ( int i = 0 ; i < n - 1 ; i ++ ) { int v1 = arr [ i ] ; int v2 = arr [ i + 1 ] ; if ( ( v1 > 0 && v2 < 0 ) || ( v1 == 0 && s . charAt ( i ) == ' R ' && v2 < 0 ) ) {


import java . util . Scanner ; public class Cf { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; String S = input . next ( ) ; int array [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { array [ i ] = input . nextInt ( ) ; } boolean collision = false ; int distance = 1000000000 ; for ( int i = 0 ; i < n - 1 ; i ++ ) { if ( S . charAt ( i ) == ' R ' && S . charAt ( i + 1 ) == ' L ' ) { collision = true ; int temp = ( array [ i + 1 ] - array [ i ] ) ; if ( temp < distance ) distance = temp ; } } if ( collision ) System . out . println ( distance / 2 ) ; else 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 ( ) ; }

import sysreadline = sys . stdin . readline     def gcd ( a , b ) : while b : a , b = b , a % b return a     def prsh ( N ) : prime = [ 2 ] for L in range ( 3 , N ) : for p in prime : if not L % p : break if p > L ** ( 1 / 2 ) : prime . append ( L ) break return primelimit = 59 prime = prsh ( limit + 1 ) C = set ( [ tuple ( ) ] ) Cp = [ ] for i in range ( 2 , limit + 1 ) : if i >= 30 and i in prime : Cp . append ( i ) continue for k in C . copy ( ) : if all ( gcd ( ki , i ) == 1 for ki in k ) : kn = tuple ( list ( k ) + [ i ] ) C . add ( kn )   INF = 10 ** 9 + 7   N = int ( readline ( ) ) A = list ( map ( int , readline ( ) . split ( ) ) ) Ao = A [ : ] A . sort ( ) ans = INFAns = Nonefor ci in C : tc = [ 1 ] * ( N - len ( ci ) ) + list ( ci ) + Cp for j in range ( 8 ) : res = 0 for a , t in zip ( A , tc [ j : ] ) : res += abs ( a - t ) if ans > res : ans = res Ans = tc [ j : j + N ] buc = [ [ ] for _ in range ( limit + 1 ) ] for a , an in zip ( A , Ans ) : buc [ a ] . append ( an ) AA = [ ] for ao in Ao : AA . append ( buc [ ao ] . pop ( ) )   NEW_LINE


import java . util . * ;   public class B {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ;   int tc = sc . nextInt ( ) ;   for ( ; tc > 0 ; tc -- ) { int n = sc . nextInt ( ) ; n = n * 2 ;   ArrayList < Integer > a = new ArrayList < Integer > ( ) ;   for ( int i = 0 ; i < n ; ++ i ) { a . add ( sc . nextInt ( ) ) ; }   Collections . sort ( a ) ; System . out . println ( a . get ( n / 2 ) - a . get ( n / 2 - 1 ) ) ; } }     }

t = int ( input ( ) ) for a in range ( t ) : n = int ( input ( ) ) bt = list ( map ( int , input ( ) . split ( ) ) ) bt . sort ( ) print ( abs ( bt [ n - 1 ] - bt [ n ] ) ) NEW_LINE


import mathcan = [ ] n = int ( input ( ) ) ye = [ [ None ] * n ] * n   for i in range ( n ) :   m = int ( input ( ) ) can = list ( map ( int , input ( ) . split ( ) ) ) can . sort ( ) ye [ i ] = can [ m ] - can [ m - 1 ]             for i in range ( n ) :   print ( ye [ i ] ) NEW_LINE


import sys   input = sys . stdin . buffer . readline   t = int ( input ( ) ) for _ in range ( t ) : n = int ( input ( ) ) A = sorted ( map ( int , input ( ) . split ( ) ) ) print ( A [ n ] - A [ n - 1 ] ) NEW_LINE


for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) l = sorted ( l , reverse = True ) x = abs ( l [ ( 2 * n ) // 2 ] - l [ ( ( 2 * n ) // 2 ) - 1 ] ) print ( x ) NEW_LINE


from math import sqrt   t = int ( input ( ) ) ans = [ ]   for _ in range ( t ) : n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) a = sorted ( a )   if n == 1 : ans . append ( abs ( a [ 0 ] - a [ 1 ] ) ) continue   a1 = [ ] a2 = [ ]   f = True for i in a : if f : f = not f a1 . append ( i ) else : f = not f a2 . append ( i )   if n % 2 == 0 : a1 . append ( a2 [ len ( a2 ) - 1 ] ) a2 = a2 [ : len ( a2 ) - 1 ]     ans . append ( abs ( a1 [ int ( ( len ( a1 ) - 1 ) / 2 ) ] - a2 [ int ( ( len ( a2 ) - 1 ) / 2 ) ] ) )     for i in ans : print ( i ) NEW_LINE


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


import java . util . * ;    public class Practise {


import java . util . * ;   public class CF102 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; for ( int i = 0 ; i < t ; i ++ ) { int n = sc . nextInt ( ) ; int [ ] ar = new int [ 2 * n + 1 ] ; for ( int j = 1 ; j <= 2 * n ; j ++ ) { ar [ j ] = sc . nextInt ( ) ; } Arrays . sort ( ar ) ; int mid = n ; int ans = ar [ mid + 1 ] - ar [ mid ] ; System . out . println ( ans ) ; } }    public static int getAns ( int [ ] ar , int bigger , int i , int [ ] dp ) {   if ( i < 0 ) { return 0 ; } if ( i == 0 ) { return 1 ; } if ( dp [ i ] != - 1 ) { return dp [ i ] ; } int ans1 = 0 , ans2 ; if ( ar [ i ] < bigger ) { ans1 = 1 + getAns ( ar , ar [ i ] , i - 1 , dp ) ;


import java . io . * ; import java . lang . Math ; import java . util . * ;   public class Main {   public BufferedReader in ; public PrintStream out ;   public boolean log_enabled = false ; public boolean multiply_tests = true ;   public static boolean do_gen_test = false ; public void gen_test ( ) { } private class TestCase {   public Object solve ( ) { int n = readInt ( ) ; int [ ] a = readIntArray ( 2 * n ) ; Arrays . sort ( a ) ; return a [ n ] - a [ n - 1 ] ;


import java . util . * ;   public class Main { int n , x ;   public static void main ( String ... args ) { new Main ( ) . calculate ( ) ; }   void calculate ( ) { Scanner in = new Scanner ( System . in ) ; n = in . nextInt ( ) ; x = in . nextInt ( ) ; ArrayList < Candy > Arr = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) Arr . add ( new Candy ( in . nextInt ( ) , in . nextInt ( ) , in . nextInt ( ) ) ) ; System . out . print ( Math . max ( maxC ( Arr , 0 , x ) , maxC ( Arr , 1 , x ) ) ) ; }   int maxC ( ArrayList < Candy > cs , int t , int x ) { ArrayList < Candy > arrayList = new ArrayList < > ( cs ) ; arrayList . removeIf ( ( c ) -> c . type != t || c . height > x ) ; if ( arrayList . isEmpty ( ) ) return 0 ; Collections . sort ( arrayList , Comparator . comparing ( Candy :: getMass ) ) ; ArrayList < Candy > arr1 = new ArrayList < > ( cs ) ; Candy c = arrayList . get ( arrayList . size ( ) - 1 ) ; arr1 . remove ( c ) ; return maxC ( arr1 , 1 - t , x + c . mass ) + 1 ; } }   class Candy { int type , height , mass ; public Candy ( int t , int h , int m ) { this . type = t ; this . height = h ; this . mass = m ; } public int getMass ( ) { return mass ; } }

n , x = map ( int , input ( ) . split ( ) ) count = 0 ans = 0 curr = 0 fruit = [ ] caramel = [ ] for i in range ( n ) : t , h , m = map ( int , input ( ) . split ( ) ) if t == 0 : caramel . append ( ( h , m ) ) else : fruit . append ( ( h , m ) )   caramel = sorted ( caramel ) fruit = sorted ( fruit ) fruit2 = fruit [ : : ] caramel2 = caramel [ : : ] x2 = x   def add_to_mass ( arr , x ) : candy = 0 curr = 0 for i in range ( len ( arr ) ) : if arr [ i ] [ 0 ] <= x : if arr [ i ] [ 1 ] >= candy : candy = arr [ i ] [ 1 ] curr = i if candy == 0 : return 0 arr . pop ( curr ) return candy   while True : curr = add_to_mass ( fruit , x ) if curr == 0 : break else : x += curr count += 1 curr = add_to_mass ( caramel , x ) if curr == 0 : break else : x += curr count += 1 ans = countcount = 0 while True : curr = add_to_mass ( caramel2 , x2 ) if curr == 0 : break else : x2 += curr count += 1 curr = add_to_mass ( fruit2 , x2 ) if curr == 0 : break else : x2 += curr count += 1 ans = max ( count , ans ) print ( ans ) NEW_LINE


def solve ( p , n , x , t , h , m ) : used , xx , ans = [ 0 ] * n , x , 0 while ( True ) : k = - 1 for i in range ( n ) : if ( used [ i ] == 0 ) and ( t [ i ] == p ) and ( h [ i ] <= xx ) and ( ( k == - 1 ) or ( m [ i ] > m [ k ] ) ) : k = i if ( k == - 1 ) : break ans += 1 xx += m [ k ] used [ k ] = 1 p = p ^ 1 return ans n , x = map ( int , input ( ) . split ( ) ) t , h , m = [ 0 ] * n , [ 0 ] * n , [ 0 ] * nfor i in range ( n ) : t [ i ] , h [ i ] , m [ i ] = map ( int , input ( ) . split ( ) ) print ( max ( solve ( 0 , n , x , t , h , m ) , solve ( 1 , n , x , t , h , m ) ) ) NEW_LINE


n , x = map ( int , input ( ) . split ( ) ) can = [ [ ] , [ ] ] for i in range ( n ) : a , b , c = map ( int , input ( ) . split ( ) ) can [ a ] . append ( ( b , c ) ) ans = 0 for nturn in range ( 2 ) : u = [ [ ] , [ ] ] for i in range ( 2 ) : for j in range ( len ( can [ i ] ) ) : u [ i ] . append ( False ) nx = x nw = 0 turn = nturn for i in range ( n ) : mx = - 1 bj = - 1 for j in range ( len ( can [ turn ] ) ) : if not u [ turn ] [ j ] and can [ turn ] [ j ] [ 0 ] <= nx and can [ turn ] [ j ] [ 1 ] > mx : bj = j mx = can [ turn ] [ j ] [ 1 ] if bj != - 1 : nx += mx u [ turn ] [ bj ] = True nw += 1 else : break turn = ( turn + 1 ) % 2 ans = max ( ans , nw ) print ( ans )       NEW_LINE


import java . util . * ; import java . io . * ;   public class two {   public static void main ( String [ ] args ) throws IOException , FileNotFoundException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ;


import java . io . * ; import java . util . * ;   public class ranjan {   public static Reader cin ; public static PrintWriter cout ; public static boolean [ ] visited ; public static final long bil = ( long ) 1e9 + 7 ; public static void main ( String [ ] arg ) throws IOException {

n , m , k = input ( ) . split ( ) n = int ( n ) m = int ( m ) k = int ( k ) module = 1000000007 if k <= 0 : print ( 0 ) elif k == 1 or k > n : print ( ( m ** n ) % module ) elif k == n : print ( ( m ** int ( ( n + 1 ) / 2 ) ) % module ) elif k % 2 == 1 : print ( ( m ** 2 ) % module ) elif k % 2 == 0 : print ( m % module ) NEW_LINE


import java . io . BufferedReader ; import java . io . BufferedWriter ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . OutputStreamWriter ; import java . io . PrintWriter ; import java . util . List ; import java . util . StringTokenizer ;   public class Main { public static void main ( String [ ] args ) { InputReader in = new InputReader ( System . in ) ; PrintWriter out = new PrintWriter ( new BufferedWriter ( new OutputStreamWriter ( System . out ) ) , true ) ; TaskB solver = new TaskB ( ) ; solver . solve ( 1 , in , out ) ; out . flush ( ) ; out . close ( ) ; } }   class Pair < A , B > { A first ; B second ;   Pair ( A first , B second ) { this . first = first ; this . second = second ; }   }   class TaskB { long INF = ( long ) 1e9 + 7 ; int MAX_N = ( int ) 2e4 + 5 ; long mod = ( long ) 1e8 ; List < Integer > ans ;   public void solve ( int testNumber , InputReader in , PrintWriter pw ) { int n = in . nextInt ( ) ; int m = in . nextInt ( ) ; int k = in . nextInt ( ) ; if ( k == 1 || k > n ) { long temp = pow ( m , n ) ; pw . println ( temp ) ; } else if ( k == n ) { long temp = pow ( m , ( n + 1 ) / 2 ) ; pw . println ( temp ) ; } else { if ( k % 2 == 0 ) { pw . println ( m ) ; } else { long temp = pow ( m , 2 ) ; pw . println ( temp ) ; } }   }   long pow ( long m , long k ) { long prod = 1 ; for ( int i = 0 ; i < k ; i ++ ) { prod = ( prod * m ) % INF ; } return prod % INF ; }


# include < bits / stdc ++ . h >  # define error ( args ... ) { string _s = # args ; replace ( _s . begin ( ) , _s . end ( ) , ' , ' , ' ▁ ' ) ; stringstream _ss ( _s ) ; istream_iterator < string > _it ( _ss ) ; err ( _it , args ) ; } # define all ( x ) x . begin ( ) , x . end ( ) # define rall ( x ) x . rbegin ( ) , x . rend ( ) # define sz ( x ) ( int ) x . size ( )


import java . io . BufferedReader ; import java . util . * ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Arrays ; import java . util . HashSet ; import java . util . Random ; import java . util . Set ; import java . util . StringTokenizer ;    public class A { public static void main ( String [ ] args ) { FastScanner fs = new FastScanner ( ) ; int n = fs . nextInt ( ) ; int [ ] v = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { v [ i ] = fs . nextInt ( ) ; } boolean inc = false ; boolean dec = false ; boolean cont = false ; boolean ok = true ; for ( int i = 0 ; i + 1 < n ; i ++ ) { if ( v [ i ] < v [ i + 1 ] ) { if ( ! dec && ! cont ) { inc = true ; } else { ok = false ; break ; } } if ( v [ i ] == v [ i + 1 ] ) { if ( ! dec ) { cont = true ; } else { ok = false ; break ; } } if ( v [ i ] > v [ i + 1 ] ) { dec = true ; } } if ( ok ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } static final Random random = new Random ( ) ; static void ruffleSort ( int [ ] a ) { int n = a . length ;

import math   length = int ( input ( ) ) array = list ( map ( int , input ( ) . split ( ) ) ) cur = 2   for each in range ( 1 , length ) : dif = array [ each ] - array [ each - 1 ] if ( ( cur == 2 or cur == 1 ) and dif > 0 ) : cur = 1 elif ( ( cur == 2 or cur == 1 or cur == 0 ) and dif == 0 ) : cur = 0 elif ( ( cur == 2 or cur == 0 or cur == - 1 or cur == 1 ) and dif < 0 ) : cur = - 1 else : cur = 3 break if ( cur == 3 ) : print ( " NO " ) else : print ( " YES " ) NEW_LINE


from sys import stdinn = int ( stdin . readline ( ) ) a = list ( map ( int , stdin . readline ( ) . split ( ) ) ) i = 0 while i < n - 1 and a [ i ] < a [ i + 1 ] : i += 1   while i < n - 1 and a [ i ] == a [ i + 1 ] : i += 1   while i < n - 1 : if a [ i ] <= a [ i + 1 ] : exit ( print ( " NO " ) ) i += 1   print ( " Yes " ) NEW_LINE


n = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) i = 0   while i + 1 < n and arr [ i + 1 ] > arr [ i ] : i += 1 while i + 1 < n and arr [ i + 1 ] == arr [ i ] : i += 1 while i + 1 < n and arr [ i + 1 ] < arr [ i ] : i += 1 print ( " YES " if i == n - 1 else " NO " ) NEW_LINE


n = int ( input ( ) ) a = list ( map ( int , input ( ) . strip ( ) . split ( ) ) ) i = 0 while i < n - 1 and a [ i ] < a [ i + 1 ] : i += 1 while i < n - 1 and a [ i ] == a [ i + 1 ] : i += 1 while i < n - 1 : if a [ i ] <= a [ i + 1 ] : print ( " NO " ) exit ( 0 ) i += 1 print ( " YES " ) NEW_LINE


n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) i = 0 while i + 1 < n and a [ i ] < a [ i + 1 ] : i += 1 while i + 1 < n and a [ i ] == a [ i + 1 ] : i += 1 while i + 1 < n and a [ i ] > a [ i + 1 ] : i += 1 if i == n - 1 : print ( ' YES ' ) else : print ( ' NO ' ) NEW_LINE


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


import java . util . Scanner ;   public class UnimodalArr { public static void main ( String [ ] args ) {   Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) , i , l = in . nextInt ( ) ; boolean y = false , z = false , o = true ;   for ( i = 1 ; i < n ; i ++ ) { int a = in . nextInt ( ) ;   if ( a > l ) { if ( y || z ) o = false ; } else if ( a == l ) { if ( z ) o = false ; y = true ; } else { y = true ; z = true ; } l = a ;


import java . util . Arrays ; import java . util . Scanner ;   public class XK_Segment { public static int lowerBound ( long arr [ ] , long key ) { int left = 0 ; int right = arr . length ; int mid ; while ( left < right ) { mid = ( left + right ) / 2 ; if ( key <= arr [ mid ] ) { right = mid ; } else { left = mid + 1 ; } } return left ; } public static int upperBound ( long arr [ ] , long key ) { int left = 0 ; int right = arr . length ; int mid ; while ( left < right ) { mid = ( left + right ) / 2 ; if ( key >= arr [ mid ] ) { left = mid + 1 ; } else { right = mid ; } } return left ; }   public static void main ( String [ ] args ) {

from bisect import bisect_left R = lambda : map ( int , input ( ) . split ( ) ) n , x , k = R ( ) a = sorted ( R ( ) ) print ( sum ( bisect_left ( a , l + x ) - bisect_left ( a , max ( u , l ) ) for u , l in ( ( u , ( ( u - 1 ) // x + k ) * x ) for u in a ) ) ) NEW_LINE


f = lambda : map ( int , input ( ) . split ( ) ) n , x , k = f ( ) t = sorted ( f ( ) ) s = i = j = 0 for y in t : d = ( y // x - k ) * x while i < n and t [ i ] <= min ( d , y ) : i += 1 while j < n and t [ j ] <= min ( d + x , y ) : j += 1 s += j - iprint ( s ) NEW_LINE


from bisect import bisect_left   R = lambda : map ( int , input ( ) . split ( ) )   n , x , k = R ( )   a = sorted ( R ( ) )   print ( sum ( bisect_left ( a , l + x ) - bisect_left ( a , max ( u , l ) ) for u , l in ( ( u , ( ( u - 1 ) // x + k ) * x ) for u in a ) ) )           NEW_LINE


from bisect import bisect_left as bR = lambda : map ( int , input ( ) . split ( ) ) n , x , k = R ( ) a = sorted ( R ( ) ) print ( sum ( b ( a , l + x ) - b ( a , max ( u , l ) ) for u , l in ( ( u , ( ( u - 1 ) // x + k ) * x ) for u in a ) ) ) NEW_LINE


import random , mathfrom copy import deepcopy as dcfrom bisect import bisect_left , bisect_right   NEW_LINE


import java . util . * ; public class MyClass { static Integer [ ] a ; static int n , k , x ; static int numDiv ( int i , int j ) { return a [ j ] / x - ( a [ i ] - 1 ) / x ; } public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; n = sc . nextInt ( ) ; x = sc . nextInt ( ) ; k = sc . nextInt ( ) ; a = new Integer [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = sc . nextInt ( ) ; Arrays . sort ( a ) ; long ans = 0 ; for ( int i = 0 , l = 0 , r = 0 ; i < n ; i ++ ) { while ( l < n && ( a [ l ] < a [ i ] || numDiv ( i , l ) < k ) ) l ++ ; while ( r < n && ( a [ r ] < a [ i ] || numDiv ( i , r ) <= k ) ) r ++ ;


import java . io . * ; import java . util . * ;   public class Main {   public static void main ( String [ ] args ) throws Exception { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( in . readLine ( ) ) ; long n = Integer . parseInt ( st . nextToken ( ) ) ; long x = Integer . parseInt ( st . nextToken ( ) ) ; long k = Integer . parseInt ( st . nextToken ( ) ) ; PriorityQueue < Long > pq = new PriorityQueue < > ( Collections . reverseOrder ( ) ) ; st = new StringTokenizer ( in . readLine ( ) ) ; for ( int i = 0 ; i < n ; i ++ ) { pq . offer ( ( long ) Integer . parseInt ( st . nextToken ( ) ) ) ; } HashMap < Long , Long > map = new HashMap < > ( ) ; long res = 0 ; long charge = 0 ; while ( ! pq . isEmpty ( ) ) { long i = pq . poll ( ) ; long floor = ( i / x ) * x ; if ( ! map . containsKey ( floor ) ) { map . put ( floor , ( long ) 0 ) ; } map . put ( floor , map . get ( floor ) + 1 ) ; charge ++ ;   if ( ! pq . isEmpty ( ) && pq . peek ( ) == i ) { continue ; }    long ceil = ( i / x ) * x ; if ( i % x != 0 ) { ceil += x ; }


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

def rec ( x ) : if x == 1 : return 1   if x % 2 == 0 : return rec ( x // 2 )   else : return rec ( x // 2 ) + 1   n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) d = { } ans = 0 for i in l : som = rec ( i ) if som in d : d [ som ] += 1   else : d [ som ] = 1   for i in d : ans = ans + int ( ( ( d [ i ] - 1 ) / 2 ) * ( d [ i ] ) )   print ( ans ) NEW_LINE


import mathimport timefrom collections import defaultdict , dequefrom sys import stdin , stdoutfrom bisect import bisect_left , bisect_right , bisectpopcount = [ 0 ] * ( 32 ) n = int ( input ( ) ) a = list ( map ( int , stdin . readline ( ) . split ( ) ) ) for i in a : temp = 0 for j in range ( 31 ) : if ( i & 1 << j ) : temp += 1 popcount [ temp ] += 1 ans = 0 for i in popcount : if ( i > 1 ) : ans += ( i * ( i - 1 ) ) // 2 print ( ans ) NEW_LINE


def num ( x ) : return bin ( x ) . count ( "1" ) def main ( ) : n = int ( input ( ) ) line = list ( map ( int , input ( ) . split ( ) ) ) cou = dict ( ) for i in range ( n ) : new = num ( line [ i ] ) if new not in cou : cou [ new ] = 0 cou [ new ] += 1 ans = 0 for el in cou : ans += cou [ el ] * ( cou [ el ] - 1 ) // 2 print ( ans ) main ( ) NEW_LINE


from sys import stdin , stdoutfrom bisect import bisect_right as brfrom bisect import bisect_left as blfrom bisect import insort_left as ilfrom math import gcddef cho ( n ) : return n * ( n - 1 ) // 2 def val ( n ) : ans = 0 while n : if n & 1 : ans += 1 n //= 2 return ansn = int ( stdin . readline ( ) ) lst = [ int ( i ) for i in stdin . readline ( ) . split ( ) ] lst2 = [ ] for i in lst : lst2 += [ val ( i ) ] lst2 . sort ( ) temp = lst2 [ 0 ] c = [ 1 ] ans = 0 for i in lst2 [ 1 : ] : if i == temp : c [ - 1 ] += 1 else : c += [ 1 ] temp = ifor i in c : ans += cho ( i ) stdout . write ( str ( ans ) ) NEW_LINE


import java . util . * ; import java . io . * ; public class Solve {   static BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; static StringTokenizer st ; static PrintWriter pr = new PrintWriter ( new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ) ; public static void main ( String [ ] args ) throws IOException { int n = readInt ( ) , arr [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = readInt ( ) ; } Map < Integer , Integer > mp = new HashMap ( ) ; for ( int i = 0 ; i < n ; i ++ ) {


import java . io . * ; import java . util . * ; public final class code


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


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

n = int ( input ( ) )   c = " BGIORVY "   ans = c + " ORVY " * 25   print ( ans [ : n ] ) NEW_LINE


n = int ( input ( ) ) NEW_LINE s = ' VIBGYOR ' NEW_LINE times = n // 7 NEW_LINE remains = n % 7 NEW_LINE if remains > 4 : NEW_LINE INDENT print ( f ' { s ▁ * ▁ times } { s [ 0 : remains ] } ' ) else : NEW_LINE print ( f ' { s ▁ * ▁ times } { s [ 3:3 ▁ + ▁ remains ] } ' ) NEW_LINE DEDENT


n = int ( input ( ) ) NEW_LINE l = " GYOR " NEW_LINE print ( " VIBGYOR " + l * ( ( n - 7 ) // 4 ) + l [ : ( n - 7 ) % 4 ] ) NEW_LINE


eggs = int ( input ( ) ) NEW_LINE paint = [ ' R ' , ' O ' , ' Y ' , ' G ' , ' B ' , ' I ' , ' V ' ] NEW_LINE for _ in range ( eggs - 7 ) : paint . append ( '0' ) NEW_LINE


if __name__ == " _ _ main _ _ " : s = " ROYGBIV " NEW_LINE cases = [ ' ' , ' G ' , ' GB ' , ' YGB ' , ' YGBI ' , ' OYGBI ' , ' OYGBIV ' ] NEW_LINE n = int ( input ( ) ) NEW_LINE to_print = n // 7 NEW_LINE cases_print = n % 7 NEW_LINE print ( s * to_print , end = " " ) NEW_LINE print ( cases [ cases_print ] , end = " " ) NEW_LINE


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


import java . util . Arrays ;   import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; char [ ] arr = new char [ k ] ; char [ ] color = new char [ ] { ' R ' , ' O ' , ' Y ' , ' G ' , ' B ' , ' I ' , ' V ' } ; if ( k % 7 >= 4 || k % 7 == 0 ) { int i = 0 , tt = 0 ; while ( i < k ) { arr [ i ] = color [ tt ] ; if ( tt < 6 ) tt ++ ; else if ( tt == 6 ) { tt = 0 ; } i ++ ; } } else if ( k % 7 < 4 ) { int i = 0 , j = 0 , l = k % 7 , tt = 0 ;   for ( i = 4 ; i < 4 + l ; i ++ ) { arr [ i ] = color [ j ] ; j ++ ; } i = 0 ; while ( i < k ) { if ( arr [ i ] == ' \0' ) { arr [ i ] = color [ tt ] ; if ( tt < 6 ) tt ++ ; else if ( tt == 6 ) tt = 0 ; }   i ++ ; }   } for ( int i = 0 ; i < k ; i ++ ) { System . out . print ( arr [ i ] ) ; } System . out . println ( ) ;   } }


import java . util . Arrays ; import java . util . Scanner ;   public class Main {    public static void main ( String [ ] args ) {   int n ; Scanner in = new Scanner ( System . in ) ; n = in . nextInt ( ) ; System . out . print ( " ROYGBIV " ) ; n -= 7 ; while ( n >= 4 ) { System . out . print ( " GBIV " ) ; n -= 4 ; } if ( n == 0 ) System . out . println ( ) ; if ( n == 1 ) System . out . println ( " G " ) ; if ( n == 2 ) System . out . println ( " GB " ) ; if ( n == 3 ) System . out . println ( " GBI " ) ; }   }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class B {   static class FastScanner {   BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( " " ) ;   String next ( ) { while ( ! st . hasMoreTokens ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   int [ ] readArray ( int n ) { int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = nextInt ( ) ; } return a ; }   long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } }   public static void main ( String args [ ] ) { FastScanner scanner = new FastScanner ( ) ; StringBuffer ans = new StringBuffer ( " ROYGBIV " ) ; int len = scanner . nextInt ( ) - 7 ; for ( int i = 0 ; i < len ; i ++ ) { ans . append ( ans . charAt ( ans . length ( ) - 4 ) ) ; } System . out . println ( ans . toString ( ) ) ; } }


import java . util . Arrays ; import java . util . Scanner ;   public class CF378_D2_B { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int [ ] c1 = new int [ n ] ; int [ ] c2 = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { c1 [ i ] = scanner . nextInt ( ) ; c2 [ i ] = scanner . nextInt ( ) ; } char [ ] f1 = new char [ n ] ; char [ ] f2 = new char [ n ] ; Arrays . fill ( f1 , '0' ) ; Arrays . fill ( f2 , '0' ) ; for ( int i = 0 ; i < n / 2 ; i ++ ) { f1 [ i ] = '1' ; f2 [ i ] = '1' ; } for ( int i = 0 , x = 0 , y = 0 ; i < n ; i ++ ) { if ( c1 [ x ] < c2 [ y ] ) { f1 [ x ] = '1' ; x ++ ; } else { f2 [ y ] = '1' ; y ++ ; } } System . out . println ( String . valueOf ( f1 ) ) ; System . out . println ( String . valueOf ( f2 ) ) ; } }

n = int ( input ( ) ) k = [ ] a = [ ] b = [ ] for i in range ( n ) : A , B = map ( int , input ( ) . split ( ) ) a . append ( A ) b . append ( B ) la = 0 lb = 0 aind = [ 0 ] * nbind = [ 0 ] * nfor i in range ( n ) : if a [ la ] < b [ lb ] : aind [ la ] = 1 la += 1 else : bind [ lb ] = 1 lb += 1 for i in range ( n // 2 ) : aind [ i ] = 1 bind [ i ] = 1 for i in aind : print ( i , end = ' ' ) print ( ' ' ) for i in bind : print ( i , end = ' ' ) NEW_LINE


n = int ( input ( ) ) l1 = [ 0 ] * nl2 = [ 0 ] * nls1 = [ "0" ] * nls2 = [ "0" ] * nfor i in range ( n ) : a , b = map ( int , input ( ) . split ( ) ) l1 [ i ] = a l2 [ i ] = b   tl = [ 0 , n // 2 ] for k in tl : for h in range ( k ) : ls1 [ h ] = "1" ls2 [ h ] = "1" x = n - 2 * k i = k j = k while ( x > 0 ) : NEW_LINE


n = int ( input ( ) )   a = [ ] b = [ ] for i in range ( n ) : x , y = input ( ) . split ( ) a . append ( [ int ( x ) , 0 ] ) b . append ( [ int ( y ) , 0 ] )   j = 0 ; k = 0 for i in range ( n ) : if a [ j ] [ 0 ] < b [ k ] [ 0 ] : a [ j ] [ 1 ] = 1 j += 1 else : b [ k ] [ 1 ] = 1 k += 1   k = n // 2 for i in range ( k ) : a [ i ] [ 1 ] = 1 b [ i ] [ 1 ] = 1   s1 = ' ' ; s2 = ' ' for i in range ( n ) : if a [ i ] [ 1 ] : s1 += '1' else : s1 += '0' if b [ i ] [ 1 ] : s2 += '1' else : s2 += '0'   print ( s1 ) print ( s2 )   NEW_LINE


n = int ( input ( ) ) k = int ( n / 2 ) s1 = "1" * ( int ( n / 2 ) ) + "0" * ( n - int ( n / 2 ) ) s2 = "1" * ( int ( n / 2 ) ) + "0" * ( n - int ( n / 2 ) ) s1 = list ( s1 ) s2 = list ( s2 ) a = [ ] b = [ ] for i in range ( n ) : c , d = input ( ) . split ( ) a . append ( int ( c ) ) b . append ( int ( d ) ) for i in range ( k , n ) : if ( a [ i ] < b [ n - i - 1 ] ) : s1 [ i ] = "1" if ( b [ i ] < a [ n - i - 1 ] ) : s2 [ i ] = "1" print ( ' ' . join ( s1 ) ) print ( ' ' . join ( s2 ) ) NEW_LINE


import java . util . * ;   public class Test { public static void main ( String [ ] args ) {   Scanner input = new Scanner ( System . in ) ; int w = 0 , b = 0 ; for ( int a = 0 ; a < 8 ; a ++ ) { char [ ] s = input . next ( ) . toCharArray ( ) ; for ( int i = 0 ; i < 8 ; i ++ ) { switch ( s [ i ] ) { case ' P ' : w ++ ; break ; case ' B ' : w += 3 ; break ; case ' N ' : w += 3 ; break ; case ' R ' : w += 5 ; break ; case ' Q ' : w += 9 ; break ; case ' p ' : b ++ ; break ; case ' b ' : b += 3 ; break ; case ' n ' : b += 3 ; break ; case ' r ' : b += 5 ; break ; case ' q ' : b += 9 ; } } } if ( w > b ) { System . out . println ( " White " ) ; } else if ( w < b ) { System . out . println ( " Black " ) ; } else System . out . println ( " Draw " ) ; } }

boardWeight = 0 pieceWeights = { " Q " : 9 , " R " : 5 , " B " : 3 , " N " : 3 , " P " : 1 , " K " : 0 , " q " : - 9 , " r " : - 5 , " b " : - 3 , " n " : - 3 , " p " : - 1 , " k " : 0 , " . " : 0 } for row in range ( 8 ) : letters = input ( ) for i in range ( 8 ) : piece = letters [ i ] boardWeight += pieceWeights [ piece ] if boardWeight > 0 : print ( " White " ) elif boardWeight < 0 : print ( " Black " ) else : print ( " Draw " ) NEW_LINE


cap = { ' Q ' : 9 , ' R ' : 5 , ' B ' : 3 , ' N ' : 3 , ' P ' : 1 , ' q ' : 9 , ' r ' : 5 , ' b ' : 3 , ' n ' : 3 , ' p ' : 1 } low = " qrbnp " upp = " QRBNP " upp_c = 0 low_c = 0 i = 8 while i : for j in input ( ) : if j in upp : upp_c += cap [ j ] elif j in low : low_c += cap [ j ] i -= 1 if upp_c > low_c : print ( " White " ) elif upp_c < low_c : print ( " Black " ) else : print ( " Draw " )   NEW_LINE


a = [ ] for i in range ( 8 ) : b = input ( ) a . append ( b ) white = 0 black = 0 for i in range ( 8 ) : for x in range ( 8 ) : if a [ i ] [ x ] == " r " : black = black + 5 elif a [ i ] [ x ] == " b " : black = black + 3 elif a [ i ] [ x ] == " n " : black = black + 3 elif a [ i ] [ x ] == " p " : black = black + 1 elif a [ i ] [ x ] == " q " : black = black + 9 elif a [ i ] [ x ] == " R " : white = white + 5 elif a [ i ] [ x ] == " B " : white = white + 3 elif a [ i ] [ x ] == " N " : white = white + 3 elif a [ i ] [ x ] == " P " : white = white + 1 elif a [ i ] [ x ] == " Q " : white = white + 9 if white > black : print ( " White " ) elif black > white : print ( " Black " ) else : print ( " Draw " ) NEW_LINE


white = 0 black = 0 for x in range ( 8 ) : i = input ( ) white += i . count ( " Q " ) * 9 white += i . count ( " R " ) * 5 white += i . count ( " B " ) * 3 white += i . count ( " N " ) * 3 white += i . count ( " P " ) * 1 black += i . count ( " q " ) * 9 black += i . count ( " r " ) * 5 black += i . count ( " b " ) * 3 black += i . count ( " n " ) * 3 black += i . count ( " p " ) * 1 if white > black : print ( " White " ) elif black > white : print ( " Black " ) else : print ( " Draw " ) NEW_LINE


import java . util . * ; import java . io . * ;   public class Main { static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } public static void main ( String args [ ] ) { FastReader sc = new FastReader ( ) ; int t = 8 ; int b = 0 , w = 0 ; while ( t -- > 0 ) { String s = sc . next ( ) ; for ( int i = 0 ; i < 8 ; i ++ ) { char ss = s . charAt ( i ) ; if ( ss == ' Q ' ) { w += 9 ; } else if ( ss == ' R ' ) w += 5 ; else if ( ss == ' B ' ) w += 3 ; else if ( ss == ' N ' ) w += 3 ; else if ( ss == ' P ' ) w += 1 ; else if ( ss == ' q ' ) { b += 9 ; } else if ( ss == ' r ' ) b += 5 ; else if ( ss == ' b ' ) b += 3 ; else if ( ss == ' n ' ) b += 3 ; else if ( ss == ' p ' ) b += 1 ; } } if ( w > b ) System . out . println ( " White " ) ; else if ( b > w ) System . out . println ( " Black " ) ; else System . out . println ( " Draw " ) ; } }


import java . util . * ;   public class CF102 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Map < Character , Integer > map = new HashMap < > ( ) ; map . put ( ' Q ' , 9 ) ; map . put ( ' R ' , 5 ) ; map . put ( ' B ' , 3 ) ; map . put ( ' N ' , 3 ) ; map . put ( ' P ' , 1 ) ; map . put ( ' K ' , 0 ) ;   map . put ( ' q ' , 9 ) ; map . put ( ' r ' , 5 ) ; map . put ( ' b ' , 3 ) ; map . put ( ' n ' , 3 ) ; map . put ( ' p ' , 1 ) ; map . put ( ' k ' , 0 ) ; long p1 = 0 ; long p2 = 0 ;


import java . io . IOException ; import java . util . Scanner ;   public class A { public static void main ( String [ ] args ) throws IOException { Scanner scan = new Scanner ( System . in ) ;   int n = scan . nextInt ( ) ; int m = scan . nextInt ( ) ; int min = scan . nextInt ( ) ; int max = scan . nextInt ( ) ;

import sys   def minp ( ) : return sys . stdin . readline ( ) . strip ( )   def mint ( ) : return int ( minp ( ) )   def mints ( ) : return map ( int , minp ( ) . split ( ) )   n , m , mi , ma = mints ( ) a = list ( mints ( ) ) mii = min ( a ) maa = max ( a ) if mii > mi : m += 1 if maa < ma : m += 1 if mii < mi or maa > ma or m > n : print ( " Incorrect " ) else : print ( " Correct " ) NEW_LINE


n , m , min_a , max_a = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) if m <= n - 2 : if min ( a ) >= min_a and max ( a ) <= max_a : print ( " Correct " ) else : print ( " Incorrect " ) elif m == n - 1 : if min ( a ) == min_a and max ( a ) <= max_a or max ( a ) == max_a and min ( a ) >= min_a : print ( " Correct " ) else : print ( " Incorrect " ) elif n == m : if min ( a ) == min_a and max ( a ) == max_a : print ( " Correct " ) else : print ( " Incorrect " ) else : print ( " Incorrect " ) NEW_LINE


n , m , l , r = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) if max ( a ) > r or min ( a ) < l : print ( " Incorrect " ) elif n - m >= 2 : print ( " Correct " ) else : if l not in a and r not in a and l != r : print ( " Incorrect " ) else : print ( " Correct " ) NEW_LINE


n , m , minimum , maximum = map ( int , input ( ) . split ( ) ) seq = [ int ( i ) for i in input ( ) . split ( ) ] if max ( seq ) > maximum or min ( seq ) < minimum : print ( ' Incorrect ' ) else : if maximum not in seq and minimum not in seq : if n - m >= 2 : print ( ' Correct ' ) else : print ( ' Incorrect ' ) elif maximum in seq and minimum in seq : print ( ' Correct ' ) else : if n - m >= 1 : print ( ' Correct ' ) else : print ( ' Incorrect ' ) NEW_LINE


import java . util . * ; import java . io . * ; import java . lang . * ;    public class A413 {   public static void main ( String [ ] args ) { int n , m , min , max ; int start , end , mMin , mMax ; Scanner s = new Scanner ( System . in ) ; n = s . nextInt ( ) ; m = s . nextInt ( ) ; min = s . nextInt ( ) ; max = s . nextInt ( ) ;   int extra = n - m ; start = s . nextInt ( ) ; mMin = start ; mMax = start ; end = start ; if ( end > max || end < min ) { System . out . println ( " Incorrect " ) ; return ; }   for ( int i = 1 ; i < m ; i ++ ) { end = s . nextInt ( ) ; if ( end > max || end < min ) { System . out . println ( " Incorrect " ) ; return ; } mMax = Math . max ( end , mMax ) ; mMin = Math . min ( end , mMin ) ; } if ( extra >= 2 ) System . out . println ( " Correct " ) ; else if ( mMax == max && extra == 1 ) System . out . println ( " Correct " ) ; else if ( mMin == min && extra == 1 ) System . out . println ( " Correct " ) ; else if ( mMin == min && mMax == max ) System . out . println ( " Correct " ) ; else System . out . println ( " Incorrect " ) ; } }


import java . util . Scanner ;   public class dataRecovery { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ;   int minM = sc . nextInt ( ) ; int maxM = sc . nextInt ( ) ;   int newMin = 200 ; int newMax = 0 ; int [ ] arr = new int [ m ] ; for ( int i = 0 ; i < m ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; if ( arr [ i ] < newMin ) newMin = arr [ i ] ; if ( arr [ i ] > newMax ) newMax = arr [ i ] ; }   if ( newMax > maxM || newMin < minM ) { System . out . println ( " Incorrect " ) ; } else { if ( newMax != maxM && newMin != minM ) { if ( n - m < 2 ) { System . out . println ( " Incorrect " ) ; } else { System . out . println ( " Correct " ) ; } } else { System . out . println ( " Correct " ) ; } } } }


import java . util . * ; import java . util . jar . JarOutputStream ;   public class Practise {   public static int [ ] [ ] dp ; public static void main ( String [ ] args ) {

n = int ( input ( ) ) s = set ( ) arr = [ ] for _ in range ( n ) : arr . append ( int ( input ( ) ) ) s . add ( arr [ - 1 ] )   if len ( s ) != 2 : print ( " NO " ) else : x , y = s if ( arr . count ( x ) == arr . count ( y ) ) : print ( " YES " ) print ( y , x ) else : print ( " NO " ) NEW_LINE


n = int ( input ( ) ) llst = [ ] llst1 = [ ] summ = 0 for i in range ( n ) : llst . append ( int ( input ( ) ) ) for i in llst : if i not in llst1 and llst . count ( i ) == n // 2 : summ += llst . count ( i ) llst1 . append ( i ) if summ == n : print ( ' YES ' ) print ( * llst1 ) else : print ( ' NO ' ) NEW_LINE


list_n_len = [ 0 for i in range ( 120 ) ] list_n = [ ] for i in range ( int ( input ( ) ) ) : a = int ( input ( ) ) list_n_len [ a ] += 1 list_n . append ( a ) list_n = list ( set ( list_n ) ) if len ( list_n ) == 2 and list_n_len [ list_n [ 0 ] ] == list_n_len [ list_n [ 1 ] ] : print ( " YES " ) print ( list_n [ 0 ] , list_n [ 1 ] ) else : print ( " NO " ) NEW_LINE


n = int ( input ( ) ) freq = { } for _ in range ( n ) : num = int ( input ( ) ) freq [ num ] = freq . get ( num , 0 ) + 1 keys = list ( freq . keys ( ) ) if len ( keys ) == 2 and freq [ keys [ 0 ] ] == n // 2 : print ( ' YES ' ) print ( * keys ) else : print ( ' NO ' ) NEW_LINE


import java . util . Scanner ;   public class _0724FairGame {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int firstNum = - 1 ; int firstCount = 0 ; int secondNum = - 1 ; int secondCount = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int temp = sc . nextInt ( ) ; if ( i == 0 ) { firstNum = temp ; firstCount ++ ; } else if ( temp == firstNum ) { firstCount ++ ; } else { if ( secondNum == - 1 ) { secondNum = temp ; secondCount ++ ; } else if ( temp == secondNum ) { secondCount ++ ; } else { System . out . println ( " NO " ) ; return ; } } } if ( firstCount == secondCount ) { System . out . println ( " YES " ) ; System . out . println ( firstNum + " ▁ " + secondNum ) ; } else { System . out . println ( " NO " ) ; } }   }


import java . io . * ; import java . util . * ; import java . text . * ; import java . math . * ; import java . util . regex . * ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int z = s . nextInt ( ) ; while ( z -- > 0 ) { int a = s . nextInt ( ) , b = s . nextInt ( ) , n = s . nextInt ( ) , ans = 0 ; if ( n % 3 == 1 ) ans = b ; else if ( n % 3 == 2 ) ans = a ^ b ; else ans = a ; System . out . println ( ans ) ; } } }

t = int ( input ( ) )   while t > 0 : a , b , n = map ( int , input ( ) . split ( ) ) xorval = a ^ b if n % 3 == 0 : print ( a ) elif n % 3 == 1 : print ( b ) else : print ( xorval ) t -= 1 NEW_LINE


for i in range ( int ( input ( ) ) ) : a , b , n = map ( int , input ( ) . split ( ' ▁ ' ) ) g = [ a , b , a ^ b ] print ( g [ n % 3 ] ) NEW_LINE


for _ in range ( int ( input ( ) ) ) : a , b , c = map ( int , input ( ) . split ( ) ) c %= 3 print ( [ a , b , a ^ b ] [ c ] ) NEW_LINE


cases = int ( input ( ) ) while cases : cases -= 1 a , b , n = map ( int , input ( ) . split ( ) )   ans = [ a , b , a ^ b ]   print ( ans [ n % 3 ] ) NEW_LINE


import java . util . * ; import java . util . Arrays ; public class Main { static int nthXorFib ( int n , int a , int b ) { if ( n == 0 ) return a ; if ( n == 1 ) return b ; if ( n == 2 ) return ( a ^ b ) ; return nthXorFib ( n % 3 , a , b ) ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; for ( int i = 0 ; i < t ; i ++ ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; System . out . println ( nthXorFib ( n , a , b ) ) ; } } }


import java . util . * ; public class Solution { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int t = s . nextInt ( ) ; for ( int k = 0 ; k < t ; k ++ ) { int a = s . nextInt ( ) ; int b = s . nextInt ( ) ; int n = s . nextInt ( ) ; int v = check ( a , b , n ) ; System . out . println ( v ) ; } } public static int check ( int a , int b , int n ) { if ( n == 0 ) return a ; if ( n == 1 ) return b ; if ( n == 2 ) return a ^ b ; return check ( a , b , n % 3 ) ; } }


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


import java . util . * ;   public class Practise {   static int [ ] [ ] dp ;    public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t > 0 ) { long a = sc . nextInt ( ) ; long b = sc . nextInt ( ) ; long n = sc . nextInt ( ) ; if ( n % 3 == 0 ) System . out . println ( a ) ; else if ( n % 3 == 1 ) System . out . println ( b ) ; else { System . out . println ( a ^ b ) ; }   t -- ; }


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

n = int ( input ( ) ) while n > 0 : n = n - 1 a , b = map ( int , input ( ) . split ( ) ) print ( b * 2 )     NEW_LINE


a = int ( input ( ) ) for i in range ( a ) : n , x = map ( int , input ( ) . split ( ) ) print ( 2 * x ) NEW_LINE


for _ in [ 0 ] * int ( input ( ) ) : print ( 2 * int ( input ( ) . split ( ) [ 1 ] ) ) NEW_LINE


t = int ( input ( ) ) for z in range ( t ) : n , x = input ( ) . split ( ) n = int ( n ) x = int ( x ) print ( 2 * x ) NEW_LINE


''' Description : ▁ https : / / blog . csdn . net / qq _ 45859188Author : ▁ NEFU ▁ AB _ INversion : ▁ 1.0Date : ▁ 2021-03-14 ▁ 09:56:33LastEditors : ▁ NEFU ▁ AB _ INLastEditTime : ▁ 2021-03-20 ▁ 18:45:06 ''' import math   def solve ( ) : n , x = map ( int , input ( ) . split ( ) ) print ( 2 * x ) for _ in range ( int ( input ( ) ) ) : solve ( ) NEW_LINE


import java . util . * ; public class CodeForces { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int t = scan . nextInt ( ) ; while ( t -- > 0 ) { int n = scan . nextInt ( ) ; int x = scan . nextInt ( ) ; System . out . println ( x * 2 ) ; } scan . close ( ) ; } }


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


import java . util . Scanner ;   public class RemoveaProgression { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int t = scan . nextInt ( ) ; while ( t -- > 0 ) { int n = scan . nextInt ( ) ; int k = scan . nextInt ( ) ; System . out . println ( k * 2 ) ; } } }


import java . util . Collections ; import java . util . * ; import java . lang . * ; import java . math . BigInteger ; import java . io . * ; import java . io . * ; import java . util . * ;   import java . util . Arrays ; public class CodeChef {   public static void main ( String args [ ] ) throws IOException {   BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringBuilder sb = new StringBuilder ( ) ; String [ ] sr = br . readLine ( ) . split ( " " ) ; String [ ] pr = br . readLine ( ) . split ( " " ) ; Integer [ ] arr = new Integer [ sr . length ] ; Integer [ ] arr1 = new Integer [ pr . length ] ; for ( int i = 0 ; i < sr . length ; i ++ ) arr [ i ] = Integer . parseInt ( sr [ i ] ) ; for ( int i = 0 ; i < pr . length ; i ++ ) arr1 [ i ] = Integer . parseInt ( pr [ i ] ) ;   Arrays . sort ( arr1 , Collections . reverseOrder ( ) ) ;   int l = 0 , m = 0 ; for ( ; l < sr . length ; l ++ ) { for ( ; m < pr . length ; m ++ ) { if ( arr1 [ m ] > arr [ l ] ) { arr [ l ] = arr1 [ m ] ; m ++ ; break ; } else { break ; } } } for ( int i = 0 ; i < sr . length ; i ++ ) System . out . print ( arr [ i ] ) ; }   }

a = input ( ) s = input ( ) s = " " . join ( sorted ( s , reverse = True ) ) j = 0   for i in range ( len ( a ) ) : if ( a [ i ] < s [ j ] ) : a = a [ 0 : i ] + s [ j ] + a [ i + 1 : ] j = j + 1   if ( j == len ( s ) ) : breakprint ( a ) NEW_LINE


a = [ int ( x ) for x in input ( ) ] b = sorted ( [ int ( y ) for y in input ( ) ] , reverse = True ) y = 0   for i in range ( 0 , len ( a ) ) : if y < len ( b ) and a [ i ] < b [ y ] : a [ i ] = b [ y ] y = y + 1       print ( " " . join ( [ str ( c ) for c in a ] ) ) NEW_LINE


a = [ i for i in input ( ) ] b = sorted ( [ i for i in input ( ) ] , reverse = True ) i , p = 0 , 0 while i < len ( a ) and p < len ( b ) : if a [ i ] < b [ p ] : a [ i ] = b [ p ] p += 1 i += 1 print ( ' ' . join ( a ) ) NEW_LINE


n = str ( input ( ) ) s = str ( input ( ) ) ref = 10 * [ 0 ] for j in range ( len ( s ) ) : index = ord ( s [ j ] ) - 48 ref [ index ] += 1 for j in range ( len ( n ) ) : output = n [ j ] num = ord ( n [ j ] ) - 48 for k in range ( 9 , num , - 1 ) : if ref [ k ] > 0 : output = str ( k ) ref [ k ] -= 1 break print ( end = output ) NEW_LINE


import java . util . Scanner ;   public class B169 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; char [ ] A = in . next ( ) . toCharArray ( ) ; int [ ] stat = new int [ 10 ] ; for ( char c : in . next ( ) . toCharArray ( ) ) { stat [ c - '0' ] ++ ; } stat [ 0 ] ++ ; char replacement = '9' ; int idx = 0 ; while ( idx < A . length ) { while ( stat [ replacement - '0' ] == 0 ) replacement -- ; if ( A [ idx ] < replacement ) { A [ idx ] = replacement ; stat [ replacement - '0' ] -- ; } idx ++ ; } System . out . println ( new String ( A ) ) ; }   }


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


import java . util . Scanner ; import java . util . Arrays ; public class Ishu { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n , m , i , j ; String a , s ; char [ ] ch = new char [ 100000 ] ; a = scan . next ( ) ; s = scan . next ( ) ; n = a . length ( ) ; m = s . length ( ) ; ch = s . toCharArray ( ) ; Arrays . sort ( ch , 0 , m ) ; s = String . valueOf ( ch ) ; char [ ] A = a . toCharArray ( ) ; j = m - 1 ; for ( i = 0 ; i < n && j >= 0 ; ++ i ) if ( A [ i ] < s . charAt ( j ) ) { A [ i ] = s . charAt ( j ) ; j -- ; } a = String . valueOf ( A ) ; System . out . println ( a ) ; } }


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t , s , x ; boolean f = false ; t = sc . nextInt ( ) ; s = sc . nextInt ( ) ; x = sc . nextInt ( ) ; while ( t <= x ) { if ( t == x || t + s == x || t + s + 1 == x ) { System . out . println ( " YES " ) ; f = true ; break ; } t += s ; } if ( ! f ) System . out . println ( " NO " ) ; } }

a , b , c = map ( int , input ( ) . split ( ) )   if c < a : print ( " NO " ) else : NEW_LINE


from typing import Listimport heapqimport functoolsfrom collections import dequefrom functools import lru_cacheimport collectionsimport randomimport itertoolsfrom itertools import product as productfrom itertools import accumulate as accumulatefrom collections import defaultdictfrom collections import Counterfrom functools import cmp_to_key   import bisectimport mathimport sys   ''' xcopy ▁ / y ▁ D : \water\learning\python\codeForce . py ▁ line ▁ = ▁ sys . stdin . readline ( ) . strip ( ) n ▁ = ▁ int ( n ) s = ▁ input ( ) . strip ( ) t , ▁ v ▁ = ▁ tuple ( map ( int , ▁ input ( ) . strip ( ) . split ( ) ) ) ''' if __name__ == " _ _ main _ _ " :   t , s , x = tuple ( map ( int , input ( ) . strip ( ) . split ( ) ) ) Y = " YES " N = ' NO ' if x < t : print ( N ) exit ( ) m = t % s n = ( t + 1 ) % s l = x % s if m == l or ( n == l and x != t + 1 ) : print ( Y ) else : print ( N )   NEW_LINE


t , s , x = map ( int , input ( ) . split ( ) ) if x >= t : x -= t sss = x // s x = x % s if x == 0 or ( sss != 0 and x == 1 ) : print ( ' YES ' ) else : print ( ' NO ' ) else : print ( ' NO ' ) NEW_LINE


import mathdef solve ( t , s , x ) : if x < t : return ' NO ' if x == t : return ' YES ' if x < t + s : return ' NO ' if ( x - t ) % s == 0 or ( x - t - 1 ) % s == 0 : return ' YES ' return ' NO '                     def main ( ) : NEW_LINE


import java . util . Scanner ;   public class PineappleBark { public static void main ( String [ ] args ) {   Scanner in = new Scanner ( System . in ) ; long t = in . nextLong ( ) , s = in . nextLong ( ) , x = in . nextLong ( ) ;   in . close ( ) ; x -= t ; System . out . println ( ( ( x % s == 0 || x % s == 1 ) && x > 1 ) || x == 0 ? " YES " : " NO " ) ; } }


import java . util . * ;   public final class string { public static void main ( String [ ] Args ) { Scanner s = new Scanner ( System . in ) ; String S = s . nextLine ( ) ; String x = " " ; for ( int i = 0 ; i < S . length ( ) ; i ++ ) { x = " " ; x = x + S . charAt ( i ) ; switch ( x ) { case " a " : case " e " : case " i " : case " o " : case " A " : case " E " : case " I " : case " O " : case " U " : case " Y " : case " y " : case " u " : S = S . replace ( x , " " ) ; i -- ; break ; default : S = S . substring ( 0 , i ) + " . " + S . substring ( i ) ; i ++ ; break ;    } } S = S . toLowerCase ( ) ; System . out . println ( S ) ; } }

def task ( input ) : result = list ( ) vowels = [ " a " , " o " , " y " , " e " , " u " , " i " , " A " , " O " , " Y " , " E " , " U " , " I " ] for n in list ( input ) : if ( n not in vowels ) : result . append ( " . " ) result . append ( n . lower ( ) ) return ' ' . join ( result )     if __name__ == ' _ _ main _ _ ' : print ( task ( input ( ) ) ) NEW_LINE


a = input ( ) a = a . lower ( ) k = " aoyeui " r = " " for i in range ( len ( a ) ) : if a [ i ] not in k : r += " . " + a [ i ] print ( r ) NEW_LINE


n = input ( ) . lower ( ) m = ' ' for i in range ( len ( n ) ) : if n [ i ] not in " aoyeui " : m += n [ i ] print ( ' . ' + " . " . join ( m ) ) NEW_LINE


if __name__ == ' _ _ main _ _ ' : s = input ( ) temp = [ ] for i in s : if i in [ ' A ' , ' E ' , ' I ' , ' O ' , ' U ' , ' a ' , ' e ' , ' i ' , ' o ' , ' u ' , ' Y ' , ' y ' ] : continue else : temp . append ( ' . ' ) temp . append ( i . lower ( ) ) print ( " " . join ( temp ) ) NEW_LINE


s = list ( input ( ) ) v = [ " A " , " O " , " Y " , " E " , " U " , " I " , " a " , " o " , " y " , " e " , " u " , " i " ] for i in range ( len ( s ) ) : if s [ i ] not in v : if ord ( s [ i ] ) < 97 : print ( ' . ' , end = " " ) print ( chr ( ord ( s [ i ] ) + 32 ) , end = " " ) else : print ( ' . ' , end = " " ) print ( s [ i ] , end = " " ) NEW_LINE


import java . util . * ;   public class Main { public static void main ( String [ ] args ) { Scanner stdin = new Scanner ( System . in ) ; ArrayList < Character > v = new ArrayList < Character > ( ) ; v . add ( ' a ' ) ; v . add ( ' e ' ) ; v . add ( ' i ' ) ; v . add ( ' o ' ) ; v . add ( ' u ' ) ; v . add ( ' y ' ) ; String s = stdin . next ( ) ; String ans = " " ; s = s . toLowerCase ( ) ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( ! v . contains ( s . charAt ( i ) ) ) { ans += " . " + s . charAt ( i ) ; } } System . out . println ( ans ) ; } }


import java . util . Scanner ;   public class Main {   public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String input = scanner . next ( ) ; StringBuilder bld = new StringBuilder ( ) ; input = input . toLowerCase ( ) ; input = input . replaceAll ( " [ aeiouy ] " , " " ) ; if ( input . length ( ) > 0 ) { for ( int i = 0 ; i < input . length ( ) ; i ++ ) { bld . append ( " . " ) . append ( input . charAt ( i ) ) ; } } System . out . println ( bld ) ; } }


import java . util . * ;   public class Main {   public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String str = scanner . nextLine ( ) . toLowerCase ( ) ; char [ ] charArr = str . toCharArray ( ) ; List < Character > tempArr = new ArrayList < > ( ) ;   for ( int i = 0 ; i < charArr . length ; i ++ ) { char current = charArr [ i ] ; if ( current != ' a ' && current != ' e ' && current != ' i ' && current != ' o ' && current != ' u ' && current != ' y ' ) { tempArr . add ( ' . ' ) ; tempArr . add ( current ) ; } }   for ( int i = 0 ; i < tempArr . size ( ) ; i ++ ) { System . out . print ( tempArr . get ( i ) ) ; } }   }


import java . io . * ;    public class A187 { public static void main ( String [ ] args ) throws IOException { BufferedReader inp = new BufferedReader ( new InputStreamReader ( System . in ) ) ; BufferedWriter out = new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ; int size = Integer . parseInt ( inp . readLine ( ) ) ; int [ ] given = new int [ size ] ; String [ ] s1 = inp . readLine ( ) . split ( " ▁ " ) ; String [ ] s2 = inp . readLine ( ) . split ( " ▁ " ) ; int [ ] given1 = new int [ size ] ; for ( int i = 0 ; i < size ; i ++ ) { given1 [ i ] = Integer . parseInt ( s1 [ i ] ) ; given [ i ] = Integer . parseInt ( s2 [ i ] ) ; } int i = 0 ; int j = 0 ; int count = 0 ; while ( i < size && j < size ) { if ( given1 [ i ] == given [ j ] ) { count ++ ; i ++ ; j ++ ; } else { j ++ ; } } System . out . println ( size - count ) ;   } }

n = int ( input ( ) ) a1 = list ( map ( int , input ( ) . split ( ) ) ) a2 = list ( map ( int , input ( ) . split ( ) ) ) vis , j = set ( ) , n - 1 res = jfor i in range ( n - 1 , - 1 , - 1 ) : if a2 [ i ] in vis : continue if a2 [ i ] == a1 [ j ] : j -= 1 continue while a2 [ i ] != a1 [ j ] : vis . add ( a1 [ j ] ) j -= 1 j -= 1 res = j + 1 print ( n - res - 1 ) NEW_LINE


import sysinput = sys . stdin . readlinefrom math import * import bisect as bsn = int ( input ( ) ) a = [ int ( x ) for x in input ( ) . split ( ) ] b = [ int ( x ) for x in input ( ) . split ( ) ] d = { } for i in range ( n ) : d [ b [ i ] ] = i   c = 0 ans = 0 u = [ 0 for i in range ( n ) ] for i in range ( n ) : u [ i ] = d [ a [ i ] ] NEW_LINE


import java . util . Scanner ;     public class p187a { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int [ ] p1 = new int [ n ] ; int [ ] p2 = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) p1 [ i ] = in . nextInt ( ) - 1 ; for ( int i = 0 ; i < n ; i ++ ) p2 [ in . nextInt ( ) - 1 ] = i ; int prev = - 1 ; int i ; for ( i = 0 ; i < n && p2 [ p1 [ i ] ] > prev ; i ++ ) { prev = p2 [ p1 [ i ] ] ; } System . out . println ( n - i ) ; } }


import java . io . * ; import java . util . * ; public class Main implements Runnable { private void solve ( ) throws IOException { int n = nextInt ( ) ; int a [ ] = new int [ n + 1 ] ; int b [ ] = new int [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) a [ i ] = nextInt ( ) ; int pos [ ] = new int [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) pos [ nextInt ( ) ] = i ; for ( int i = 1 ; i <= n ; i ++ ) a [ i ] = pos [ a [ i ] ] ; int firstwrong = 1 ; while ( firstwrong <= n && a [ firstwrong ] == firstwrong ) firstwrong ++ ; int moves = 0 , k = 0 ; while ( firstwrong <= n ) { k ++ ; n -- ; moves ++ ; while ( firstwrong <= n && a [ firstwrong ] == firstwrong + k ) firstwrong ++ ; } out . println ( moves ) ; }


import java . util . Scanner ;   public class _0691RoomsandStaircases {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int cases = sc . nextInt ( ) ; while ( cases > 0 ) { int n = sc . nextInt ( ) ; sc . nextLine ( ) ; String s = sc . nextLine ( ) ; int pos = - 1 ; if ( ( n - s . lastIndexOf ( '1' ) - 1 ) <= ( s . indexOf ( '1' ) - 0 ) ) { pos = s . lastIndexOf ( '1' ) ; } else { pos = s . indexOf ( '1' ) ; }

from __future__ import division , print_functionfrom collections import * from math import * from itertools import * import osimport sysfrom io import BytesIO , IOBaseimport math NEW_LINE


t = int ( input ( ) )   def solve ( ) : n = int ( input ( ) ) s = input ( )   if all ( map ( lambda x : x == '0' , s ) ) : return n if all ( map ( lambda x : x == '1' , s ) ) : return n * 2   a = b = None for i in range ( n ) : if s [ i ] == '1' and a is None : a = i if s [ i ] == '1' : b = i   NEW_LINE


def read ( ) : return list ( map ( int , input ( ) . split ( ) ) )     def run ( ) : [ n ] = read ( ) s = input ( ) left = s . find ( '1' ) right = s [ : : - 1 ] . find ( '1' ) if left == - 1 : return n return 2 * n - 2 * min ( left , right )     [ t ] = read ( ) for i in range ( t ) : print ( run ( ) ) NEW_LINE


for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) li = input ( ) if li [ 0 ] == '1' or li [ - 1 ] == '1' : print ( n * 2 ) elif '1' not in li : print ( n ) else : k1 = n - li . index ( '1' ) k2 = li . rindex ( '1' ) + 1 res = max ( k1 * 2 , k2 * 2 ) print ( res ) NEW_LINE


import java . util . * ;   public class Test { public static void main ( String [ ] args ) {   Scanner input = new Scanner ( System . in ) ; int t = input . nextInt ( ) ;   while ( t -- > 0 ) {   int n = input . nextInt ( ) ; char [ ] s = input . next ( ) . toCharArray ( ) ;   int min = - 1 ; for ( int i = 0 ; i < n ; i ++ ) { if ( s [ i ] == '1' ) { int temp = Math . min ( i , n - i - 1 ) ; if ( temp < min || min == - 1 ) { min = i ; } } }   int res = 0 ; if ( min > - 1 ) { int temp = Math . min ( min , n - 1 - min ) ; res += 2 * ( n - temp ) ; } System . out . println ( ( min > - 1 ) ? Math . max ( res , n ) : n ) ; } } }


import java . io . * ; import java . util . * ; public class Main { public static void main ( String args [ ] ) { FastReader input = new FastReader ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; int T = input . nextInt ( ) ; while ( T -- > 0 ) { int n = input . nextInt ( ) ; String s = input . next ( ) ; int l = - 1 ; for ( int i = 0 ; i < n ; i ++ ) { if ( s . charAt ( i ) == '1' ) { l = i ; break ; } } if ( l == - 1 ) { out . println ( n ) ; } else { int r = - 1 ; for ( int i = n - 1 ; i >= 0 ; i -- ) { if ( s . charAt ( i ) == '1' ) { r = i ; break ; } } int d1 = r + 1 ; int d2 = n - l ; out . println ( Math . max ( d1 * 2 , d2 * 2 ) ) ; } } out . close ( ) ; } static class FastReader { BufferedReader br ; StringTokenizer st ;   public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; }   String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   long nextLong ( ) {   return Long . parseLong ( next ( ) ) ; }   double nextDouble ( ) {   return Double . parseDouble ( next ( ) ) ; }   String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } }


import java . util . * ; public class RoomsandStaircases {   public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; for ( int t1 = 1 ; t1 <= t ; t1 ++ ) { int n = sc . nextInt ( ) ; sc . nextLine ( ) ; String s = sc . nextLine ( ) ; int idx1 = s . indexOf ( "1" ) ; int idx2 = s . lastIndexOf ( "1" ) ; if ( idx2 == - 1 ) { System . out . println ( n ) ; continue ; } if ( idx2 == n - 1 || idx1 == 0 ) { System . out . println ( n * 2 ) ; continue ; } if ( idx1 == idx2 ) { int diff = n - idx2 ; if ( idx1 + 1 >= diff ) { System . out . println ( ( idx1 + 1 ) * 2 ) ; continue ; } else { System . out . println ( ( diff ) * 2 ) ; continue ; } } int diff = n - idx1 ; if ( diff >= idx2 + 1 ) { System . out . println ( ( diff ) * 2 ) ; continue ; } else { System . out . println ( ( idx2 + 1 ) * 2 ) ; continue ; } } sc . close ( ) ; } }


import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- != 0 ) { int len = sc . nextInt ( ) ; sc . nextLine ( ) ; String str = sc . nextLine ( ) ; int top0 = str . indexOf ( "0" ) ; int top1 = str . indexOf ( "1" ) ; int end0 = str . lastIndexOf ( "0" ) ; int end1 = str . lastIndexOf ( "1" ) ; if ( top0 == - 1 ) { System . out . println ( 2 * len ) ; continue ; } if ( top1 == - 1 ) { System . out . println ( len ) ; continue ; } int temp1 = Math . abs ( top0 - top1 ) + 1 ; int temp2 = Math . abs ( top0 - end1 ) + 1 ; int temp3 = Math . abs ( top1 - end0 ) + 1 ; int temp4 = Math . abs ( top1 - end1 ) + 1 ; int max = Math . max ( Math . max ( temp1 , temp2 ) , Math . max ( temp3 , temp4 ) ) ; System . out . println ( max * 2 ) ; } } }


import java . util . * ;   public class Program { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) , m [ ] = new int [ 100001 ] ; for ( int i = 0 ; i < n ; i ++ ) { int x = in . nextInt ( ) , k = in . nextInt ( ) ; if ( m [ k ] < x ) { System . out . println ( " NO " ) ; return ; } else if ( m [ k ] == x ) m [ k ] ++ ; } System . out . println ( " YES " ) ; } }

p = { } for i in range ( int ( input ( ) ) ) : x , k = map ( int , input ( ) . split ( ) ) if k in p : if x == p [ k ] + 1 : p [ k ] = x elif x > p [ k ] : print ( ' NO ' ) exit ( 0 ) elif x : print ( ' NO ' ) exit ( 0 ) else : p [ k ] = 0 print ( ' YES ' ) NEW_LINE


n = int ( input ( ) ) from collections import defaultdicta = defaultdict ( lambda : { - 1 } ) for i in range ( n ) : x , k = map ( int , input ( ) . split ( ) ) p = a [ k ] if x - 1 not in p : print ( ' NO ' ) break else : a [ k ] . add ( x ) else : print ( ' YES ' ) NEW_LINE


a = [ ] d = { } flag = 0 for t in range ( int ( input ( ) ) ) : x , y = map ( int , input ( ) . split ( ) ) if y in d . keys ( ) : if x == 0 and len ( d [ y ] ) == 0 : d [ y ] . append ( x ) if d [ y ] [ len ( d [ y ] ) - 1 ] + 1 == x : d [ y ] . append ( x ) elif x <= d [ y ] [ len ( d [ y ] ) - 1 ] : continue else : flag = 1 break else : d [ y ] = [ ] if x != 0 : flag = 1 break else : d [ y ] . append ( 0 )   if flag == 0 : print ( " YES " ) else : print ( " NO " )       NEW_LINE


def solve ( ) : n = int ( input ( ) ) p = True d = [ ] for _ in range ( int ( 1e5 + 1 ) ) : d . append ( set ( ) )   for _ in range ( n ) : x , k = map ( int , input ( ) . split ( ) ) if x > 0 and x - 1 not in d [ k ] : p = False else : d [ k ] . add ( x ) print ( ' YES ' if p else ' NO ' )     solve ( ) NEW_LINE


import java . io . * ; import java . util . * ;   public final class Template {   private static int hashofIds [ ] = new int [ 100001 ] ;   public static void main ( String [ ] args ) { FastScanner sc = new FastScanner ( System . in ) ;   int n = sc . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) { int x = sc . nextInt ( ) ; int id = sc . nextInt ( ) ; if ( hashofIds [ id ] < x ) { System . out . println ( " NO " ) ; return ; } else if ( hashofIds [ id ] == x ) hashofIds [ id ] ++ ; } System . out . println ( " YES " ) ; } }   class FastScanner { BufferedReader br ; StringTokenizer st ;   public FastScanner ( InputStream stream ) { br = new BufferedReader ( new InputStreamReader ( stream ) ) ; }   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 ( ) ) ; }   public long nextLong ( ) { return Long . parseLong ( next ( ) ) ; }   public double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; }   public String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; }   public int [ ] readArray ( int n ) { int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextInt ( ) ; return a ; } }


import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; for ( int i = 0 ; i < t ; i ++ ) { int ans = 0 ; int ele = sc . nextInt ( ) ; int r = ele % 10 ; ans = ( r - 1 ) * 10 ; int v = 0 ; while ( ele % 10 > 0 ) { v ++ ; ele = ele / 10 ; } ans = ans + ( v * ( v + 1 ) ) / 2 ; System . out . println ( ans ) ; } } }

def main ( ) : t = int ( input ( ) ) NEW_LINE for _ in range ( t ) : n = input ( ) NEW_LINE total = ( 4 * ( int ( n [ 0 ] ) - 1 ) + len ( n ) ) NEW_LINE arr = [ ( i % 4 ) + 1 for i in range ( total ) ] NEW_LINE print ( sum ( arr ) )     if __name__ == ' _ _ main _ _ ' : main ( ) NEW_LINE


for _ in range ( int ( input ( ) ) ) : n = input ( ) NEW_LINE a = int ( n [ 0 ] ) NEW_LINE d = { 1 : 1 , 2 : 3 , 3 : 6 , 4 : 10 } NEW_LINE print ( ( a - 1 ) * 10 + d [ len ( n ) ] ) NEW_LINE


for _ in range ( int ( input ( ) ) ) : a = ( ( input ( ) ) ) NEW_LINE b = str ( a [ 0 ] ) NEW_LINE b = int ( b ) NEW_LINE if len ( a ) == 1 : NEW_LINE INDENT print ( ( b - 1 ) * 10 + 1 ) elif len ( a ) == 2 : NEW_LINE print ( ( b - 1 ) * 10 + 3 ) elif len ( a ) == 3 : NEW_LINE print ( ( b - 1 ) * 10 + 6 ) else : NEW_LINE print ( b * 10 ) NEW_LINE DEDENT


t = int ( input ( ) ) NEW_LINE ans = [ ]   for _ in range ( t ) : s = input ( ) NEW_LINE c = 1 NEW_LINE start = '1'   while not ( start == s ) : if NEW_LINE int ( start + start [ 0 ] ) > 10000 : start = str ( int ( start [ 0 ] ) + 1 ) NEW_LINE c += len ( start ) NEW_LINE continue NEW_LINE start += start [ 0 ] NEW_LINE c += len ( start )   ans . append ( c )   for i in ans : print ( i ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ;   public class CF1433A { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int t = Integer . parseInt ( br . readLine ( ) ) ; int [ ] arr = new int [ 10000 ] ; int ctr = 0 ; for ( int i = 1 ; i < 10 ; i ++ ) { String idx = " " ; for ( int j = 0 ; j < 4 ; j ++ ) { idx += i ; ctr += j + 1 ; arr [ Integer . parseInt ( idx ) ] = ctr ; } } while ( t -- > 0 ) { System . out . println ( arr [ Integer . parseInt ( br . readLine ( ) ) ] ) ; } } }


import java . util . Scanner ;   public class Main {   public static void main ( String [ ] args ) { BoringApartments ( ) ; }   public static void BoringApartments ( ) { Scanner mScanner = new Scanner ( System . in ) ; int task = mScanner . nextInt ( ) ; if ( task <= 36 && task >= 1 ) { for ( int i = 1 ; i <= task ; i ++ ) { int taskNumber = mScanner . nextInt ( ) ; if ( taskNumber >= 1 && taskNumber <= 9999 ) { if ( taskNumber % 10 == 1 ) { System . out . println ( TotalPressedCharacter ( taskNumber ) ) ; } else if ( taskNumber % 10 == 2 ) { System . out . println ( TotalPressedCharacter ( taskNumber ) + 10 ) ; } else if ( taskNumber % 10 == 3 ) { System . out . println ( TotalPressedCharacter ( taskNumber ) + 20 ) ; } else if ( taskNumber % 10 == 4 ) { System . out . println ( TotalPressedCharacter ( taskNumber ) + 30 ) ; } else if ( taskNumber % 10 == 5 ) { System . out . println ( TotalPressedCharacter ( taskNumber ) + 40 ) ; } else if ( taskNumber % 10 == 6 ) { System . out . println ( TotalPressedCharacter ( taskNumber ) + 50 ) ; } else if ( taskNumber % 10 == 7 ) { System . out . println ( TotalPressedCharacter ( taskNumber ) + 60 ) ; } else if ( taskNumber % 10 == 8 ) { System . out . println ( TotalPressedCharacter ( taskNumber ) + 70 ) ; } else if ( taskNumber % 10 == 9 ) { System . out . println ( TotalPressedCharacter ( taskNumber ) + 80 ) ; } } } } } static int TotalPressedCharacter ( int x ) { String cha = String . valueOf ( x ) ; int count = 0 ; for ( int n = 0 ; n < cha . length ( ) ; n ++ ) { if ( n == 0 ) { count = 1 ; } else if ( n == 1 ) { count = count + 2 ; } else if ( n == 2 ) { count = count + 3 ; } else if ( n == 3 ) { count = count + 4 ; } } return count ; } }


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

n = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) j = 0 f = [ 0 ] * nfor i in range ( n - 1 ) : f [ j ] += 1 if arr [ i + 1 ] <= arr [ i ] : j = j + 1 if arr [ n - 1 ] >= arr [ n - 2 ] : f [ j ] += 1 f . sort ( ) print ( f [ n - 1 ] ) NEW_LINE


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


n = int ( input ( ) )   a = [ int ( x ) for x in input ( ) . split ( ) ]   max_length_local = 1   max_length = 1   i = 0   while i < ( n - 1 ) : if a [ i + 1 ] > a [ i ] : max_length_local += 1 else : max_length_local = 1   if max_length_local > max_length : max_length = max_length_local   i += 1   print ( max_length ) NEW_LINE


length = int ( input ( ) ) array = list ( map ( int , input ( ) . rstrip ( ) . split ( ) ) ) max_count , count = 1 , 1 for i in range ( 1 , length ) : if array [ i - 1 ] < array [ i ] : count += 1 if max_count < count : max_count = count else : count = 1   print ( max_count ) NEW_LINE


import java . util . * ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; } int max = 1 ; int maxHere = 1 ; for ( int i = 1 ; i < n ; i ++ ) { if ( arr [ i ] > arr [ i - 1 ] ) { maxHere ++ ; if ( maxHere > max ) max = maxHere ; } else maxHere = 1 ; } System . out . print ( max ) ; } }


import java . util . * ; import java . io . * ; import java . lang . * ;   public class Solution { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = sc . nextInt ( ) ; int max = 1 ; int temp = 1 ; for ( int i = 1 ; i < n ; i ++ ) { if ( a [ i ] > a [ i - 1 ] ) temp ++ ; else temp = 1 ; if ( temp > max ) max = temp ; } System . out . println ( max ) ; } }


import java . util . Scanner ;   public class MaximumIncrease { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = Integer . parseInt ( scanner . nextLine ( ) ) ;   int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = scanner . nextInt ( ) ; }   int currentMax = 1 ; int globalMax = 1 ; int prev = arr [ 0 ] ; for ( int i = 1 ; i < n ; i ++ ) { if ( arr [ i ] > prev ) { currentMax ++ ; } else { currentMax = 1 ; }   prev = arr [ i ] ;   if ( currentMax > globalMax ) { globalMax = currentMax ; }   }   System . out . println ( globalMax ) ; } }