import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; MyReader in = new MyReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskC solver = new TaskC ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskC { public void solve ( int testNumber , MyReader in , PrintWriter out ) { int M = 100005 ; int [ ] cnt = new int [ 100005 ] ; int N = in . nextInt ( ) ; for ( int i = 0 ; i < N ; i ++ ) { int a = in . nextInt ( ) ; cnt [ a ] ++ ; } int ma = 0 ; for ( int i = 0 ; i < M ; i ++ ) { int tot = cnt [ i ] ; if ( i > 0 ) tot += cnt [ i - 1 ] ; if ( i + 1 < M ) tot += cnt [ i + 1 ] ; ma = Math . max ( ma , tot ) ; } out . println ( ma ) ; } } static class MyReader { public BufferedReader reader ; public StringTokenizer tokenizer ; public MyReader ( InputStream stream ) { reader = new BufferedReader ( new InputStreamReader ( stream ) , 32768 ) ; tokenizer = null ; } public String next ( ) { while ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } } }

from collections import defaultdict NEW_LINE N = int ( input ( ) ) NEW_LINE As = map ( int , input ( ) . split ( ) ) NEW_LINE counts = defaultdict ( int ) NEW_LINE for a in As : NEW_LINE INDENT counts [ a - 1 ] += 1 NEW_LINE counts [ a ] += 1 NEW_LINE counts [ a + 1 ] += 1 NEW_LINE DEDENT print ( max ( counts . values ( ) ) ) NEW_LINE


N = int ( input ( ) ) NEW_LINE def inpl ( ) : return [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE ctr = [ 0 for _ in range ( 10 ** 5 + 2 ) ] NEW_LINE a = inpl ( ) NEW_LINE for i in a : NEW_LINE INDENT ctr [ i ] += 1 NEW_LINE DEDENT subsum = ctr [ 0 ] + ctr [ 1 ] + ctr [ 2 ] NEW_LINE ans = subsum NEW_LINE for i in range ( 2 , 10 ** 5 + 1 ) : NEW_LINE INDENT subsum = subsum - ctr [ i - 2 ] + ctr [ i + 1 ] NEW_LINE ans = max ( ans , subsum ) NEW_LINE DEDENT print ( ans ) NEW_LINE


input ( ) ; a = [ 0 ] * 100000 NEW_LINE for i in map ( int , input ( ) . split ( ) ) : a [ i ] += 1 NEW_LINE print ( max ( map ( sum , zip ( a , a [ 1 : ] , a [ 2 : ] ) ) ) ) NEW_LINE


def main ( ) : NEW_LINE INDENT N = int ( input ( ) ) NEW_LINE a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE a . sort ( ) NEW_LINE r = 0 NEW_LINE i , j = 0 , 0 NEW_LINE while i < N : NEW_LINE INDENT while j < N : NEW_LINE INDENT if a [ j ] - a [ i ] <= 2 : NEW_LINE INDENT j += 1 NEW_LINE DEDENT else : NEW_LINE INDENT break NEW_LINE DEDENT DEDENT r = max ( r , j - i ) NEW_LINE if j == N : NEW_LINE INDENT break NEW_LINE DEDENT i += 1 NEW_LINE DEDENT print ( r ) NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT main ( ) NEW_LINE DEDENT


import collections NEW_LINE N = int ( input ( ) ) NEW_LINE A = list ( map ( int , input ( ) . split ( ' ▁ ' ) ) ) NEW_LINE counter = collections . Counter ( A ) NEW_LINE Y = sorted ( list ( counter . keys ( ) ) ) NEW_LINE ans = - 1 NEW_LINE if max ( Y ) - min ( Y ) <= 2 : NEW_LINE INDENT ans = N NEW_LINE DEDENT else : NEW_LINE INDENT Y_all = [ counter [ i ] for i in range ( min ( Y ) , max ( Y ) + 1 ) ] NEW_LINE for i in range ( len ( Y_all ) - 2 ) : NEW_LINE INDENT ans = max ( sum ( Y_all [ i : i + 3 ] ) , ans ) NEW_LINE DEDENT DEDENT print ( ans ) NEW_LINE


import java . util . HashMap ; import java . util . Scanner ; import java . util . StringJoiner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; StringJoiner sj = new StringJoiner ( " \n " ) ; for ( int i = 0 ; i < 2 ; i ++ ) { sj . add ( scanner . nextLine ( ) ) ; } System . out . println ( solve ( sj . toString ( ) ) ) ; } private static int solve ( String stdinString ) { String [ ] splits = stdinString . split ( " \n " ) ; int N = Integer . parseInt ( splits [ 0 ] ) ; int [ ] nums = new int [ N ] ; splits = splits [ 1 ] . split ( " ▁ " ) ; for ( int i = 0 ; i < N ; i ++ ) { nums [ i ] = Integer . parseInt ( splits [ i ] ) ; } int max = Integer . MIN_VALUE ; HashMap < Integer , Integer > xCounts = new HashMap < > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { xCounts . put ( nums [ i ] - 1 , xCounts . getOrDefault ( nums [ i ] - 1 , 0 ) + 1 ) ; max = Math . max ( max , xCounts . get ( nums [ i ] - 1 ) ) ; xCounts . put ( nums [ i ] , xCounts . getOrDefault ( nums [ i ] , 0 ) + 1 ) ; max = Math . max ( max , xCounts . get ( nums [ i ] ) ) ; xCounts . put ( nums [ i ] + 1 , xCounts . getOrDefault ( nums [ i ] + 1 , 0 ) + 1 ) ; max = Math . max ( max , xCounts . get ( nums [ i ] + 1 ) ) ; } return max ; } private static String ex1 = "7 \n 3 ▁ 1 ▁ 4 ▁ 1 ▁ 5 ▁ 9 ▁ 2" ; private static String ex2 = "10 \n 0 ▁ 1 ▁ 2 ▁ 3 ▁ 4 ▁ 5 ▁ 6 ▁ 7 ▁ 8 ▁ 9" ; private static String ex3 = "1 \n 99999" ; private static void tests ( ) { System . out . println ( solve ( ex1 ) ) ; System . out . println ( solve ( ex2 ) ) ; System . out . println ( solve ( ex3 ) ) ; } }


import java . util . * ; import java . util . stream . * ; import static java . lang . System . * ; class Main { static Scanner sc = new Scanner ( System . in ) ; static int nextInt ( ) { return Integer . parseInt ( sc . next ( ) ) ; } static int [ ] nextIntArray ( int n ) { return IntStream . range ( 0 , n ) . map ( i -> nextInt ( ) ) . toArray ( ) ; } static int max ( int ... ar ) { Arrays . sort ( ar ) ; return ar [ ar . length - 1 ] ; } static int min ( int ... ar ) { Arrays . sort ( ar ) ; return ar [ 0 ] ; } static String yesno ( boolean b ) { return b ? " Yes " : " No " ; } public static void main ( String [ ] args ) { HashMap < Integer , Integer > map = new HashMap < > ( ) ; int n = nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) { int temp = nextInt ( ) ; map . put ( temp , map . getOrDefault ( temp , 0 ) + 1 ) ; map . put ( temp + 1 , map . getOrDefault ( temp + 1 , 0 ) + 1 ) ; map . put ( temp - 1 , map . getOrDefault ( temp - 1 , 0 ) + 1 ) ; } int max = Integer . MIN_VALUE ; for ( Map . Entry < Integer , Integer > e : map . entrySet ( ) ) { max = Math . max ( max , e . getValue ( ) ) ; } out . println ( max ) ; } }


import java . util . * ; import java . lang . * ; class Pair implements Comparable < Pair > { int a ; int cnt ; public Pair ( int i , int j ) { this . a = i ; this . cnt = j ; } public int compareTo ( Pair p ) { if ( this . cnt == p . cnt ) return 0 ; if ( this . cnt < p . cnt ) return - 1 ; return 1 ; } } class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . next ( ) ) ; HashMap < Integer , Pair > map = new HashMap < > ( ) ; ArrayList < Pair > l = new ArrayList < > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { int c = Integer . parseInt ( sc . next ( ) ) ; for ( int j = 0 ; j < 3 ; j ++ ) { if ( j == 1 ) c -- ; else if ( j == 2 ) c += 2 ; if ( ! map . containsKey ( c ) ) { Pair p = new Pair ( c , 1 ) ; map . put ( c , p ) ; l . add ( p ) ; } else { Pair p = map . get ( c ) ; p . cnt ++ ; } } } Collections . sort ( l ) ; Pair res = l . get ( l . size ( ) - 1 ) ; System . out . println ( res . cnt ) ; } }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . HashMap ; import java . util . Map ; public class Main { public static Map < Integer , Integer > map = new HashMap < Integer , Integer > ( ) ; public static int max = 0 ; public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { int in1 = Integer . parseInt ( br . readLine ( ) ) ; String [ ] in2 = br . readLine ( ) . split ( " ▁ " ) ; for ( String str : in2 ) { int key = Integer . parseInt ( str ) ; setMap ( key , 0 ) ; setMap ( key , + 1 ) ; setMap ( key , - 1 ) ; } System . out . println ( max ) ; } catch ( Exception e ) { System . exit ( 0 ) ; } } public static void setMap ( int key , int num ) { int key2 = key + num ; int val = 0 ; if ( map . containsKey ( key2 ) ) { val = map . get ( key2 ) ; } val += 1 ; map . put ( key2 , val ) ; if ( val > max ) { max = val ; } } }


import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; if ( a == 1 ) { System . out . println ( " ABC " ) ; } else { System . out . println ( " chokudai " ) ; } } }

n = int ( input ( ) ) NEW_LINE if n == 1 : NEW_LINE INDENT print ( ' ABC ' ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( ' chokudai ' ) NEW_LINE DEDENT


print ( [ ' ABC ' , ' chokudai ' ] [ int ( input ( ) ) - 1 ] ) NEW_LINE


q = int ( input ( ) ) NEW_LINE print ( " ABC " if q == 1 else " chokudai " ) NEW_LINE


hoge = " ABC " if int ( input ( ) ) == 1 else " chokudai " NEW_LINE print ( hoge ) NEW_LINE


q = int ( input ( ) ) NEW_LINE ans = " " NEW_LINE if q == 1 : NEW_LINE INDENT ans = " ABC " NEW_LINE DEDENT else : NEW_LINE INDENT ans = " chokudai " NEW_LINE DEDENT print ( ans ) NEW_LINE


import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . InputMismatchException ; import java . io . IOException ; import java . io . InputStream ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; FastScanner in = new FastScanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskA solver = new TaskA ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskA { public void solve ( int testNumber , FastScanner in , PrintWriter out ) { out . println ( in . nextInt ( ) == 1 ? " ABC " : " chokudai " ) ; } } static class FastScanner { private InputStream in ; private byte [ ] buffer = new byte [ 1024 ] ; private int bufPointer ; private int bufLength ; public FastScanner ( InputStream in ) { this . in = in ; this . bufPointer = 0 ; this . bufLength = 0 ; } private int readByte ( ) { if ( bufPointer >= bufLength ) { if ( bufLength == - 1 ) throw new InputMismatchException ( ) ; bufPointer = 0 ; try { bufLength = in . read ( buffer ) ; } catch ( IOException e ) { throw new InputMismatchException ( ) ; } if ( bufLength <= 0 ) return - 1 ; } return buffer [ bufPointer ++ ] ; } private static boolean isSpaceChar ( int c ) { return c == ' ▁ ' || c == ' \n ' || c == ' \r ' || c == ' \t ' || c == - 1 ; } public int nextInt ( ) { int n = 0 ; int b = readByte ( ) ; while ( isSpaceChar ( b ) ) b = readByte ( ) ; boolean minus = ( b == ' - ' ) ; if ( minus ) b = readByte ( ) ; while ( b >= '0' && b <= '9' ) { n *= 10 ; n += b - '0' ; b = readByte ( ) ; } if ( ! isSpaceChar ( b ) ) throw new NumberFormatException ( ) ; return minus ? - n : n ; } } }


import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { MyScanner sc = new MyScanner ( ) ; int a = sc . nextInt ( ) ; System . out . println ( a == 1 ? " ABC " : " chokudai " ) ; } static int l_min ( int [ ] a ) { Arrays . sort ( a ) ; return a [ 0 ] ; } static int l_max ( int [ ] a ) { int l = a . length ; Arrays . sort ( a ) ; return a [ l - 1 ] ; } public static PrintWriter out ; public static class MyScanner { BufferedReader br ; StringTokenizer st ; public MyScanner ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . OutputStream ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; Task solver = new Task ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class Task { public void solve ( int testNumber , InputReader in , PrintWriter out ) { int Q = in . nextInt ( ) ; out . println ( ( Q == 1 ) ? " ABC " : " chokudai " ) ; } } static class InputReader { public BufferedReader reader ; public StringTokenizer tokenizer ; public InputReader ( InputStream stream ) { reader = new BufferedReader ( new InputStreamReader ( stream ) , 32768 ) ; tokenizer = null ; } public String next ( ) { while ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } } }


import java . util . * ; import java . util . stream . * ; import static java . lang . System . * ; class Main { static Scanner sc = new Scanner ( System . in ) ; static int nextInt ( ) { return Integer . parseInt ( sc . next ( ) ) ; } static int [ ] nextIntArray ( int n ) { return IntStream . range ( 0 , n ) . map ( i -> nextInt ( ) ) . toArray ( ) ; } static int max ( int ... ar ) { Arrays . sort ( ar ) ; return ar [ ar . length - 1 ] ; } static int min ( int ... ar ) { Arrays . sort ( ar ) ; return ar [ 0 ] ; } static int maxInt = Integer . MAX_VALUE ; static int minInt = Integer . MIN_VALUE ; public static void main ( String [ ] args ) { out . println ( nextInt ( ) == 1 ? " ABC " : " chokudai " ) ; } }


import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; System . out . println ( S . replaceFirst ( "2017" , "2018" ) ) ; } }

S = input ( ) NEW_LINE print ( S . replace ( '7' , '8' , 1 ) ) NEW_LINE


print ( input ( 2018 ) [ 4 : ] ) NEW_LINE


S = input ( ) NEW_LINE S = list ( S ) NEW_LINE S [ 3 ] = "8" NEW_LINE S = " " . join ( S ) NEW_LINE print ( S ) NEW_LINE


a = input ( ) NEW_LINE list = a . split ( ' / ' ) NEW_LINE print ( '2018 / ' + list [ 1 ] + ' / ' + list [ 2 ] ) NEW_LINE


print ( '8' . join ( input ( ) . split ( '7' , 1 ) ) ) NEW_LINE


import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { PrintWriter out = new PrintWriter ( System . out ) ; InputStreamScanner in = new InputStreamScanner ( System . in ) ; new Main ( ) . solve ( in , out ) ; out . flush ( ) ; } private void solve ( InputStreamScanner in , PrintWriter out ) { out . println ( in . next ( ) . replace ( "2017" , "2018" ) ) ; } static class InputStreamScanner { private InputStream in ; private byte [ ] buf = new byte [ 1024 ] ; private int len = 0 ; private int off = 0 ; InputStreamScanner ( InputStream in ) { this . in = in ; } String next ( ) { StringBuilder sb = new StringBuilder ( ) ; for ( int b = skip ( ) ; ! isSpace ( b ) ; ) { sb . appendCodePoint ( b ) ; b = read ( ) ; } return sb . toString ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } char nextChar ( ) { return ( char ) skip ( ) ; } int skip ( ) { for ( int b ; ( b = read ( ) ) != - 1 ; ) { if ( ! isSpace ( b ) ) { return b ; } } return - 1 ; } private boolean isSpace ( int c ) { return c < 33 || c > 126 ; } private int read ( ) { if ( len == - 1 ) { throw new InputMismatchException ( " End ▁ of ▁ Input " ) ; } if ( off >= len ) { off = 0 ; try { len = in . read ( buf ) ; } catch ( IOException e ) { throw new InputMismatchException ( e . getMessage ( ) ) ; } if ( len <= 0 ) { return - 1 ; } } return buf [ off ++ ] ; } } }


import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . PriorityQueue ; import java . util . Scanner ; import java . util . TreeSet ; import org . omg . Messaging . SyncScopeHelper ; public class Main { Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { new Main ( ) ; } public Main ( ) { new Test_100 ( ) . doIt ( ) ; } class Test_100 { void doIt ( ) { String str [ ] = sc . next ( ) . split ( " / " ) ; System . out . println ( "2018 / " + str [ 1 ] + " / " + str [ 2 ] ) ; } } }


import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) . replace ( "2017" , "2018" ) ; System . out . println ( S ) ; } }


import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s ; s = sc . next ( ) ; char str [ ] = s . toCharArray ( ) ; str [ 3 ] = '8' ; System . out . println ( str ) ; sc . close ( ) ; } }


import java . util . Arrays ; import java . util . Scanner ; class Main { static Scanner s = new Scanner ( System . in ) ; static int gInt ( ) { return Integer . parseInt ( s . next ( ) ) ; } static long gLong ( ) { return Long . parseLong ( s . next ( ) ) ; } public static void main ( String [ ] $ ) { char [ ] c = s . next ( ) . toCharArray ( ) ; int n = c . length ; int [ ] rem = new int [ n ] ; int res = 0 , rem_ = 0 ; for ( int i = 0 ; i < n ; ++ i ) { if ( c [ i ] == ' g ' ) { ++ rem_ ; } else { if ( rem_ > 0 ) { -- rem_ ; } else { ++ res ; } } rem [ i ] = rem_ ; } System . out . println ( res + rem [ n - 1 ] / 2 ) ; } }

s = input ( ) NEW_LINE print ( len ( s ) // 2 - s . count ( ' p ' ) ) NEW_LINE


def getInt ( ) : return int ( input ( ) ) NEW_LINE def getIntList ( ) : return [ int ( x ) for x in input ( ) . split ( ) ] NEW_LINE def zeros ( n ) : return [ 0 ] * n NEW_LINE def getIntLines ( n ) : return [ int ( input ( ) ) for i in range ( n ) ] NEW_LINE def getIntMat ( n ) : NEW_LINE INDENT mat = [ ] NEW_LINE for i in range ( n ) : NEW_LINE INDENT mat . append ( getIntList ( ) ) NEW_LINE DEDENT return mat NEW_LINE DEDENT def zeros2 ( n , m ) : return [ zeros ( m ) ] * n NEW_LINE ALPHABET = [ chr ( i + ord ( ' a ' ) ) for i in range ( 26 ) ] NEW_LINE DIGIT = [ chr ( i + ord ( '0' ) ) for i in range ( 10 ) ] NEW_LINE def dmp ( x , cmt = ' ' ) : NEW_LINE INDENT global debug NEW_LINE if debug : NEW_LINE INDENT if cmt != ' ' : NEW_LINE INDENT print ( cmt , ' : ▁ ▁ ' , end = ' ' ) NEW_LINE DEDENT print ( x ) NEW_LINE DEDENT return x NEW_LINE DEDENT def probC ( ) : NEW_LINE INDENT S = input ( ) NEW_LINE dmp ( S ) NEW_LINE GU = ' g ' NEW_LINE PA = ' p ' NEW_LINE guCount = 0 NEW_LINE paCount = 0 NEW_LINE point = 0 NEW_LINE allTe = ' ' NEW_LINE for i in range ( len ( S ) ) : NEW_LINE INDENT if S [ i ] == GU : NEW_LINE INDENT if paCount < guCount : NEW_LINE INDENT te = PA NEW_LINE paCount += 1 NEW_LINE DEDENT else : NEW_LINE INDENT te = GU NEW_LINE guCount += 1 NEW_LINE DEDENT DEDENT else : NEW_LINE INDENT if paCount < guCount : NEW_LINE INDENT te = PA NEW_LINE paCount += 1 NEW_LINE DEDENT else : NEW_LINE INDENT te = GU NEW_LINE guCount += 1 NEW_LINE DEDENT DEDENT if te == GU and S [ i ] == PA : NEW_LINE INDENT point -= 1 NEW_LINE DEDENT elif te == PA and S [ i ] == GU : NEW_LINE INDENT point += 1 NEW_LINE DEDENT allTe += te NEW_LINE DEDENT dmp ( allTe , ' allTe ' ) NEW_LINE dmp ( point ) NEW_LINE return point NEW_LINE DEDENT debug = False NEW_LINE ans = probC ( ) NEW_LINE print ( ans ) NEW_LINE NEW_LINE


def inpl ( ) : NEW_LINE INDENT return list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE DEDENT S = input ( ) NEW_LINE ans = 0 NEW_LINE g = 0 NEW_LINE p = 0 NEW_LINE for s in S : NEW_LINE INDENT if g == p : NEW_LINE INDENT g += 1 NEW_LINE if s == " g " : NEW_LINE INDENT pass NEW_LINE DEDENT elif s == " p " : NEW_LINE INDENT ans -= 1 NEW_LINE DEDENT DEDENT else : NEW_LINE INDENT p += 1 NEW_LINE if s == " g " : NEW_LINE INDENT ans += 1 NEW_LINE DEDENT elif s == " p " : NEW_LINE INDENT pass NEW_LINE DEDENT DEDENT DEDENT print ( ans ) NEW_LINE


S = input ( ) NEW_LINE res = 0 NEW_LINE if S [ 0 ] == ' p ' : NEW_LINE INDENT res -= 1 NEW_LINE DEDENT p = 0 NEW_LINE g = 1 NEW_LINE for i in range ( 1 , len ( S ) ) : NEW_LINE INDENT if S [ i ] == ' p ' and p < g : NEW_LINE INDENT p += 1 NEW_LINE DEDENT elif S [ i ] == ' p ' and p >= g : NEW_LINE INDENT g += 1 NEW_LINE res -= 1 NEW_LINE DEDENT elif S [ i ] == ' g ' and p < g : NEW_LINE INDENT p += 1 NEW_LINE res += 1 NEW_LINE DEDENT else : NEW_LINE INDENT g += 1 NEW_LINE DEDENT DEDENT print ( res ) NEW_LINE


s = input ( ) NEW_LINE ans = 0 NEW_LINE for i , x in enumerate ( s ) : NEW_LINE INDENT if i % 2 == 0 and x == ' p ' : NEW_LINE INDENT ans -= 1 NEW_LINE DEDENT elif i % 2 == 1 and x == ' g ' : NEW_LINE INDENT ans += 1 NEW_LINE DEDENT DEDENT print ( ans ) NEW_LINE


import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader r = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String top = r . readLine ( ) ; boolean cpp = false ; int score = 0 ; for ( int j = 0 ; j < top . length ( ) ; j ++ ) { if ( cpp ) { if ( top . charAt ( j ) == ' g ' ) score ++ ; cpp = false ; } else { if ( top . charAt ( j ) == ' p ' ) score -- ; cpp = true ; } } System . out . println ( score ) ; } }


import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ; ) { new Main ( ) . solve ( sc ) ; } } void solve ( Scanner sc ) { char [ ] s = sc . next ( ) . toCharArray ( ) ; int p = 0 ; for ( char c : s ) { if ( c == ' p ' ) { p ++ ; } } System . out . println ( s . length / 2 - p ) ; } }


import java . util . * ; import java . util . stream . * ; import static java . lang . System . * ; class Main { static Scanner sc = new Scanner ( System . in ) ; static int nextInt ( ) { return Integer . parseInt ( sc . next ( ) ) ; } static int [ ] nextIntArray ( int n ) { return IntStream . range ( 0 , n ) . map ( i -> nextInt ( ) ) . toArray ( ) ; } static int max ( int ... ar ) { Arrays . sort ( ar ) ; return ar [ ar . length - 1 ] ; } static int min ( int ... ar ) { Arrays . sort ( ar ) ; return ar [ 0 ] ; } static String yesno ( boolean b ) { return b ? " Yes " : " No " ; } static int maxInt = Integer . MAX_VALUE ; static int minInt = Integer . MIN_VALUE ; public static void main ( String [ ] args ) { String s = sc . next ( ) ; int n = s . length ( ) ; int enemyP = 0 , enemyG = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( s . charAt ( i ) == ' p ' ) enemyP ++ ; else enemyG ++ ; } System . out . println ( n / 2 - enemyP ) ; } }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader r = new BufferedReader ( new InputStreamReader ( System . in ) , 1 ) ; String s = r . readLine ( ) ; int n = s . length ( ) ; int [ ] [ ] a = { { 0 , - 1 } , { 1 , 0 } } ; int p = 0 ; for ( int i = 0 ; i < n ; i ++ ) { p += a [ i % 2 ] [ s . charAt ( i ) == ' g ' ? 0 : 1 ] ; } System . out . println ( p ) ; } }


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 ( ) ; } sc . close ( ) ; boolean nodec = true ; for ( int i = 1 ; i < n ; i ++ ) { if ( a [ i ] <= a [ i - 1 ] ) nodec = false ; } if ( nodec ) { System . out . println ( 1 ) ; return ; } int m = 500 ; int l = 1 , r = 210000 ; int mid = 2 ; int [ ] dec = new int [ m ] ; out : while ( r - l > 1 ) { mid = ( l + r ) / 2 ; dec = new int [ m ] ; Arrays . fill ( dec , 1 ) ; nout : for ( int i = 1 ; i < n ; i ++ ) { if ( a [ i ] <= a [ i - 1 ] && a [ i ] - 1 < m ) { if ( dec [ a [ i ] - 1 ] < mid ) { dec [ a [ i ] - 1 ] ++ ; } else { int pos = a [ i ] - 1 ; while ( pos > 0 ) { dec [ pos - 1 ] ++ ; for ( int j = pos ; j < m ; j ++ ) { dec [ j ] = 1 ; } if ( dec [ pos - 1 ] <= mid ) continue nout ; pos -- ; } l = mid ; continue out ; } } else { for ( int j = a [ i ] - 1 ; j < m ; j ++ ) { dec [ j ] = 1 ; } } } r = mid ; } System . out . println ( r ) ; } }

N = int ( input ( ) ) NEW_LINE a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE if all ( i < j for i , j in zip ( a , a [ 1 : ] ) ) : NEW_LINE INDENT print ( 1 ) NEW_LINE exit ( ) NEW_LINE DEDENT keta_count = 19 NEW_LINE a = [ 10 ** 10 ] + [ v - 1 for v in a if v <= keta_count ] + [ 10 ** 10 ] NEW_LINE a = [ - 1 ] + [ j for i , j , k in zip ( a , a [ 1 : ] , a [ 2 : ] ) if not i < j > k ] NEW_LINE if len ( a ) == 1 : NEW_LINE INDENT print ( 2 ) NEW_LINE exit ( ) NEW_LINE DEDENT ok , ng = len ( a ) , 1 NEW_LINE while ok - ng > 1 : NEW_LINE INDENT mid = ( ok + ng ) // 2 NEW_LINE keta = [ 0 ] * keta_count NEW_LINE for prev , current in zip ( a , a [ 1 : ] ) : NEW_LINE INDENT if prev < current : NEW_LINE INDENT for i in range ( current , prev , - 1 ) : NEW_LINE INDENT keta [ i ] = 0 NEW_LINE DEDENT DEDENT else : NEW_LINE INDENT kuriage = 0 NEW_LINE for num in keta [ prev : current : - 1 ] : NEW_LINE INDENT kuriage = ( kuriage + num ) // mid NEW_LINE DEDENT keta [ current ] += kuriage + 1 NEW_LINE DEDENT DEDENT for i in range ( a [ - 1 ] , 0 , - 1 ) : NEW_LINE INDENT keta [ i - 1 ] += keta [ i ] // mid NEW_LINE DEDENT if keta [ 0 ] >= mid : NEW_LINE INDENT ng = mid NEW_LINE DEDENT else : NEW_LINE INDENT ok = mid NEW_LINE DEDENT DEDENT print ( ok ) NEW_LINE


import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . IOException ; import java . util . Arrays ; import java . util . TreeMap ; public class Main { private int n ; private int [ ] a ; private TreeMap < Integer , Integer > s ; public static void main ( String [ ] args ) { Main m = new Main ( ) ; m . solve ( ) ; } private void set ( ) { try ( BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { n = Integer . parseInt ( br . readLine ( ) ) ; a = Arrays . stream ( br . readLine ( ) . split ( " ▁ " ) ) . mapToInt ( Integer :: parseInt ) . toArray ( ) ; s = new TreeMap < > ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } private void solve ( ) { set ( ) ; int ng = 0 ; int ok = n ; while ( ok - ng > 1 ) { int k = ( ng + ok ) / 2 ; if ( isPossible ( k ) ) { ok = k ; } else { ng = k ; } } System . out . println ( ok ) ; } private boolean isPossible ( int k ) { s . clear ( ) ; int current = 0 ; for ( int ai : a ) { if ( ai <= current ) { if ( k == 1 ) return false ; while ( ! s . isEmpty ( ) && s . lastKey ( ) >= ai ) s . pollLastEntry ( ) ; int p = ai - 1 ; while ( true ) { if ( p < 0 ) return false ; int sp = s . getOrDefault ( p , 0 ) + 1 ; s . put ( p , sp ) ; if ( sp == k ) { s . remove ( p ) ; p -- ; } else { break ; } } } current = ai ; } return true ; } }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . OutputStream ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; Task solver = new Task ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class Task { public void solve ( int testNumber , InputReader in , PrintWriter out ) { int [ ] array = { in . nextInt ( ) , in . nextInt ( ) , in . nextInt ( ) } ; Arrays . sort ( array ) ; out . println ( array [ 1 ] ) ; } } static class InputReader { public BufferedReader reader ; public StringTokenizer tokenizer ; public InputReader ( InputStream stream ) { reader = new BufferedReader ( new InputStreamReader ( stream ) , 32768 ) ; tokenizer = null ; } public String next ( ) { while ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } } }

a , b , c = map ( int , input ( ) . split ( ) ) NEW_LINE l = [ a , b , c ] NEW_LINE l . sort ( ) NEW_LINE print ( l [ 1 ] ) NEW_LINE


s = input ( ) . split ( ) NEW_LINE a = int ( s [ 0 ] ) NEW_LINE b = int ( s [ 1 ] ) NEW_LINE c = int ( s [ 2 ] ) NEW_LINE if 1 <= a and b and c <= 100 : NEW_LINE INDENT if a < b < c or c < b < a or a == b == c : NEW_LINE INDENT print ( b ) NEW_LINE DEDENT elif a < c < b or b < c < a : NEW_LINE INDENT print ( c ) NEW_LINE DEDENT elif b < a < c or c < a < b : NEW_LINE INDENT print ( a ) NEW_LINE DEDENT elif a == b : NEW_LINE INDENT print ( a ) NEW_LINE DEDENT elif a == c or b == c : NEW_LINE INDENT print ( c ) NEW_LINE DEDENT DEDENT


print ( sorted ( map ( int , input ( ) . split ( ) ) ) [ 1 ] ) NEW_LINE


def solve ( ) : NEW_LINE INDENT a = list ( int ( i ) for i in input ( ) . split ( ) ) NEW_LINE a . sort ( ) NEW_LINE print ( a [ 1 ] ) NEW_LINE DEDENT solve ( ) NEW_LINE


abc = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE print ( sorted ( abc ) [ 1 ] ) NEW_LINE


import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int a [ ] = new int [ 3 ] , i , j ; for ( i = 0 ; i < 3 ; i ++ ) a [ i ] = sc . nextInt ( ) ; for ( i = 0 ; i < 3 ; i ++ ) { for ( j = 0 ; j < 3 ; j ++ ) { if ( a [ i ] < a [ j ] ) { int tmp = a [ i ] ; a [ i ] = a [ j ] ; a [ j ] = tmp ; } } } System . out . println ( a [ 1 ] ) ; } }


import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { MyScanner sc = new MyScanner ( ) ; int x [ ] = new int [ 3 ] ; x [ 0 ] = sc . nextInt ( ) ; x [ 1 ] = sc . nextInt ( ) ; x [ 2 ] = sc . nextInt ( ) ; Arrays . sort ( x ) ; System . out . println ( x [ 1 ] ) ; } static int l_min ( int [ ] a ) { Arrays . sort ( a ) ; return a [ 0 ] ; } static int l_max ( int [ ] a ) { int l = a . length ; Arrays . sort ( a ) ; return a [ l - 1 ] ; } public static PrintWriter out ; public static class MyScanner { BufferedReader br ; StringTokenizer st ; public MyScanner ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } }


import java . util . * ; import java . util . stream . * ; import static java . lang . System . * ; class Main { static Scanner sc = new Scanner ( System . in ) ; static int nextInt ( ) { return Integer . parseInt ( sc . next ( ) ) ; } static int [ ] nextIntArray ( int n ) { return IntStream . range ( 0 , n ) . map ( i -> nextInt ( ) ) . toArray ( ) ; } static int max ( int ... ar ) { Arrays . sort ( ar ) ; return ar [ ar . length - 1 ] ; } static int min ( int ... ar ) { Arrays . sort ( ar ) ; return ar [ 0 ] ; } static int maxInt = Integer . MAX_VALUE ; static int minInt = Integer . MIN_VALUE ; public static void main ( String [ ] args ) { int [ ] ar = nextIntArray ( 3 ) ; Arrays . sort ( ar ) ; out . println ( ar [ 1 ] ) ; } }


import java . util . Arrays ; import java . util . Scanner ; public class Main { private static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int [ ] a = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; System . out . println ( a [ 1 ] ) ; } }


import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; System . out . println ( a <= b ? a : a - 1 ) ; sc . close ( ) ; } }

a , b = map ( int , input ( ) . split ( ) ) NEW_LINE print ( a - int ( a > b ) ) NEW_LINE


a , b = map ( int , input ( ) . split ( ) ) NEW_LINE for i in range ( 1 , 13 ) : NEW_LINE INDENT if a > b : NEW_LINE INDENT ans = a - 1 NEW_LINE DEDENT else : NEW_LINE INDENT ans = a NEW_LINE DEDENT DEDENT print ( ans ) NEW_LINE


m , d = map ( int , input ( ) . split ( ) ) NEW_LINE res = 0 NEW_LINE if m <= d : NEW_LINE INDENT res = m NEW_LINE DEDENT else : NEW_LINE INDENT res = m - 1 NEW_LINE DEDENT print ( res ) NEW_LINE


l = [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE print ( l [ 0 ] if l [ 0 ] <= l [ 1 ] else l [ 0 ] - 1 ) NEW_LINE


a , b = ( int ( i ) for i in input ( ) . split ( ) ) NEW_LINE if a > b : print ( a - 1 ) NEW_LINE else : print ( a ) NEW_LINE


import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; ABC096_A solver = new ABC096_A ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class ABC096_A { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int a = in . nextInt ( ) ; int b = in . nextInt ( ) ; int ans = a ; if ( a <= b ) { out . print ( ans ) ; } else { out . print ( ans - 1 ) ; } } } }


import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer tokenizer = new StringTokenizer ( input . readLine ( ) ) ; int a = Integer . parseInt ( tokenizer . nextToken ( ) ) ; int b = Integer . parseInt ( tokenizer . nextToken ( ) ) ; System . out . println ( a > b ? a - 1 : a ) ; } }


import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; if ( a > b ) { System . out . println ( a - 1 ) ; } else { System . out . println ( a ) ; } } }


import java . util . * ; class Main { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; System . out . println ( a <= b ? a : a - 1 ) ; } }


import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; String s1 = scan . next ( ) ; String s2 = scan . next ( ) ; String s3 = scan . next ( ) ; System . out . print ( ( char ) ( s1 . charAt ( 0 ) - ( ' a ' - ' A ' ) ) ) ; System . out . print ( ( char ) ( s2 . charAt ( 0 ) - ( ' a ' - ' A ' ) ) ) ; System . out . print ( ( char ) ( s3 . charAt ( 0 ) - ( ' a ' - ' A ' ) ) + " \n " ) ; } }

s = input ( ) . split ( ) NEW_LINE print ( ( ' ' . join ( [ s [ 0 ] [ 0 ] , s [ 1 ] [ 0 ] , s [ 2 ] [ 0 ] ] ) ) . upper ( ) ) NEW_LINE


a = list ( input ( ) . split ( ) ) NEW_LINE b = a [ 0 ] [ 0 ] NEW_LINE b = b . swapcase ( ) NEW_LINE c = a [ 1 ] [ 0 ] NEW_LINE c = c . swapcase ( ) NEW_LINE d = a [ 2 ] [ 0 ] NEW_LINE d = d . swapcase ( ) NEW_LINE print ( b , c , d , sep = " " ) NEW_LINE


s_1 , s_2 , s_3 = input ( ) . split ( ) NEW_LINE s_1 = s_1 . upper ( ) NEW_LINE s_2 = s_2 . upper ( ) NEW_LINE s_3 = s_3 . upper ( ) NEW_LINE print ( s_1 [ 0 ] + s_2 [ 0 ] + s_3 [ 0 ] ) NEW_LINE


from functools import reduce NEW_LINE import math NEW_LINE def main ( ) : NEW_LINE INDENT a , b , c = ( _ for _ in input ( ) . split ( ) ) NEW_LINE print ( a [ 0 ] . upper ( ) + b [ 0 ] . upper ( ) + c [ 0 ] . upper ( ) ) NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT main ( ) NEW_LINE DEDENT


import sys NEW_LINE def main ( ) : NEW_LINE INDENT input = sys . stdin . readline NEW_LINE A = list ( map ( str , input ( ) . split ( ) ) ) NEW_LINE ans = A [ 0 ] [ 0 ] + A [ 1 ] [ 0 ] + A [ 2 ] [ 0 ] NEW_LINE return ans . upper ( ) NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT print ( main ( ) ) NEW_LINE DEDENT


import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . InputMismatchException ; import java . io . IOException ; import java . io . InputStream ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; FastScanner in = new FastScanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskA solver = new TaskA ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskA { public void solve ( int testNumber , FastScanner in , PrintWriter out ) { String a = in . next ( ) ; String b = in . next ( ) ; String c = in . next ( ) ; out . printf ( " % C % C % C \n " , a . charAt ( 0 ) , b . charAt ( 0 ) , c . charAt ( 0 ) ) ; } } static class FastScanner { private InputStream in ; private byte [ ] buffer = new byte [ 1024 ] ; private int bufPointer ; private int bufLength ; public FastScanner ( InputStream in ) { this . in = in ; } private int readByte ( ) { if ( bufPointer >= bufLength ) { if ( bufLength == - 1 ) throw new InputMismatchException ( ) ; bufPointer = 0 ; try { bufLength = in . read ( buffer ) ; } catch ( IOException e ) { throw new InputMismatchException ( ) ; } if ( bufLength <= 0 ) return - 1 ; } return buffer [ bufPointer ++ ] ; } private static boolean isPrintableChar ( int c ) { return c >= 33 && c <= 126 ; } public String next ( ) { StringBuilder sb = new StringBuilder ( ) ; int b = readByte ( ) ; while ( ! isPrintableChar ( b ) ) b = readByte ( ) ; while ( isPrintableChar ( b ) ) { sb . appendCodePoint ( b ) ; b = readByte ( ) ; } return sb . toString ( ) ; } } }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . OutputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; Task solver = new Task ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class Task { public void solve ( int testNumber , InputReader in , PrintWriter out ) { String a = in . next ( ) ; String b = in . next ( ) ; String c = in . next ( ) ; out . print ( a . toUpperCase ( ) . charAt ( 0 ) ) ; out . print ( b . toUpperCase ( ) . charAt ( 0 ) ) ; out . println ( c . toUpperCase ( ) . charAt ( 0 ) ) ; } } static class InputReader { public BufferedReader reader ; public StringTokenizer tokenizer ; public InputReader ( InputStream stream ) { reader = new BufferedReader ( new InputStreamReader ( stream ) , 32768 ) ; tokenizer = null ; } public String next ( ) { while ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } } }


import java . util . * ; class Main { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { String [ ] ar = new String [ 3 ] ; for ( int i = 0 ; i < 3 ; i ++ ) ar [ i ] = sc . next ( ) ; String ans = " " ; for ( int i = 0 ; i < 3 ; i ++ ) { ans += ar [ i ] . charAt ( 0 ) ; } System . out . println ( ans . toUpperCase ( ) ) ; } }


import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; for ( int i = 0 ; i < 3 ; i ++ ) { char s = sc . next ( ) . charAt ( 0 ) ; int diff = ' a ' - ' A ' ; System . out . print ( ( char ) ( s - diff ) ) ; } } }


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; System . out . println ( Math . max ( ( A + 1 ) * B , A * ( B + 1 ) ) ) ; } }

a , b = map ( int , input ( ) . split ( ) ) NEW_LINE print ( ( min ( [ a , b ] ) + 1 ) * max ( [ a , b ] ) ) NEW_LINE


def game ( A : int , D : int ) -> int : NEW_LINE INDENT return max ( ( A + 1 ) * D , A * ( D + 1 ) ) NEW_LINE DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT A , D = map ( int , input ( ) . split ( ) ) NEW_LINE ans = game ( A , D ) NEW_LINE print ( ans ) NEW_LINE DEDENT


a = list ( map ( int , input ( ) . split ( ) ) ) ; c , d = sorted ( a ) ; print ( - ~ c * d ) NEW_LINE


A , D = map ( int , input ( ) . split ( ) ) NEW_LINE x = ( A + 1 ) * D NEW_LINE y = A * ( D + 1 ) NEW_LINE if x >= y : NEW_LINE INDENT print ( x ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( y ) NEW_LINE DEDENT


[ a , d ] = [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE print ( ( min ( a , d ) + 1 ) * max ( a , d ) ) NEW_LINE


import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . InputMismatchException ; import java . io . IOException ; import java . io . InputStream ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; FastScanner in = new FastScanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskA solver = new TaskA ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskA { public void solve ( int testNumber , FastScanner in , PrintWriter out ) { int a = in . nextInt ( ) ; int b = in . nextInt ( ) ; out . println ( Math . max ( a , b ) * ( Math . min ( a , b ) + 1 ) ) ; } } static class FastScanner { private InputStream in ; private byte [ ] buffer = new byte [ 1024 ] ; private int bufPointer ; private int bufLength ; public FastScanner ( InputStream in ) { this . in = in ; this . bufPointer = 0 ; this . bufLength = 0 ; } private int readByte ( ) { if ( bufPointer >= bufLength ) { if ( bufLength == - 1 ) throw new InputMismatchException ( ) ; bufPointer = 0 ; try { bufLength = in . read ( buffer ) ; } catch ( IOException e ) { throw new InputMismatchException ( ) ; } if ( bufLength <= 0 ) return - 1 ; } return buffer [ bufPointer ++ ] ; } private static boolean isSpaceChar ( int c ) { return c == ' ▁ ' || c == ' \n ' || c == ' \r ' || c == ' \t ' || c == - 1 ; } public int nextInt ( ) { int n = 0 ; int b = readByte ( ) ; while ( isSpaceChar ( b ) ) b = readByte ( ) ; boolean minus = ( b == ' - ' ) ; if ( minus ) b = readByte ( ) ; while ( b >= '0' && b <= '9' ) { n *= 10 ; n += b - '0' ; b = readByte ( ) ; } if ( ! isSpaceChar ( b ) ) throw new NumberFormatException ( ) ; return minus ? - n : n ; } } }


import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { MyScanner sc = new MyScanner ( ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; System . out . println ( a >= b ? a * ( b + 1 ) : ( a + 1 ) * b ) ; } static int l_min ( int [ ] a ) { Arrays . sort ( a ) ; return a [ 0 ] ; } static int l_max ( int [ ] a ) { int l = a . length ; Arrays . sort ( a ) ; return a [ l - 1 ] ; } public static PrintWriter out ; public static class MyScanner { BufferedReader br ; StringTokenizer st ; public MyScanner ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . OutputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; Task solver = new Task ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class Task { public void solve ( int testNumber , InputReader in , PrintWriter out ) { int A = in . nextInt ( ) ; int D = in . nextInt ( ) ; out . println ( Math . max ( ( A + 1 ) * ( D ) , ( A ) * ( D + 1 ) ) ) ; } } static class InputReader { public BufferedReader reader ; public StringTokenizer tokenizer ; public InputReader ( InputStream stream ) { reader = new BufferedReader ( new InputStreamReader ( stream ) , 32768 ) ; tokenizer = null ; } public String next ( ) { while ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } } }


import java . util . * ; import java . util . stream . * ; import static java . lang . System . * ; class Main { static Scanner sc = new Scanner ( System . in ) ; static int nextInt ( ) { return Integer . parseInt ( sc . next ( ) ) ; } static int [ ] nextIntArray ( int n ) { return IntStream . range ( 0 , n ) . map ( i -> nextInt ( ) ) . toArray ( ) ; } static int max ( int ... ar ) { Arrays . sort ( ar ) ; return ar [ ar . length - 1 ] ; } static int min ( int ... ar ) { Arrays . sort ( ar ) ; return ar [ 0 ] ; } static int maxInt = Integer . MAX_VALUE ; static int minInt = Integer . MIN_VALUE ; public static void main ( String [ ] args ) { int a = nextInt ( ) , b = nextInt ( ) ; out . println ( max ( ( a + 1 ) * b , ( b + 1 ) * a ) ) ; } }


import java . io . IOException ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws IOException { Scanner input = new Scanner ( System . in ) ; int x = input . nextInt ( ) ; int count = 0 ; for ( int i = 1 ; i <= x ; i ++ ) { for ( int j = 1 ; j <= i ; j ++ ) { count += 1 ; if ( count == x ) { System . out . println ( i ) ; System . exit ( 0 ) ; } } } } }

n = int ( input ( ) ) NEW_LINE ans = 1 NEW_LINE m = 1 NEW_LINE while m < n : NEW_LINE INDENT ans += 1 NEW_LINE m += ans NEW_LINE DEDENT print ( ans ) NEW_LINE


def fun ( ) : NEW_LINE INDENT print ( ' ac ' ) NEW_LINE print ( ' ac ' ) NEW_LINE print ( ' ac ' ) NEW_LINE print ( ' ac ' ) NEW_LINE DEDENT from math import * NEW_LINE n = eval ( input ( ) ) NEW_LINE s = ceil ( ( - 1 + sqrt ( 1 + 8 * n ) ) / 2 ) NEW_LINE print ( s ) NEW_LINE


X = int ( input ( ) ) NEW_LINE print ( [ t for t in range ( 10 ** 5 ) if t * ( t + 1 ) / 2 < X ] [ - 1 ] + 1 ) NEW_LINE


import math NEW_LINE x = int ( input ( ) ) NEW_LINE k = 0 NEW_LINE t = 0 NEW_LINE if ( math . sqrt ( 8 * x + 1 ) == math . floor ( math . sqrt ( 8 * x + 1 ) ) ) : NEW_LINE INDENT a = ( - 1 + math . sqrt ( 1 + 8 * x ) ) / 2 NEW_LINE print ( int ( a ) ) NEW_LINE DEDENT else : NEW_LINE INDENT x = ( - 1 + math . sqrt ( 1 + 8 * x ) ) // 2 NEW_LINE print ( int ( x ) + 1 ) NEW_LINE DEDENT


a = int ( input ( ) ) NEW_LINE ar = [ ] NEW_LINE count = 0 NEW_LINE i = 1 NEW_LINE while True : NEW_LINE INDENT count += i NEW_LINE ar . append ( i ) NEW_LINE if count >= a : NEW_LINE INDENT break NEW_LINE DEDENT i += 1 NEW_LINE DEDENT print ( ar [ len ( ar ) - 1 ] ) NEW_LINE


import java . util . * ; import java . io . * ; import static java . lang . Math . * ; import static java . util . Arrays . * ; import static java . util . Collections . * ; public class Main { static final long mod = 1000000007 ; public static void main ( String [ ] args ) throws Exception , IOException { Reader sc = new Reader ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; int n = sc . nextInt ( ) ; long s = 0 , ans = 0 ; for ( int i = 0 ; true ; i ++ ) { s += i + 1 ; if ( n <= s ) { ans = i + 1 ; break ; } } out . println ( ans ) ; out . flush ( ) ; } static void db ( Object ... os ) { System . err . println ( Arrays . deepToString ( os ) ) ; } } class P implements Comparable < P > { int id , d ; P ( int id , int d ) { this . id = id ; this . d = d ; } public int compareTo ( P p ) { return d - p . d ; } } class Reader { private BufferedReader x ; private StringTokenizer st ; public Reader ( InputStream in ) { x = new BufferedReader ( new InputStreamReader ( in ) ) ; st = null ; } public String nextString ( ) throws IOException { while ( st == null || ! st . hasMoreTokens ( ) ) st = new StringTokenizer ( x . readLine ( ) ) ; return st . nextToken ( ) ; } public int nextInt ( ) throws IOException { return Integer . parseInt ( nextString ( ) ) ; } public long nextLong ( ) throws IOException { return Long . parseLong ( nextString ( ) ) ; } public double nextDouble ( ) throws IOException { return Double . parseDouble ( nextString ( ) ) ; } }


import java . util . Scanner ; public class Main { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int n = sc . nextInt ( ) ; int k = ( int ) Math . sqrt ( 2 * n ) ; while ( true ) { int sum = ( 1 + k ) * k / 2 ; if ( sum < n ) ++ k ; else break ; } System . out . println ( k ) ; } }


import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner reader = new Scanner ( System . in ) ; int home = reader . nextInt ( ) ; double interm = - 0.5 + Math . sqrt ( 0.25 + 2 * home ) ; if ( interm % 1.0 > 0 ) { System . out . println ( ( int ) ( interm + 1 ) ) ; } else { System . out . println ( ( int ) interm ) ; } } }


import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int nestValue = sc . nextInt ( ) ; int result = 0 ; for ( int i = 0 ; i <= nestValue ; i ++ ) { if ( maxValue ( i ) >= nestValue ) { result = i ; i = nestValue ; } } System . out . println ( result ) ; sc . close ( ) ; } public static int maxValue ( int n ) { int max = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { max += i ; } return max ; } }


import java . io . * ; import java . util . * ; 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 ( ) ; } if ( arr [ 0 ] != 0 ) { System . out . println ( - 1 ) ; return ; } for ( int i = 1 ; i < n ; i ++ ) { int dif = arr [ i ] - arr [ i - 1 ] ; if ( dif > 1 ) { System . out . println ( - 1 ) ; return ; } } long ans = 0 ; for ( int i = n - 1 ; i >= 0 ; i -- ) { ans += arr [ i ] ; if ( arr [ i ] > 0 ) { while ( i > 0 && arr [ i ] - arr [ i - 1 ] == 1 ) { i -- ; } } } System . out . println ( ans ) ; return ; } }

n = int ( input ( ) ) NEW_LINE a = [ int ( input ( ) ) for i in range ( n ) ] NEW_LINE ans = 0 NEW_LINE if a [ 0 ] != 0 : NEW_LINE INDENT print ( - 1 ) NEW_LINE exit ( ) NEW_LINE DEDENT for i in range ( 1 , n ) : NEW_LINE INDENT if a [ i ] - 1 == a [ i - 1 ] : NEW_LINE INDENT pass NEW_LINE DEDENT else : NEW_LINE INDENT if a [ i ] > a [ i - 1 ] + 1 : NEW_LINE INDENT print ( - 1 ) NEW_LINE exit ( ) NEW_LINE DEDENT else : NEW_LINE INDENT ans += a [ i - 1 ] NEW_LINE DEDENT DEDENT DEDENT ans += a [ n - 1 ] NEW_LINE print ( ans ) NEW_LINE


import sys NEW_LINE n , = [ int ( x ) for x in input ( ) . strip ( ) . split ( " ▁ " ) ] NEW_LINE n = int ( n ) NEW_LINE As = [ ] NEW_LINE for line in sys . stdin : NEW_LINE INDENT a , = line . strip ( ) . split ( " ▁ " ) NEW_LINE As . append ( int ( a ) ) NEW_LINE DEDENT if As [ 0 ] != 0 : NEW_LINE INDENT print ( - 1 ) NEW_LINE sys . exit ( ) NEW_LINE DEDENT result = 0 NEW_LINE for i in range ( n ) : NEW_LINE INDENT k = n - 1 - i NEW_LINE As [ k ] NEW_LINE if As [ k ] > k : NEW_LINE INDENT print ( - 1 ) NEW_LINE sys . exit ( ) NEW_LINE DEDENT if k == n - 1 : NEW_LINE INDENT result += As [ k ] NEW_LINE DEDENT else : NEW_LINE INDENT if As [ k ] > As [ k + 1 ] : NEW_LINE INDENT result += As [ k ] NEW_LINE DEDENT if As [ k ] == As [ k + 1 ] : NEW_LINE INDENT result += As [ k ] NEW_LINE DEDENT if As [ k ] + 1 < As [ k + 1 ] : NEW_LINE INDENT print ( - 1 ) NEW_LINE sys . exit ( ) NEW_LINE DEDENT DEDENT DEDENT print ( result ) NEW_LINE


N = int ( input ( ) ) NEW_LINE prev = 0 NEW_LINE ans = 0 NEW_LINE able = True NEW_LINE for i in range ( N ) : NEW_LINE INDENT now = int ( input ( ) ) NEW_LINE if now - prev > 1 or ( i == 0 and now != 0 ) : NEW_LINE INDENT print ( - 1 ) NEW_LINE able = False NEW_LINE break NEW_LINE DEDENT elif now - prev == 1 : NEW_LINE INDENT ans += 1 NEW_LINE DEDENT elif now : NEW_LINE INDENT ans += now NEW_LINE DEDENT prev = now NEW_LINE DEDENT if able : NEW_LINE INDENT print ( ans ) NEW_LINE DEDENT


N = int ( input ( ) ) NEW_LINE moves = 0 NEW_LINE previous = 0 NEW_LINE exists = 1 NEW_LINE a = [ 0 for i in range ( N ) ] NEW_LINE for i in range ( N ) : NEW_LINE INDENT a [ i ] = int ( input ( ) ) NEW_LINE DEDENT if a [ 0 ] != 0 : NEW_LINE INDENT exists = 0 NEW_LINE DEDENT for i in [ N - j - 1 for j in range ( N ) ] : NEW_LINE INDENT if a [ i ] >= previous : NEW_LINE INDENT moves += a [ i ] NEW_LINE DEDENT elif a [ i ] < previous - 1 : NEW_LINE INDENT exists = 0 NEW_LINE DEDENT previous = a [ i ] NEW_LINE DEDENT if exists == 0 : NEW_LINE INDENT print ( - 1 ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( moves ) NEW_LINE DEDENT


import sys NEW_LINE N = int ( input ( ) ) NEW_LINE A = [ int ( sys . stdin . readline ( ) ) for _ in range ( N ) ] NEW_LINE b = 0 NEW_LINE for i , a in enumerate ( A ) : NEW_LINE INDENT if i + b < a : NEW_LINE INDENT print ( - 1 ) NEW_LINE sys . exit ( ) NEW_LINE DEDENT else : NEW_LINE INDENT b = a - i NEW_LINE DEDENT DEDENT ans = 0 NEW_LINE pre = - 1 NEW_LINE for a in A [ : : - 1 ] : NEW_LINE INDENT if pre - 1 != a : NEW_LINE INDENT ans += a NEW_LINE DEDENT pre = a NEW_LINE DEDENT print ( ans ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . StringTokenizer ; class Main { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; PrintWriter pw = new PrintWriter ( System . out ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = sc . nextInt ( ) ; boolean ok = a [ 0 ] == 0 ; for ( int i = 1 ; i < n ; i ++ ) if ( a [ i ] - a [ i - 1 ] > 1 ) ok = false ; if ( ! ok ) { System . out . println ( - 1 ) ; return ; } long ans = 0 ; for ( int i = 1 ; i < n ; i ++ ) if ( a [ i ] > a [ i - 1 ] ) ans ++ ; else ans += a [ i ] ; pw . println ( ans ) ; pw . close ( ) ; } static class Scanner { BufferedReader br ; StringTokenizer st ; public Scanner ( InputStream s ) { br = new BufferedReader ( new InputStreamReader ( s ) ) ; } public String nextLine ( ) throws IOException { return br . readLine ( ) ; } public String next ( ) throws IOException { while ( st == null || ! st . hasMoreTokens ( ) ) st = new StringTokenizer ( br . readLine ( ) ) ; return st . nextToken ( ) ; } public int nextInt ( ) throws IOException { return Integer . parseInt ( next ( ) ) ; } public double nextDouble ( ) throws IOException { return Double . parseDouble ( next ( ) ) ; } public boolean ready ( ) throws IOException { return br . ready ( ) ; } public long nextLong ( ) throws IOException { return Long . parseLong ( next ( ) ) ; } } }


import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . io . PrintStream ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; Task solver = new Task ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class Task { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int length = in . nextInt ( ) ; if ( in . nextInt ( ) > 0 ) { System . out . println ( - 1 ) ; return ; } long ans = 0 ; int prev = 0 ; for ( int i = 1 ; i < length ; i ++ ) { int n = in . nextInt ( ) ; if ( n == 0 ) { } else if ( n - prev > 1 ) { System . out . println ( - 1 ) ; return ; } else if ( n - prev == 1 ) { ans ++ ; } else if ( n - prev <= 0 ) { ans += n ; } prev = n ; } System . out . println ( ans ) ; } } }


import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { new Main ( ) . solve ( ) ; } void solve ( ) { Scanner sc = new Scanner ( System . in ) ; long N = sc . nextLong ( ) ; boolean ch = true ; long ans = 0 ; long A = sc . nextLong ( ) ; if ( A != 0 ) { ch = false ; } long B ; for ( long i = 1 ; i < N ; i ++ ) { B = sc . nextLong ( ) ; if ( B - A > 1 ) { ch = false ; } if ( B - A == 1 ) { ans ++ ; } if ( B <= A ) { ans += B ; } A = B ; } if ( ch ) { System . out . println ( ans ) ; } else { System . out . println ( " - 1" ) ; } } }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader r = new BufferedReader ( new InputStreamReader ( System . in ) , 1 ) ; int n = Integer . parseInt ( r . readLine ( ) ) ; int a [ ] = new int [ 200001 ] ; int x [ ] = new int [ 200001 ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = Integer . parseInt ( r . readLine ( ) ) ; } if ( a [ 0 ] > 0 ) { System . out . println ( - 1 ) ; System . exit ( 0 ) ; } for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i + 1 ] - a [ i ] > 1 ) { System . out . println ( - 1 ) ; System . exit ( 0 ) ; } } long v = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { if ( a [ i - 1 ] + 1 == a [ i ] ) { v ++ ; } else { v += a [ i ] ; } } System . out . println ( v ) ; } }


import java . util . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a == b && b == c && a % 2 == 0 ) { System . out . println ( - 1 ) ; } else { int count = 0 ; while ( a % 2 == 0 && b % 2 == 0 && c % 2 == 0 ) { int ta = a ; int tb = b ; int tc = c ; a = ( tb + tc ) / 2 ; b = ( ta + tc ) / 2 ; c = ( ta + tb ) / 2 ; count ++ ; } System . out . println ( count ) ; } } }

def solve ( ) : NEW_LINE INDENT a , b , c = ( int ( i ) for i in input ( ) . split ( ) ) NEW_LINE queue = [ [ a , b , c ] ] NEW_LINE ct = 0 NEW_LINE while ct < 100000000 : NEW_LINE INDENT if a % 2 == 1 or b % 2 == 1 or c % 2 == 1 : break NEW_LINE tmpa = a // 2 NEW_LINE tmpb = b // 2 NEW_LINE tmpc = c // 2 NEW_LINE a = tmpb + tmpc NEW_LINE b = tmpa + tmpc NEW_LINE c = tmpa + tmpb NEW_LINE if [ a , b , c ] in queue : NEW_LINE INDENT return - 1 NEW_LINE DEDENT else : NEW_LINE INDENT ct += 1 NEW_LINE queue . append ( [ a , b , c ] ) NEW_LINE DEDENT DEDENT return ct NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT print ( solve ( ) ) NEW_LINE DEDENT


import numpy as np NEW_LINE A , B , C = map ( int , input ( ) . split ( ) ) NEW_LINE A , B , C = np . sort ( [ A , B , C ] ) NEW_LINE ab = B - A NEW_LINE bc = C - B NEW_LINE if ( A % 2 == 1 ) & ( B % 2 == 1 ) & ( C % 2 == 1 ) : NEW_LINE INDENT print ( 0 ) NEW_LINE DEDENT elif ( ab == 0 ) & ( bc == 0 ) : NEW_LINE INDENT print ( - 1 ) NEW_LINE DEDENT else : NEW_LINE INDENT for k in range ( 30 ) : NEW_LINE INDENT if ( ( ab % 2 ) == 1 ) | ( ( bc % 2 ) == 1 ) : NEW_LINE INDENT print ( k ) NEW_LINE break NEW_LINE DEDENT ab = int ( ab / 2 ) NEW_LINE bc = int ( bc / 2 ) NEW_LINE DEDENT DEDENT


cookie = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE cookie . sort ( ) NEW_LINE count = 0 NEW_LINE if cookie [ 0 ] == cookie [ 2 ] and cookie [ 0 ] % 2 == 0 : NEW_LINE INDENT print ( - 1 ) NEW_LINE exit ( ) NEW_LINE DEDENT while cookie [ 2 ] - cookie [ 0 ] > 0 : NEW_LINE INDENT if cookie [ 0 ] % 2 == 1 or cookie [ 1 ] % 2 == 1 or cookie [ 2 ] % 2 == 1 : NEW_LINE INDENT print ( count ) NEW_LINE exit ( ) NEW_LINE DEDENT if cookie [ 0 ] == cookie [ 2 ] : NEW_LINE INDENT print ( - 1 ) NEW_LINE exit ( ) NEW_LINE DEDENT count += 1 NEW_LINE a = ( cookie [ 1 ] + cookie [ 2 ] ) // 2 NEW_LINE b = ( cookie [ 2 ] + cookie [ 0 ] ) // 2 NEW_LINE c = ( cookie [ 0 ] + cookie [ 1 ] ) // 2 NEW_LINE cookie [ 0 ] = a NEW_LINE cookie [ 1 ] = b NEW_LINE cookie [ 2 ] = c NEW_LINE cookie . sort ( ) NEW_LINE DEDENT print ( count ) NEW_LINE


def solve ( a , b , c , ans ) : NEW_LINE INDENT if ( a , b , c ) in s : NEW_LINE INDENT return - 1 NEW_LINE DEDENT if ( a % 2 ) or ( b % 2 ) or ( c % 2 ) : NEW_LINE INDENT return ans NEW_LINE DEDENT s . add ( ( a , b , c ) ) NEW_LINE a >>= 1 NEW_LINE b >>= 1 NEW_LINE c >>= 1 NEW_LINE return solve ( b + c , c + a , a + b , ans + 1 ) NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT a , b , c = map ( int , input ( ) . split ( ) ) NEW_LINE s = set ( ) NEW_LINE print ( solve ( a , b , c , 0 ) ) NEW_LINE DEDENT


def cookies_divide ( num_of_per , A ) : NEW_LINE INDENT if ( A [ 0 ] == A [ 1 ] == A [ 2 ] and A [ 0 ] % 2 + A [ 1 ] % 2 + A [ 2 ] % 2 == 0 ) : NEW_LINE INDENT return ( - 1 , A ) NEW_LINE DEDENT if ( A [ 0 ] % 2 + A [ 1 ] % 2 + A [ 2 ] % 2 > 0 ) : NEW_LINE INDENT return ( 0 , A ) NEW_LINE DEDENT R = [ 0 for i in range ( num_of_per ) ] NEW_LINE R [ 0 ] = A [ 1 ] // 2 + A [ 2 ] // 2 NEW_LINE R [ 1 ] = A [ 0 ] // 2 + A [ 2 ] // 2 NEW_LINE R [ 2 ] = A [ 0 ] // 2 + A [ 1 ] // 2 NEW_LINE return ( 1 , R ) NEW_LINE DEDENT if ( __name__ == ' _ _ main _ _ ' ) : NEW_LINE INDENT count = 0 NEW_LINE A = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE while True : NEW_LINE INDENT return_code , A = cookies_divide ( 3 , A ) NEW_LINE if return_code < 0 : NEW_LINE INDENT print ( return_code ) NEW_LINE break ; NEW_LINE DEDENT if return_code == 0 : NEW_LINE INDENT print ( count ) NEW_LINE break ; NEW_LINE DEDENT count += return_code NEW_LINE DEDENT DEDENT


import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; ACookieExchanges solver = new ACookieExchanges ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class ACookieExchanges { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int a = in . nextInt ( ) , b = in . nextInt ( ) , c = in . nextInt ( ) ; for ( int i = 0 ; ; i ++ ) { if ( a % 2 == 1 || b % 2 == 1 || c % 2 == 1 ) { out . println ( i ) ; return ; } else if ( a == b && b == c ) { out . println ( - 1 ) ; return ; } int na = b + c , nb = c + a , nc = a + b ; a = na / 2 ; b = nb / 2 ; c = nc / 2 ; } } } }


import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] input = br . readLine ( ) . split ( " ▁ " ) ; long A = Long . parseLong ( input [ 0 ] ) ; long B = Long . parseLong ( input [ 1 ] ) ; long C = Long . parseLong ( input [ 2 ] ) ; long defineA = A ; long defineB = B ; long defineC = C ; long result = 0 ; while ( true ) { if ( Even ( A ) || Even ( B ) || Even ( C ) ) { break ; } long A2 = A / 2 ; long B2 = B / 2 ; long C2 = C / 2 ; A = B2 + C2 ; B = A2 + C2 ; C = A2 + B2 ; result ++ ; if ( defineA == A && defineB == B && defineC == C ) { result = - 1 ; break ; } } System . out . println ( result ) ; } private static boolean Even ( long A , long B , long C ) { return ( A % 2 != 0 ) && ( B % 2 != 0 ) && ( C % 2 != 0 ) ; } private static boolean Even ( long var ) { return ( var % 2 != 0 ) ; } }


import java . util . * ; import static java . lang . System . * ; import static java . lang . Math . * ; public class Main { public static void main ( String [ ] $ ) { Scanner sc = new Scanner ( in ) ; int a = sc . nextInt ( ) , b = sc . nextInt ( ) , c = sc . nextInt ( ) ; if ( ( a + b + c ) % 2 == 1 ) { out . println ( 0 ) ; } else if ( a == b && b == c && c == a ) { out . println ( - 1 ) ; } else { int ans = 0 ; while ( a % 2 + b % 2 + c % 2 == 0 ) { ans ++ ; int tempA = ( b + c ) / 2 ; int tempB = ( a + c ) / 2 ; int tempC = ( b + a ) / 2 ; a = tempA ; b = tempB ; c = tempC ; } out . println ( ans ) ; } } }


import java . util . * ; public class Main { long INF = Long . MAX_VALUE ; public static void main ( String [ ] args ) { new Main ( ) . solve ( ) ; } void solve ( ) { Scanner sc = new Scanner ( System . in ) ; long A = sc . nextLong ( ) ; long B = sc . nextLong ( ) ; long C = sc . nextLong ( ) ; if ( A % 2 == 1 || B % 2 == 1 || C % 2 == 1 ) { System . out . println ( "0" ) ; return ; } if ( ( A == B && B == C ) ) { System . out . println ( " - 1" ) ; return ; } long count = 1 ; while ( true ) { long a = A / 2 ; long b = B / 2 ; long c = C / 2 ; A = b + c ; B = a + c ; C = a + b ; if ( A % 2 == 1 || B % 2 == 1 || C % 2 == 1 ) { break ; } count ++ ; } System . out . println ( count ) ; } }


import java . util . Arrays ; import java . util . Comparator ; import java . util . Scanner ; public class Main { void run ( ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] A = new int [ N ] ; int [ ] xor = new int [ N ] ; int [ ] sum = new int [ N ] ; for ( int i = 0 ; i < N ; ++ i ) { A [ i ] = sc . nextInt ( ) ; xor [ i ] = A [ i ] ^ ( i > 0 ? xor [ i - 1 ] : 0 ) ; sum [ i ] = A [ i ] + ( i > 0 ? sum [ i - 1 ] : 0 ) ; } long ans = 0 ; int t = - 1 ; for ( int i = 0 ; i < N ; ++ i ) { while ( t < i && sum [ i ] - ( t >= 0 ? sum [ t ] : 0 ) != ( xor [ i ] ^ ( t >= 0 ? xor [ t ] : 0 ) ) ) ++ t ; ans += i - t ; } System . out . println ( ans ) ; } public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } void tr ( Object ... objects ) { System . out . println ( Arrays . deepToString ( objects ) ) ; } }

N = int ( input ( ) ) NEW_LINE A = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE cnt = 0 NEW_LINE r = 0 NEW_LINE tmp = 0 NEW_LINE for l in range ( N ) : NEW_LINE INDENT while r < N and ( tmp & A [ r ] ) == 0 : NEW_LINE INDENT tmp |= A [ r ] NEW_LINE r += 1 NEW_LINE DEDENT cnt += ( r - l ) NEW_LINE tmp ^= A [ l ] NEW_LINE DEDENT print ( cnt ) NEW_LINE


def main ( ) : NEW_LINE INDENT n = int ( input ( ) . rstrip ( " \b " ) ) NEW_LINE numbers = [ int ( x ) for x in input ( ) . rstrip ( " \b " ) . split ( " ▁ " ) ] NEW_LINE start_number = numbers . pop ( 0 ) NEW_LINE targets = { start_number : 1 } NEW_LINE total = 0 NEW_LINE from collections import defaultdict NEW_LINE for number in numbers : NEW_LINE INDENT next_targets = defaultdict ( int ) NEW_LINE for ( target , count ) in targets . items ( ) : NEW_LINE INDENT total += count NEW_LINE if ( number | target ) >= ( target + number ) : NEW_LINE INDENT next_targets [ target + number ] += count NEW_LINE DEDENT DEDENT next_targets [ number ] += 1 NEW_LINE targets = next_targets NEW_LINE DEDENT for ( target , count ) in targets . items ( ) : NEW_LINE INDENT total += count NEW_LINE DEDENT print ( total ) NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT main ( ) NEW_LINE DEDENT


def inpl ( ) : return list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE N = int ( input ( ) ) NEW_LINE A = inpl ( ) NEW_LINE l = r = 0 NEW_LINE ans = 0 NEW_LINE X = Y = A [ 0 ] NEW_LINE while 1 : NEW_LINE INDENT if X == Y : NEW_LINE INDENT ans += r - l + 1 NEW_LINE if r < N - 1 : NEW_LINE INDENT r += 1 NEW_LINE X ^= A [ r ] NEW_LINE Y += A [ r ] NEW_LINE DEDENT else : NEW_LINE INDENT break NEW_LINE DEDENT DEDENT else : NEW_LINE INDENT X ^= A [ l ] NEW_LINE Y -= A [ l ] NEW_LINE l += 1 NEW_LINE DEDENT DEDENT print ( ans ) NEW_LINE


import sys NEW_LINE INF = float ( ' inf ' ) NEW_LINE MOD = 10 ** 9 + 7 NEW_LINE def LI ( ) : return [ int ( x ) for x in sys . stdin . readline ( ) . split ( ) ] NEW_LINE def LI_ ( ) : return [ int ( x ) - 1 for x in sys . stdin . readline ( ) . split ( ) ] NEW_LINE def LS ( ) : return sys . stdin . readline ( ) . split ( ) NEW_LINE def II ( ) : return int ( sys . stdin . readline ( ) ) NEW_LINE def SI ( ) : return input ( ) NEW_LINE n = II ( ) NEW_LINE A = LI ( ) NEW_LINE ans = 0 NEW_LINE right = 0 NEW_LINE num_xor = 0 NEW_LINE num_and = 0 NEW_LINE for left in range ( n ) : NEW_LINE INDENT while right < n and num_xor ^ A [ right ] == num_and + A [ right ] : NEW_LINE INDENT num_xor ^= A [ right ] NEW_LINE num_and += A [ right ] NEW_LINE right += 1 NEW_LINE DEDENT ans += right - left NEW_LINE if left == right : NEW_LINE INDENT right += 1 NEW_LINE DEDENT else : NEW_LINE INDENT num_xor ^= A [ left ] NEW_LINE num_and -= A [ left ] NEW_LINE DEDENT DEDENT print ( ans ) NEW_LINE


N = int ( input ( ) ) NEW_LINE A = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE l = 1 ; r = 1 NEW_LINE XOR = A [ 0 ] NEW_LINE SUM = A [ 0 ] NEW_LINE answer = 0 NEW_LINE while True : NEW_LINE INDENT if r < N : NEW_LINE INDENT if XOR ^ A [ r ] == SUM + A [ r ] : NEW_LINE INDENT XOR = XOR ^ A [ r ] NEW_LINE SUM = SUM + A [ r ] NEW_LINE r += 1 NEW_LINE continue NEW_LINE DEDENT else : NEW_LINE INDENT if l == r : NEW_LINE INDENT answer += 1 NEW_LINE XOR = A [ r ] NEW_LINE SUM = A [ r ] NEW_LINE l += 1 NEW_LINE r += 1 NEW_LINE DEDENT else : NEW_LINE INDENT answer += r - ( l - 1 ) NEW_LINE XOR = XOR ^ A [ l - 1 ] NEW_LINE SUM = SUM - A [ l - 1 ] NEW_LINE l += 1 NEW_LINE DEDENT DEDENT DEDENT else : NEW_LINE INDENT answer += ( N - ( l - 1 ) ) * ( N - ( l - 1 ) + 1 ) // 2 NEW_LINE break NEW_LINE DEDENT DEDENT print ( answer ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . util . HashMap ; import java . util . HashSet ; import java . util . PriorityQueue ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( br . readLine ( ) ) ; String input = br . readLine ( ) ; String [ ] tmpArray = input . split ( " ▁ " ) ; long array [ ] = new long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { array [ i ] = Long . parseLong ( tmpArray [ i ] ) ; } long result = 0 ; result = solve ( array ) ; System . out . println ( result ) ; } static long solve ( long [ ] array ) { int n = array . length ; long result = 0 ; long tmpXor = array [ 0 ] ; long tmpSum = array [ 0 ] ; int left = 0 ; int right = 0 ; int count [ ] = new int [ n ] ; while ( left < n ) { if ( right < n - 1 && ( long ) ( tmpXor ^ array [ right + 1 ] ) == tmpSum + array [ right + 1 ] ) { tmpXor ^= array [ right + 1 ] ; tmpSum += array [ right + 1 ] ; right ++ ; } else { count [ left ] = right - left + 1 ; tmpSum -= array [ left ] ; tmpXor = tmpSum ; if ( left < n - 1 && left == right ) { right = left + 1 ; tmpXor = array [ left + 1 ] ; tmpSum = array [ left + 1 ] ; } left ++ ; } } for ( int i = 0 ; i < n ; i ++ ) { result += count [ i ] ; } return result ; } }


import java . io . PrintStream ; import java . util . Scanner ; public class Main { private static final PrintStream ps = System . out ; private static final Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } long sum = 0 ; long ans = 0 ; long xsum = 0 ; int r = 0 ; for ( int l = 0 ; l < n ; l ++ ) { if ( l != 0 ) { xsum ^= a [ l - 1 ] ; sum -= a [ l - 1 ] ; } while ( true ) { if ( r >= n ) { ans += r - l ; break ; } xsum ^= a [ r ] ; sum += a [ r ] ; if ( xsum != sum ) { ans += r - l ; xsum ^= a [ r ] ; sum -= a [ r ] ; break ; } r ++ ; } } ps . println ( ans ) ; } }


import java . math . BigInteger ; import java . util . * ; public class Main { private void doit ( ) { Scanner sc = new Scanner ( System . in ) ; while ( sc . hasNext ( ) ) { int n = sc . nextInt ( ) ; int [ ] data = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { data [ i ] = sc . nextInt ( ) ; } long count = 0 ; int now = 0 ; int left = 0 , right = 0 ; while ( true ) { if ( left >= n ) { break ; } while ( right < n ) { int res = now ^ data [ right ] ; int res2 = now | data [ right ] ; if ( res != res2 ) { break ; } now = now ^ data [ right ] ; right ++ ; } count += right - left ; now = now ^ ( now & data [ left ] ) ; left ++ ; } System . out . println ( count ) ; } } private void debug ( Object ... o ) { System . out . println ( " debug ▁ = ▁ " + Arrays . deepToString ( o ) ) ; } public static void main ( String [ ] args ) { new Main ( ) . doit ( ) ; } }


import java . io . BufferedReader ; import java . io . FileNotFoundException ; import java . io . FileReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) throws IOException { 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 start = 0 ; int end = 0 ; int v = 0 ; long s = 0 ; long ans = 0 ; boolean f = true ; while ( end < n ) { if ( f ) { s += a [ end ] ; v ^= a [ end ] ; } if ( s == v ) { f = true ; end ++ ; } else { f = false ; long len = end - start ; ans += len ; s -= a [ start ] ; v ^= a [ start ] ; start ++ ; } } if ( f ) { long len = ( end - start ) ; ans += ( len ) * ( len - 1 ) / 2 ; ans += len ; } System . out . println ( ans ) ; } static class Scanner { BufferedReader br ; StringTokenizer st ; public Scanner ( InputStream s ) { br = new BufferedReader ( new InputStreamReader ( s ) ) ; } public Scanner ( String s ) throws FileNotFoundException { br = new BufferedReader ( new FileReader ( s ) ) ; } public String nextLine ( ) throws IOException { return br . readLine ( ) ; } public String next ( ) throws IOException { while ( st == null || ! st . hasMoreTokens ( ) ) st = new StringTokenizer ( br . readLine ( ) ) ; return st . nextToken ( ) ; } public int nextInt ( ) throws IOException { return Integer . parseInt ( next ( ) ) ; } public double nextDouble ( ) throws IOException { return Double . parseDouble ( next ( ) ) ; } public boolean ready ( ) throws IOException { return br . ready ( ) ; } public long nextLong ( ) throws IOException { return Long . parseLong ( next ( ) ) ; } } }


import java . util . ArrayList ; import java . util . HashSet ; import java . util . List ; import java . util . Scanner ; import java . util . Set ; class Main { static boolean canSet ( int x , List < Integer > list ) { Set < Integer > set = new HashSet < > ( ) ; set . add ( 0 ) ; for ( int i : list ) { Set < Integer > newSet = new HashSet < > ( ) ; for ( int j : set ) { newSet . add ( j + i ) ; newSet . add ( j - i ) ; } set = newSet ; } return set . contains ( x ) ; } public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String s = scan . next ( ) + ' T ' ; int x = scan . nextInt ( ) ; int y = scan . nextInt ( ) ; List < Integer > hol = new ArrayList < > ( ) ; List < Integer > ver = new ArrayList < > ( ) ; int index = 0 ; while ( s . charAt ( index ) != ' T ' ) ++ index ; x -= index ; int cnt = 0 ; int vec = 0 ; for ( int i = index ; i < s . length ( ) ; ++ i ) { if ( s . charAt ( i ) == ' F ' ) ++ cnt ; else { ++ vec ; if ( cnt > 0 ) { if ( vec % 2 == 1 ) hol . add ( cnt ) ; else ver . add ( cnt ) ; cnt = 0 ; } } } if ( canSet ( x , hol ) && canSet ( y , ver ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } }

def c ( p , g , lis ) : NEW_LINE INDENT for e in lis : NEW_LINE INDENT if p <= g : NEW_LINE INDENT p += e NEW_LINE DEDENT else : NEW_LINE INDENT p -= e NEW_LINE DEDENT DEDENT return p == g NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT s = input ( ) NEW_LINE gx , gy = map ( int , input ( ) . split ( ) ) NEW_LINE s = s . split ( " T " ) NEW_LINE s = [ len ( _ ) for _ in s ] NEW_LINE x_move = s [ : : 2 ] NEW_LINE y_move = s [ 1 : : 2 ] NEW_LINE x = x_move . pop ( 0 ) NEW_LINE y = 0 NEW_LINE x_move . sort ( reverse = True ) NEW_LINE y_move . sort ( reverse = True ) NEW_LINE if c ( x , gx , x_move ) and c ( y , gy , y_move ) : NEW_LINE INDENT print ( " Yes " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " No " ) NEW_LINE DEDENT DEDENT


ai = lambda : list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE ai_ = lambda : [ int ( x ) - 1 for x in input ( ) . split ( ) ] NEW_LINE s = input ( ) . split ( ' T ' ) NEW_LINE x , y = ai ( ) NEW_LINE xx , yy = [ ] , [ ] NEW_LINE c = 0 NEW_LINE for i in range ( len ( s ) ) : NEW_LINE INDENT if i % 2 : NEW_LINE INDENT yy . append ( len ( s [ i ] ) ) NEW_LINE DEDENT else : NEW_LINE INDENT xx . append ( len ( s [ i ] ) ) NEW_LINE DEDENT DEDENT anx = set ( ) NEW_LINE for i in range ( len ( xx ) ) : NEW_LINE INDENT if i == 0 : NEW_LINE INDENT anx = { xx [ i ] } NEW_LINE DEDENT else : NEW_LINE INDENT aanx = set ( ) NEW_LINE for j in anx : NEW_LINE INDENT aanx . add ( j + xx [ i ] ) NEW_LINE aanx . add ( j - xx [ i ] ) NEW_LINE DEDENT anx = aanx NEW_LINE DEDENT DEDENT any = { 0 } NEW_LINE for i in range ( len ( yy ) ) : NEW_LINE INDENT aany = set ( ) NEW_LINE for j in any : NEW_LINE INDENT aany . add ( j + yy [ i ] ) NEW_LINE aany . add ( j - yy [ i ] ) NEW_LINE DEDENT any = aany NEW_LINE DEDENT if x in anx and y in any : NEW_LINE INDENT print ( ' Yes ' ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( ' No ' ) NEW_LINE DEDENT


import sys NEW_LINE sys . setrecursionlimit ( 10000 ) NEW_LINE inp = list ( map ( len , input ( ) . split ( " T " ) ) ) NEW_LINE inx , iny = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE memo = { } NEW_LINE def tg ( g , n , t ) : NEW_LINE INDENT g . sort ( ) NEW_LINE g . reverse ( ) NEW_LINE def tn ( g , n , t ) : NEW_LINE INDENT if ( tuple ( g ) , n , t ) in memo : NEW_LINE INDENT return memo [ ( tuple ( g ) , n , t ) ] NEW_LINE DEDENT if g == [ ] : NEW_LINE INDENT if n == t : NEW_LINE INDENT return True NEW_LINE DEDENT else : NEW_LINE INDENT return False NEW_LINE DEDENT DEDENT if n < t : NEW_LINE INDENT z = tn ( g [ 1 : ] , n + g [ 0 ] , t ) NEW_LINE memo [ ( tuple ( g ) , n , t ) ] = z NEW_LINE return z NEW_LINE DEDENT else : NEW_LINE INDENT z = tn ( g [ 1 : ] , n - g [ 0 ] , t ) NEW_LINE memo [ ( tuple ( g ) , n , t ) ] = z NEW_LINE return z NEW_LINE DEDENT DEDENT return tn ( g , n , t ) NEW_LINE DEDENT if tg ( inp [ 1 : : 2 ] , 0 , iny ) and tg ( inp [ 2 : : 2 ] , inp [ 0 ] , inx ) : NEW_LINE INDENT print ( " Yes " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " No " ) NEW_LINE DEDENT


def solve ( s , x , y ) : NEW_LINE INDENT def update ( move ) : NEW_LINE INDENT ncx = set ( ) NEW_LINE cx = cxy [ is_x ] NEW_LINE for x in cx : NEW_LINE INDENT ncx . add ( x + move ) NEW_LINE ncx . add ( x - move ) NEW_LINE DEDENT cxy [ is_x ] = ncx NEW_LINE DEDENT spl = map ( len , s . split ( ' T ' ) ) NEW_LINE is_x = 1 NEW_LINE cxy = [ { next ( spl ) } , { 0 } ] NEW_LINE for l in spl : NEW_LINE INDENT update ( l ) NEW_LINE is_x ^= 1 NEW_LINE DEDENT return x in cxy [ 0 ] and y in cxy [ 1 ] NEW_LINE DEDENT s = input ( ) NEW_LINE x , y = map ( int , input ( ) . split ( ) ) NEW_LINE print ( ' Yes ' if solve ( s , x , y ) else ' No ' ) NEW_LINE


s = input ( ) + " T " NEW_LINE goal_x , goal_y = map ( int , input ( ) . split ( ) ) NEW_LINE length = len ( s ) NEW_LINE dp_x , dp_y = [ 0 ] * ( length * 2 + 1 ) , [ 0 ] * ( length * 2 + 1 ) NEW_LINE start = x_steps = s . index ( " T " ) NEW_LINE dp_x [ length + start ] = dp_y [ length ] = 1 NEW_LINE steps = y_steps = 0 NEW_LINE direction = 0 NEW_LINE for i , c in enumerate ( s [ start : ] , start = start ) : NEW_LINE INDENT if c == " F " : NEW_LINE INDENT steps += 1 NEW_LINE DEDENT else : NEW_LINE INDENT if steps : NEW_LINE INDENT _dp = [ 0 ] * ( length * 2 + 1 ) NEW_LINE if direction == 0 : NEW_LINE INDENT for x , v in enumerate ( dp_x [ length - x_steps : length + x_steps + 1 ] , start = length - x_steps ) : NEW_LINE INDENT if v : NEW_LINE INDENT _dp [ x - steps ] = _dp [ x + steps ] = 1 NEW_LINE DEDENT DEDENT x_steps += steps NEW_LINE dp_x = _dp NEW_LINE DEDENT else : NEW_LINE INDENT for y , v in enumerate ( dp_y [ length - y_steps : length + y_steps + 1 ] , start = length - y_steps ) : NEW_LINE INDENT if v : NEW_LINE INDENT _dp [ y - steps ] = _dp [ y + steps ] = 1 NEW_LINE DEDENT DEDENT y_steps += steps NEW_LINE dp_y = _dp NEW_LINE DEDENT DEDENT steps = 0 NEW_LINE direction ^= 1 NEW_LINE DEDENT DEDENT print ( " Yes " if dp_x [ length + goal_x ] and dp_y [ length + goal_y ] else " No " ) NEW_LINE


import java . io . * ; import java . util . * ; import static java . lang . System . in ; class Main { int [ ] [ ] rec = new int [ 1001 ] [ 1001 ] ; public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; char [ ] s = sc . next ( ) . toCharArray ( ) ; int x = sc . nextInt ( ) , y = sc . nextInt ( ) ; int start = 0 , n = s . length ; while ( start < n && s [ start ] == ' F ' ) start ++ ; ArrayList < Integer > hori = new ArrayList < > ( ) , vert = new ArrayList < > ( ) ; int parity = 0 ; int i = start ; while ( i < n ) { if ( s [ i ] == ' T ' ) { parity = 1 - parity ; i ++ ; } else { int j = i + 1 ; while ( j < n && s [ j ] == ' F ' ) j ++ ; if ( parity == 0 ) hori . add ( j - i ) ; else vert . add ( j - i ) ; i = j ; } } String ans = help ( x - start , hori ) && help ( y , vert ) ? " Yes " : " No " ; System . out . println ( ans ) ; } static boolean help ( int target , ArrayList < Integer > step ) { int sum = 0 ; for ( int w : step ) sum += w ; if ( sum < Math . abs ( target ) ) return false ; if ( sum == Math . abs ( target ) ) return true ; boolean [ ] cur = new boolean [ 2 * sum + 1 ] , next = new boolean [ 2 * sum + 1 ] ; cur [ sum ] = true ; for ( int w : step ) { for ( int j = 0 ; j <= 2 * sum ; j ++ ) { if ( cur [ j ] ) { next [ j - w ] = true ; next [ j + w ] = true ; } } cur = next ; next = new boolean [ 2 * sum + 1 ] ; } return cur [ target + sum ] ; } }


import java . util . * ; public class Main { static Scanner s = new Scanner ( System . in ) ; static int gInt ( ) { return Integer . parseInt ( s . next ( ) ) ; } public static void main ( String [ ] $ ) { String v = s . next ( ) ; int x = gInt ( ) , y = gInt ( ) ; ArrayList < Integer > dx = new ArrayList < > ( ) , dy = new ArrayList < > ( ) ; boolean dir = true ; int d = 0 ; for ( int i = 0 ; i < v . length ( ) ; i ++ ) { if ( v . charAt ( i ) == ' T ' ) { ( dir ? dx : dy ) . add ( d ) ; d = 0 ; dir ^= true ; } else { d ++ ; } } ( dir ? dx : dy ) . add ( d ) ; x -= dx . remove ( 0 ) ; System . out . println ( dp ( dx , x ) && dp ( dy , y ) ? " Yes " : " No " ) ; } static boolean dp ( List < Integer > list , int goal ) { Set < Integer > set = new HashSet < > ( ) , buf = new HashSet < > ( ) ; set . add ( 0 ) ; for ( int v : list ) { buf . clear ( ) ; for ( int base : set ) { buf . add ( base + v ) ; buf . add ( base - v ) ; } set . clear ( ) ; set . addAll ( buf ) ; } return set . contains ( goal ) ; } }


import java . util . ArrayList ; import java . util . Arrays ; import java . util . List ; import java . util . Scanner ; public class Main { static int PLUS = 10000 ; static boolean check ( int start , int x , List < Integer > a ) { boolean [ ] dp = new boolean [ 20002 ] ; dp [ start ] = true ; for ( int i = 0 ; i < a . size ( ) ; i ++ ) { boolean [ ] next_dp = new boolean [ 20002 ] ; for ( int j = 0 ; j < 20002 ; j ++ ) { if ( ! dp [ j ] ) { continue ; } next_dp [ j + a . get ( i ) ] = true ; next_dp [ j - a . get ( i ) ] = true ; } dp = Arrays . copyOf ( next_dp , 20002 ) ; } return dp [ x ] ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( sc . hasNext ( ) ) { String s = sc . next ( ) ; int x = sc . nextInt ( ) + PLUS ; int y = sc . nextInt ( ) + PLUS ; List < Integer > ax = new ArrayList < > ( ) ; List < Integer > ay = new ArrayList < > ( ) ; boolean isOdd = false ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { int cnt = 0 ; while ( i < s . length ( ) && s . charAt ( i ) == ' F ' ) { cnt ++ ; i ++ ; } if ( isOdd ) { ay . add ( cnt ) ; } else { ax . add ( cnt ) ; } isOdd = ! isOdd ; } int nowX = PLUS + ax . get ( 0 ) ; int nowY = PLUS ; if ( check ( nowX , x , ax . subList ( 1 , ax . size ( ) ) ) && check ( nowY , y , ay ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } }


import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int N = scan . nextInt ( ) ; if ( N % 2 == 0 ) { System . out . println ( " Blue " ) ; } else { System . out . println ( " Red " ) ; } } }

n = int ( input ( ) ) NEW_LINE if n % 2 == 1 : NEW_LINE INDENT print ( " Red " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " Blue " ) NEW_LINE DEDENT


print ( ' Red ' if int ( input ( ) ) % 2 else ' Blue ' ) NEW_LINE


import sys NEW_LINE sys . setrecursionlimit ( 10 ** 9 ) NEW_LINE input = sys . stdin . readline NEW_LINE N = int ( input ( ) ) NEW_LINE ans = " Blue " NEW_LINE if N % 2 == 1 : NEW_LINE INDENT ans = " Red " NEW_LINE DEDENT print ( ans ) NEW_LINE


def main ( ) : NEW_LINE INDENT n = int ( input ( ) ) NEW_LINE if n % 2 == 0 : NEW_LINE INDENT print ( " Blue " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " Red " ) NEW_LINE DEDENT DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT main ( ) NEW_LINE DEDENT


print ( " BRleude " [ int ( input ( ) ) % 2 : : 2 ] ) NEW_LINE


import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . InputMismatchException ; import java . io . IOException ; import java . io . InputStream ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; FastScanner in = new FastScanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskA solver = new TaskA ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskA { public void solve ( int testNumber , FastScanner in , PrintWriter out ) { out . println ( ( in . nextInt ( ) & 1 ) == 1 ? " Red " : " Blue " ) ; } } static class FastScanner { private InputStream in ; private byte [ ] buffer = new byte [ 1024 ] ; private int bufPointer ; private int bufLength ; public FastScanner ( InputStream in ) { this . in = in ; this . bufPointer = 0 ; this . bufLength = 0 ; } private int readByte ( ) { if ( bufPointer >= bufLength ) { if ( bufLength == - 1 ) throw new InputMismatchException ( ) ; bufPointer = 0 ; try { bufLength = in . read ( buffer ) ; } catch ( IOException e ) { throw new InputMismatchException ( ) ; } if ( bufLength <= 0 ) return - 1 ; } return buffer [ bufPointer ++ ] ; } private static boolean isSpaceChar ( int c ) { return c == ' ▁ ' || c == ' \n ' || c == ' \r ' || c == ' \t ' || c == - 1 ; } public int nextInt ( ) { int n = 0 ; int b = readByte ( ) ; while ( isSpaceChar ( b ) ) b = readByte ( ) ; boolean minus = ( b == ' - ' ) ; if ( minus ) b = readByte ( ) ; while ( b >= '0' && b <= '9' ) { n *= 10 ; n += b - '0' ; b = readByte ( ) ; } if ( ! isSpaceChar ( b ) ) throw new NumberFormatException ( ) ; return minus ? - n : n ; } } }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . UncheckedIOException ; import java . util . StringTokenizer ; class Main { public static void main ( String [ ] args ) { SC sc = new SC ( System . in ) ; int N = sc . nextInt ( ) ; if ( N % 2 == 0 ) { pl ( " Blue " ) ; } else if ( N % 2 == 1 ) { pl ( " Red " ) ; } } static class SC { private BufferedReader reader = null ; private StringTokenizer tokenizer = null ; public SC ( InputStream in ) { reader = new BufferedReader ( new InputStreamReader ( in ) ) ; } public String next ( ) { if ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new UncheckedIOException ( e ) ; } } return tokenizer . 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 ( ) { try { return reader . readLine ( ) ; } catch ( IOException e ) { throw new UncheckedIOException ( e ) ; } } } public static void pl ( Object o ) { System . out . println ( o ) ; } public static void p ( Object o ) { System . out . print ( o ) ; } public static boolean isPrime ( int a ) { if ( a < 4 ) { if ( a == 2 || a == 3 ) { return true ; } else { return false ; } } else { for ( int j = 2 ; j * j <= a ; j ++ ) { if ( a % j == 0 ) { return false ; } if ( a % j != 0 && ( j + 1 ) * ( j + 1 ) > a ) { return true ; } } return true ; } } }


import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int N = scanner . nextInt ( ) ; System . out . println ( ( N % 2 == 0 ) ? " Blue " : " Red " ) ; } }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class Main { static int N ; public static void main ( String [ ] args ) { FastScanner fc = new FastScanner ( System . in ) ; N = fc . nextInt ( ) ; System . out . println ( solve ( ) ) ; } static String solve ( ) { return N % 2 == 1 ? " Red " : " Blue " ; } @ SuppressWarnings ( " unused " ) static class FastScanner { private BufferedReader reader ; private StringTokenizer tokenizer ; FastScanner ( InputStream in ) { reader = new BufferedReader ( new InputStreamReader ( in ) ) ; tokenizer = null ; } String next ( ) { if ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( ) ; } String nextLine ( ) { if ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { try { return reader . readLine ( ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( " \n " ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } int [ ] nextIntArray ( int n ) { int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextInt ( ) ; return a ; } long [ ] nextLongArray ( int n ) { long [ ] a = new long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextLong ( ) ; return a ; } } }


public class Main { public static void main ( String [ ] args ) { java . util . Scanner s = new java . util . Scanner ( System . in ) ; int n = s . nextInt ( ) , a [ ] = new int [ n ] ; java . util . List < Integer > list = new java . util . ArrayList < > ( java . util . stream . IntStream . range ( 0 , n ) . map ( i -> a [ i ] = s . nextInt ( ) ) . boxed ( ) . collect ( java . util . stream . Collectors . toCollection ( java . util . TreeSet :: new ) ) ) ; for ( int i : a ) System . out . println ( java . util . Collections . binarySearch ( list , i ) ) ; } }

n = int ( input ( ) ) NEW_LINE A = list ( int ( input ( ) ) for i in range ( n ) ) NEW_LINE B = sorted ( list ( set ( A ) ) ) NEW_LINE C = { } NEW_LINE for i in range ( len ( B ) ) : NEW_LINE INDENT C [ B [ i ] ] = i NEW_LINE DEDENT for i in range ( len ( A ) ) : NEW_LINE INDENT print ( C [ A [ i ] ] ) NEW_LINE DEDENT


def seat_pressure ( N : int , A : list ) -> list : NEW_LINE INDENT m = { a : i for i , a in enumerate ( sorted ( set ( A ) ) ) } NEW_LINE return [ m [ a ] for a in A ] NEW_LINE DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT N = int ( input ( ) ) NEW_LINE A = [ int ( input ( ) ) for _ in range ( N ) ] NEW_LINE ans = seat_pressure ( N , A ) NEW_LINE for a in ans : NEW_LINE INDENT print ( a ) NEW_LINE DEDENT DEDENT


def getInt ( ) : return int ( input ( ) ) NEW_LINE def getIntList ( ) : return [ int ( x ) for x in input ( ) . split ( ) ] NEW_LINE def zeros ( n ) : return [ 0 ] * n NEW_LINE INF = 10 ** 18 NEW_LINE class Debug ( ) : NEW_LINE INDENT def __init__ ( self ) : NEW_LINE INDENT self . debug = True NEW_LINE DEDENT def off ( self ) : NEW_LINE INDENT self . debug = False NEW_LINE DEDENT def dmp ( self , x , cmt = ' ' ) : NEW_LINE INDENT if self . debug : NEW_LINE INDENT if cmt != ' ' : NEW_LINE INDENT w = cmt + ' : ▁ ' + str ( x ) NEW_LINE DEDENT else : NEW_LINE INDENT w = str ( x ) NEW_LINE DEDENT print ( w ) NEW_LINE DEDENT return x NEW_LINE DEDENT DEDENT def prob ( ) : NEW_LINE INDENT d = Debug ( ) NEW_LINE d . off ( ) NEW_LINE N = getInt ( ) NEW_LINE d . dmp ( ( N ) , ' N ' ) NEW_LINE A = zeros ( N ) NEW_LINE adic = { } NEW_LINE for i in range ( N ) : NEW_LINE INDENT A [ i ] = getInt ( ) NEW_LINE adic [ A [ i ] ] = 0 NEW_LINE DEDENT ordered = sorted ( list ( adic . keys ( ) ) ) NEW_LINE for i in range ( len ( ordered ) ) : NEW_LINE INDENT adic [ ordered [ i ] ] = i NEW_LINE DEDENT for x in A : NEW_LINE INDENT print ( adic [ x ] ) NEW_LINE DEDENT return NEW_LINE DEDENT ans = prob ( ) NEW_LINE


import sys NEW_LINE input = sys . stdin . readline NEW_LINE N = int ( input ( ) ) NEW_LINE a = [ int ( input ( ) ) for _ in range ( N ) ] NEW_LINE anslist = [ 0 ] * N NEW_LINE for i , j in enumerate ( a ) : NEW_LINE INDENT anslist [ i ] = [ i , j , 0 ] NEW_LINE DEDENT anslist = sorted ( anslist , key = lambda x : x [ 1 ] ) NEW_LINE tmp = anslist [ 0 ] [ 1 ] NEW_LINE cnt = 0 NEW_LINE for i in range ( 1 , N ) : NEW_LINE INDENT if anslist [ i ] [ 1 ] == tmp : NEW_LINE INDENT anslist [ i ] [ 2 ] = cnt NEW_LINE DEDENT else : NEW_LINE INDENT tmp = anslist [ i ] [ 1 ] NEW_LINE cnt += 1 NEW_LINE anslist [ i ] [ 2 ] = cnt NEW_LINE DEDENT DEDENT anslist = sorted ( anslist , key = lambda x : x [ 0 ] ) NEW_LINE for i in anslist : NEW_LINE INDENT print ( i [ 2 ] ) NEW_LINE DEDENT


from collections import * ; n , * a = map ( int , open ( 0 ) . read ( ) . split ( ) ) ; b = { v : k for ( k , v ) in enumerate ( sorted ( set ( a ) ) ) } NEW_LINE for i in a : NEW_LINE INDENT print ( b [ i ] ) NEW_LINE DEDENT


import java . math . BigDecimal ; import java . util . * ; public class Main { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int N = sc . nextInt ( ) ; long [ ] values = new long [ N ] ; SortedSet < Long > distincts = new TreeSet < > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { values [ i ] = sc . nextLong ( ) ; distincts . add ( values [ i ] ) ; } HashMap < Long , Integer > rank = new HashMap < > ( ) ; int index = 0 ; for ( Long v : distincts ) { rank . put ( v , index ) ; index ++ ; } for ( int i = 0 ; i < N ; i ++ ) { System . out . println ( rank . get ( values [ i ] ) ) ; } } }


import java . util . Arrays ; import java . util . HashMap ; import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; int [ ] a2 = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; a2 [ i ] = a [ i ] ; } Arrays . sort ( a2 ) ; int cnt = 1 ; int tmp = a2 [ 0 ] ; HashMap < Integer , Integer > map = new HashMap < Integer , Integer > ( ) ; map . put ( a2 [ 0 ] , 0 ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( tmp != a2 [ i ] ) { cnt ++ ; tmp = a2 [ i ] ; map . put ( a2 [ i ] , cnt - 1 ) ; } } for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( map . get ( a [ i ] ) ) ; } sc . close ( ) ; } }


import java . util . * ; public class Main { public static class Pair { int index ; int value ; public Pair ( int index , int value ) { this . index = index ; this . value = value ; } } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; ArrayList < Pair > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { int index = i ; int value = sc . nextInt ( ) ; Pair p = new Pair ( index , value ) ; list . add ( p ) ; } Collections . sort ( list , ( a , b ) -> a . value - b . value ) ; int before = Integer . MAX_VALUE ; int nValue = - 1 ; for ( int i = 0 ; i < list . size ( ) ; i ++ ) { int tmp = list . get ( i ) . value ; if ( tmp != before ) { before = tmp ; nValue ++ ; } list . get ( i ) . value = nValue ; } Collections . sort ( list , ( a , b ) -> a . index - b . index ) ; for ( int i = 0 ; i < list . size ( ) ; i ++ ) { System . out . println ( list . get ( i ) . value ) ; } } }