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 ( ( 18 - in . nextInt ( ) ) * 60 - in . nextInt ( ) ) ; } } 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 sys NEW_LINE sys . setrecursionlimit ( 10 ** 9 ) NEW_LINE input = sys . stdin . readline NEW_LINE h , m = map ( int , input ( ) . split ( ) ) NEW_LINE ams = 0 NEW_LINE if m == 0 : NEW_LINE INDENT ans = ( 18 - h ) * 60 NEW_LINE DEDENT else : NEW_LINE INDENT ans = ( 18 - h - 1 ) * 60 + ( 60 - m ) NEW_LINE DEDENT print ( ans ) NEW_LINE


H , M = [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE print ( ( 18 - H ) * 60 - M ) NEW_LINE


def main ( ) : NEW_LINE INDENT h , m = map ( int , input ( ) . split ( ) ) NEW_LINE print ( 18 * 60 - ( h * 60 + m ) ) NEW_LINE DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT main ( ) NEW_LINE DEDENT


h , m = map ( int , input ( ) . split ( ) ) NEW_LINE def get_minute ( in_h , in_m ) : NEW_LINE INDENT return in_h * 60 + in_m NEW_LINE DEDENT ans = get_minute ( 18 , 0 ) - get_minute ( h , m ) NEW_LINE print ( ans ) NEW_LINE


import java . util . Scanner ; public class Main { static Scanner s = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int limit = 18 * 60 ; System . out . println ( limit - s . nextInt ( ) * 60 - s . nextInt ( ) ) ; } }

h , m = map ( int , input ( ) . split ( ) ) NEW_LINE min = 60 * h + m NEW_LINE a = 18 * 60 NEW_LINE print ( a - min ) NEW_LINE


import java . util . * ; import java . awt . * ; import java . awt . geom . * ; import static java . lang . System . * ; import static java . lang . Math . * ; public class Main { public static void main ( String [ ] $ ) { Scanner sc = new Scanner ( in ) ; int h = sc . nextInt ( ) , m = sc . nextInt ( ) ; out . println ( 18 * 60 - 60 * h - m ) ; } }


import java . util . Scanner ; public class Main { private static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { String s = sc . next ( ) ; StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < s . length ( ) ; i += 2 ) { sb . append ( s . charAt ( i ) ) ; } System . out . println ( sb ) ; } }

s = input ( ) NEW_LINE print ( s [ : : 2 ] ) NEW_LINE


import sys NEW_LINE ns = lambda : sys . stdin . readline ( ) . rstrip ( ) NEW_LINE ni = lambda : int ( ns ( ) ) NEW_LINE nm = lambda : map ( int , sys . stdin . readline ( ) . split ( ) ) NEW_LINE nl = lambda : list ( nm ( ) ) NEW_LINE s = list ( ns ( ) ) NEW_LINE ans = [ ] NEW_LINE for i in range ( 0 , len ( s ) , 2 ) : NEW_LINE INDENT ans . append ( s [ i ] ) NEW_LINE DEDENT print ( ' ' . join ( ans ) ) NEW_LINE


s = input ( ) NEW_LINE n = len ( s ) NEW_LINE a = " " NEW_LINE if n % 2 == 0 : NEW_LINE INDENT for i in range ( 0 , n , 2 ) : NEW_LINE INDENT a += s [ i ] NEW_LINE DEDENT DEDENT else : NEW_LINE INDENT for i in range ( 0 , n + 1 , 2 ) : NEW_LINE INDENT a += s [ i ] NEW_LINE DEDENT DEDENT print ( a ) NEW_LINE


A = input ( ) NEW_LINE B = [ ] NEW_LINE for i , v in enumerate ( A ) : NEW_LINE INDENT if i % 2 == 0 : NEW_LINE INDENT B . append ( v ) NEW_LINE DEDENT else : NEW_LINE INDENT continue NEW_LINE DEDENT DEDENT print ( " " . join ( B ) ) NEW_LINE


s = list ( input ( ) ) NEW_LINE AnsList = s [ : : 2 ] NEW_LINE print ( ' ' . join ( AnsList ) ) NEW_LINE


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 s = in . next ( ) ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( i % 2 == 0 ) { out . print ( s . charAt ( i ) ) ; } } out . println ( ) ; } } 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 ( ) ) ; } public double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } } }


import java . util . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String s = scan . next ( ) ; int some = roundup ( s . length ( ) ) ; char [ ] ans = new char [ some ] ; for ( int i = 0 ; i < some ; i ++ ) { ans [ i ] = s . charAt ( i * 2 ) ; } System . out . print ( ans ) ; } public static int roundup ( int x ) { int ans = 0 ; if ( x % 2 == 0 ) { ans = x / 2 ; } else { ans = x / 2 + 1 ; } return ans ; } }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String word = input . readLine ( ) ; StringBuilder builder = new StringBuilder ( ) ; for ( int i = 0 ; i < word . length ( ) ; i += 2 ) { builder . append ( word . charAt ( i ) ) ; } System . out . println ( builder ) ; } }


import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; BOddString solver = new BOddString ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class BOddString { public void solve ( int testNumber , InputReader in , PrintWriter out ) { String s = in . next ( ) ; String concate = " " ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( i % 2 == 0 ) out . print ( s . charAt ( i ) ) ; } out . println ( ) ; } } 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 ( ) ; } } }


import java . util . * ; public class Main { static class TriTree { Node root = new Node ( ) ; class Node { ArrayList < Node > child = new ArrayList < > ( ) ; char c ; long depth ; public void add ( Node node ) { child . add ( node ) ; } public Node ( ) { } public Node ( char c , long depth ) { this . c = c ; this . depth = depth ; } public long xorGrundy ( ) { long xor = 0 ; for ( Node node : child ) xor ^= node . xorGrundy ( ) ; if ( child . size ( ) == 1 ) xor ^= grundy ( L - depth ) ; return xor ; } } public void addLeaf ( String s ) { Node cur = root ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { boolean found = false ; for ( Node child : cur . child ) { if ( child . c == s . charAt ( i ) ) { cur = child ; found = true ; break ; } } if ( ! found ) { Node next = new Node ( s . charAt ( i ) , i + 1 ) ; cur . add ( next ) ; cur = next ; } } } public long xorGrundy ( ) { return root . xorGrundy ( ) ; } } static long L ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; L = sc . nextLong ( ) ; TriTree tree = new TriTree ( ) ; for ( int i = 0 ; i < N ; i ++ ) tree . addLeaf ( sc . next ( ) ) ; System . out . println ( tree . xorGrundy ( ) == 0 ? " Bob " : " Alice " ) ; sc . close ( ) ; } static long grundy ( long n ) { long ans = 1 ; while ( n % ans == 0 ) ans <<= 1 ; return ans ; } }

def getGrundyNumber ( x ) : NEW_LINE INDENT ans = 1 NEW_LINE while x % ( ans * 2 ) == 0 : NEW_LINE INDENT ans *= 2 NEW_LINE DEDENT return ans NEW_LINE DEDENT N , L = map ( int , input ( ) . split ( ) ) NEW_LINE Ss = [ input ( ) for i in range ( N ) ] NEW_LINE Ss . sort ( ) NEW_LINE Hgts = { L : 2 } NEW_LINE prev = ' _ ' NEW_LINE for S in Ss : NEW_LINE INDENT for iS , ( a , b ) in enumerate ( zip ( prev , S ) ) : NEW_LINE INDENT if a != b : NEW_LINE INDENT Hgts [ L - iS ] -= 1 NEW_LINE for h in range ( L - len ( S ) + 1 , L - iS ) : NEW_LINE INDENT Hgts [ h ] = Hgts . get ( h , 0 ) + 1 NEW_LINE DEDENT break NEW_LINE DEDENT DEDENT prev = S NEW_LINE DEDENT ans = 0 NEW_LINE for Hgt , num in Hgts . items ( ) : NEW_LINE INDENT if num % 2 : NEW_LINE INDENT ans ^= getGrundyNumber ( Hgt ) NEW_LINE DEDENT DEDENT if ans : NEW_LINE INDENT print ( ' Alice ' ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( ' Bob ' ) NEW_LINE DEDENT


import sys NEW_LINE sys . setrecursionlimit ( 2 * 10 ** 5 ) NEW_LINE class TrieNode : NEW_LINE INDENT def __init__ ( self , char ) : NEW_LINE INDENT self . char = char NEW_LINE self . nextnode = dict ( ) NEW_LINE self . is_indict = False NEW_LINE DEDENT DEDENT class Trie : NEW_LINE INDENT def __init__ ( self , charset ) : NEW_LINE INDENT self . charset = charset NEW_LINE self . root = TrieNode ( ' ' ) NEW_LINE DEDENT def add ( self , a_str ) : NEW_LINE INDENT node = self . root NEW_LINE for i , char in enumerate ( a_str ) : NEW_LINE INDENT if char not in node . nextnode : NEW_LINE INDENT node . nextnode [ char ] = TrieNode ( char ) NEW_LINE DEDENT node = node . nextnode [ char ] NEW_LINE if i == len ( a_str ) - 1 : NEW_LINE INDENT node . is_indict = True NEW_LINE DEDENT DEDENT DEDENT def dfs ( self , node , dep ) : NEW_LINE INDENT ret , cnt = 0 , 0 NEW_LINE if node . is_indict : NEW_LINE INDENT return 0 NEW_LINE DEDENT for s in '01' : NEW_LINE INDENT if s not in node . nextnode : NEW_LINE INDENT cnt += 1 NEW_LINE DEDENT else : NEW_LINE INDENT ret ^= self . dfs ( node . nextnode [ s ] , dep + 1 ) NEW_LINE DEDENT DEDENT height = L - dep NEW_LINE if cnt % 2 : NEW_LINE INDENT power2 = 0 NEW_LINE while height > 0 and height % 2 == 0 : NEW_LINE INDENT power2 += 1 NEW_LINE height //= 2 NEW_LINE DEDENT ret ^= 2 ** power2 NEW_LINE DEDENT return ret NEW_LINE DEDENT def debug_output ( self , node , now ) : NEW_LINE INDENT print ( node . char , list ( node . nextnode . items ( ) ) , node . is_indict , now ) NEW_LINE if node . is_indict : NEW_LINE INDENT print ( now ) NEW_LINE DEDENT for n in node . nextnode . values ( ) : NEW_LINE INDENT self . debug_output ( n , now + n . char ) NEW_LINE DEDENT DEDENT DEDENT N , L = map ( int , input ( ) . split ( ) ) NEW_LINE T = Trie ( '01' ) NEW_LINE for _ in range ( N ) : NEW_LINE INDENT T . add ( input ( ) ) NEW_LINE DEDENT print ( " Alice " if T . dfs ( T . root , 0 ) else " Bob " ) NEW_LINE


N , L = map ( int , input ( ) . split ( ) ) NEW_LINE make = lambda : [ None , None , 0 ] NEW_LINE root = make ( ) NEW_LINE def construct ( s ) : NEW_LINE INDENT n = root NEW_LINE for i in s : NEW_LINE INDENT if n [ i ] is None : NEW_LINE INDENT n [ i ] = n = make ( ) NEW_LINE DEDENT else : NEW_LINE INDENT n = n [ i ] NEW_LINE DEDENT DEDENT n [ 2 ] = 1 NEW_LINE DEDENT for i in range ( N ) : NEW_LINE INDENT s = map ( int , input ( ) ) NEW_LINE construct ( s ) NEW_LINE DEDENT caps = { } NEW_LINE st = [ ( root , 0 , 0 ) ] NEW_LINE while st : NEW_LINE INDENT n , i , l = st . pop ( ) NEW_LINE if i : NEW_LINE INDENT if n [ 1 ] is None : NEW_LINE INDENT caps [ L - l ] = caps . get ( L - l , 0 ) + 1 NEW_LINE DEDENT else : NEW_LINE INDENT if not n [ 1 ] [ 2 ] : NEW_LINE INDENT st . append ( ( n [ 1 ] , 0 , l + 1 ) ) NEW_LINE DEDENT DEDENT DEDENT else : NEW_LINE INDENT st . append ( ( n , 1 , l ) ) NEW_LINE if n [ 0 ] is None : NEW_LINE INDENT caps [ L - l ] = caps . get ( L - l , 0 ) + 1 NEW_LINE DEDENT else : NEW_LINE INDENT if not n [ 0 ] [ 2 ] : NEW_LINE INDENT st . append ( ( n [ 0 ] , 0 , l + 1 ) ) NEW_LINE DEDENT DEDENT DEDENT DEDENT ans = 0 NEW_LINE for v in caps : NEW_LINE INDENT k = caps [ v ] NEW_LINE if k % 2 == 0 : NEW_LINE INDENT continue NEW_LINE DEDENT v -= 1 NEW_LINE r = 1 NEW_LINE while v % 4 == 3 : NEW_LINE INDENT v //= 4 NEW_LINE r *= 4 NEW_LINE DEDENT if v % 4 == 1 : NEW_LINE INDENT ans ^= r * 2 NEW_LINE DEDENT else : NEW_LINE INDENT ans ^= r NEW_LINE DEDENT DEDENT print ( ' Alice ' if ans else ' Bob ' ) NEW_LINE


import sys NEW_LINE input = sys . stdin . readline NEW_LINE sys . setrecursionlimit ( 10 ** 9 ) NEW_LINE from collections import deque NEW_LINE class Node : NEW_LINE INDENT def __init__ ( self , depth ) : NEW_LINE INDENT self . depth = depth NEW_LINE self . left = None NEW_LINE self . right = None NEW_LINE DEDENT DEDENT def insert ( node , s ) : NEW_LINE INDENT n = node NEW_LINE for i in range ( len ( s ) ) : NEW_LINE INDENT t = s [ i ] NEW_LINE if t == '0' : NEW_LINE INDENT if n . left is None : NEW_LINE INDENT n . left = Node ( i + 1 ) NEW_LINE DEDENT n = n . left NEW_LINE DEDENT else : NEW_LINE INDENT if n . right is None : NEW_LINE INDENT n . right = Node ( i + 1 ) NEW_LINE DEDENT n = n . right NEW_LINE DEDENT DEDENT DEDENT class Trie : NEW_LINE INDENT def __init__ ( self ) : NEW_LINE INDENT self . root = Node ( 0 ) NEW_LINE DEDENT def insert ( self , s : str ) : NEW_LINE INDENT insert ( self . root , s ) NEW_LINE DEDENT DEDENT n , l = map ( int , input ( ) . split ( ) ) NEW_LINE S = [ input ( ) . strip ( ) for _ in range ( n ) ] NEW_LINE trie = Trie ( ) NEW_LINE for s in S : NEW_LINE INDENT trie . insert ( s ) NEW_LINE DEDENT Data = [ ] NEW_LINE q = deque ( [ trie . root ] ) NEW_LINE def dfs ( node ) : NEW_LINE INDENT if node . right is None and node . left is None : NEW_LINE INDENT return NEW_LINE DEDENT if node . right is None or node . left is None : NEW_LINE INDENT Data . append ( l - node . depth ) NEW_LINE DEDENT if node . right : NEW_LINE INDENT q . append ( node . right ) NEW_LINE DEDENT if node . left : NEW_LINE INDENT q . append ( node . left ) NEW_LINE DEDENT DEDENT while q : NEW_LINE INDENT dfs ( q . popleft ( ) ) NEW_LINE DEDENT xor = 0 NEW_LINE def Grundy ( n ) : NEW_LINE INDENT ret = 1 NEW_LINE while n % 2 == 0 : NEW_LINE INDENT n //= 2 NEW_LINE ret *= 2 NEW_LINE DEDENT return ret NEW_LINE DEDENT for i in Data : NEW_LINE INDENT xor ^= Grundy ( i ) NEW_LINE DEDENT print ( ' Alice ' if xor else ' Bob ' ) NEW_LINE


from collections import defaultdict NEW_LINE def solve ( n , l , nums ) : NEW_LINE INDENT xor = 0 NEW_LINE if n == 1 : NEW_LINE INDENT for i in range ( min ( nums ) , l + 1 ) : NEW_LINE INDENT xor ^= i & - i NEW_LINE DEDENT return xor NEW_LINE DEDENT for i in range ( min ( nums ) , l + 1 ) : NEW_LINE INDENT ni = nums [ i ] NEW_LINE for k in ni : NEW_LINE INDENT if k ^ 1 not in ni : NEW_LINE INDENT xor ^= i & - i NEW_LINE DEDENT nums [ i + 1 ] . add ( k // 2 ) NEW_LINE DEDENT del nums [ i ] NEW_LINE DEDENT return xor NEW_LINE DEDENT n , l = map ( int , input ( ) . split ( ) ) NEW_LINE nums = defaultdict ( set ) NEW_LINE for s in ( input ( ) for _ in range ( n ) ) : NEW_LINE INDENT nums [ l - len ( s ) + 1 ] . add ( int ( s , 2 ) + ( 1 << len ( s ) ) ) NEW_LINE DEDENT print ( ' Alice ' if solve ( n , l , nums ) else ' Bob ' ) NEW_LINE


import java . util . * ; import static java . lang . System . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] a = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } int [ ] rate = new int [ ] { 400 , 800 , 1200 , 1600 , 2000 , 2400 , 2800 , 3200 } ; boolean [ ] exist = new boolean [ 8 ] ; int master = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( a [ i ] >= 3200 ) { master ++ ; continue ; } for ( int j = 0 ; j < rate . length ; j ++ ) { if ( a [ i ] < rate [ j ] ) { exist [ j ] = true ; break ; } } } int min = 0 ; for ( int i = 0 ; i < exist . length ; i ++ ) { if ( exist [ i ] ) { min ++ ; } } int max = min + master ; if ( min == 0 ) { min = 1 ; } out . print ( min + " ▁ " + max ) ; } }

N = int ( input ( ) ) NEW_LINE a = map ( int , input ( ) . split ( ) ) NEW_LINE color_set = set ( ) NEW_LINE original_cnt = 0 NEW_LINE red_flag = False NEW_LINE for val in a : NEW_LINE INDENT if val >= 3200 : NEW_LINE INDENT original_cnt += 1 NEW_LINE DEDENT else : NEW_LINE INDENT if val >= 2800 : NEW_LINE INDENT red_flag = True NEW_LINE DEDENT color_set . add ( int ( val / 400 ) ) NEW_LINE DEDENT DEDENT if red_flag is True : NEW_LINE INDENT print ( ' { } ▁ { } ' . format ( len ( color_set ) , len ( color_set ) + original_cnt ) ) NEW_LINE DEDENT else : NEW_LINE INDENT if original_cnt > 0 : NEW_LINE INDENT print ( ' { } ▁ { } ' . format ( len ( color_set ) + 1 , len ( color_set ) + original_cnt ) ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( ' { } ▁ { } ' . format ( len ( color_set ) , len ( color_set ) ) ) NEW_LINE DEDENT DEDENT


from collections import Counter NEW_LINE N = int ( input ( ) ) NEW_LINE a = Counter ( list ( map ( lambda x : x // 400 , map ( int , input ( ) . split ( ) ) ) ) ) NEW_LINE c = n = 0 NEW_LINE for key in [ 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 ] : NEW_LINE INDENT if a [ key ] : NEW_LINE INDENT c += 1 NEW_LINE DEDENT DEDENT for key in [ 8 , 9 , 10 , 11 , 12 ] : NEW_LINE INDENT n += a [ key ] NEW_LINE DEDENT max_n = c + n NEW_LINE if c : NEW_LINE INDENT min_n = c NEW_LINE DEDENT else : NEW_LINE INDENT min_n = 1 NEW_LINE DEDENT print ( min_n , max_n ) NEW_LINE


import sys NEW_LINE import collections NEW_LINE ns = lambda : sys . stdin . readline ( ) . rstrip ( ) NEW_LINE ni = lambda : int ( ns ( ) ) NEW_LINE nm = lambda : map ( int , sys . stdin . readline ( ) . split ( ) ) NEW_LINE nl = lambda : list ( nm ( ) ) NEW_LINE nsl = lambda : map ( str , sys . stdin . readline ( ) . split ( ) ) NEW_LINE n = ni ( ) NEW_LINE a = nl ( ) NEW_LINE l = [ 0 for _ in range ( 9 ) ] NEW_LINE for i in range ( n ) : NEW_LINE INDENT if a [ i ] <= 399 : NEW_LINE INDENT l [ 0 ] += 1 NEW_LINE DEDENT elif 400 <= a [ i ] <= 799 : NEW_LINE INDENT l [ 1 ] += 1 NEW_LINE DEDENT elif 800 <= a [ i ] <= 1199 : NEW_LINE INDENT l [ 2 ] += 1 NEW_LINE DEDENT elif 1200 <= a [ i ] <= 1599 : NEW_LINE INDENT l [ 3 ] += 1 NEW_LINE DEDENT elif 1600 <= a [ i ] <= 1999 : NEW_LINE INDENT l [ 4 ] += 1 NEW_LINE DEDENT elif 2000 <= a [ i ] <= 2399 : NEW_LINE INDENT l [ 5 ] += 1 NEW_LINE DEDENT elif 2400 <= a [ i ] <= 2799 : NEW_LINE INDENT l [ 6 ] += 1 NEW_LINE DEDENT elif 2800 <= a [ i ] <= 3199 : NEW_LINE INDENT l [ 7 ] += 1 NEW_LINE DEDENT elif 3200 <= a [ i ] : NEW_LINE INDENT l [ 8 ] += 1 NEW_LINE DEDENT DEDENT if l [ 8 ] == 0 : NEW_LINE INDENT print ( 9 - l . count ( 0 ) , 9 - l . count ( 0 ) ) NEW_LINE DEDENT else : NEW_LINE INDENT if l . count ( 0 ) == 8 : NEW_LINE INDENT print ( 1 , l [ 8 ] ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( 8 - l . count ( 0 ) , 8 - l . count ( 0 ) + l [ 8 ] ) NEW_LINE DEDENT DEDENT


from collections import OrderedDict NEW_LINE import numpy as np NEW_LINE N = int ( input ( ) ) NEW_LINE a = np . array ( [ int ( i ) for i in input ( ) . split ( ) ] ) NEW_LINE scores = OrderedDict ( ) NEW_LINE scores [ 1 ] = 0 NEW_LINE scores [ 400 ] = 0 NEW_LINE scores [ 800 ] = 0 NEW_LINE scores [ 1200 ] = 0 NEW_LINE scores [ 1600 ] = 0 NEW_LINE scores [ 2000 ] = 0 NEW_LINE scores [ 2400 ] = 0 NEW_LINE scores [ 2800 ] = 0 NEW_LINE scores [ 3200 ] = 0 NEW_LINE for record in a : NEW_LINE INDENT for s in list ( scores . keys ( ) ) [ : : - 1 ] : NEW_LINE INDENT if record >= s : NEW_LINE INDENT scores [ s ] += 1 NEW_LINE break NEW_LINE DEDENT DEDENT DEDENT colors = np . sum ( [ int ( v > 0 ) for k , v in scores . items ( ) if k < 3200 ] ) NEW_LINE if scores [ 3200 ] > 0 and colors == 0 : NEW_LINE INDENT min_colors = 1 NEW_LINE DEDENT else : NEW_LINE INDENT min_colors = colors NEW_LINE DEDENT max_colors = colors + scores [ 3200 ] NEW_LINE print ( min_colors , max_colors ) NEW_LINE


import sys NEW_LINE def main ( ) : NEW_LINE INDENT input = sys . stdin . readline NEW_LINE N = int ( input ( ) ) NEW_LINE A = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE wildcard = 0 NEW_LINE color = [ 0 ] * 8 NEW_LINE for a in A : NEW_LINE INDENT if a < 400 : NEW_LINE INDENT color [ 0 ] = 1 NEW_LINE DEDENT elif a < 800 : NEW_LINE INDENT color [ 1 ] = 1 NEW_LINE DEDENT elif a < 1200 : NEW_LINE INDENT color [ 2 ] = 1 NEW_LINE DEDENT elif a < 1600 : NEW_LINE INDENT color [ 3 ] = 1 NEW_LINE DEDENT elif a < 2000 : NEW_LINE INDENT color [ 4 ] = 1 NEW_LINE DEDENT elif a < 2400 : NEW_LINE INDENT color [ 5 ] = 1 NEW_LINE DEDENT elif a < 2800 : NEW_LINE INDENT color [ 6 ] = 1 NEW_LINE DEDENT elif a < 3200 : NEW_LINE INDENT color [ 7 ] = 1 NEW_LINE DEDENT else : NEW_LINE INDENT wildcard += 1 NEW_LINE DEDENT DEDENT nc = sum ( color ) NEW_LINE print ( max ( 1 , nc ) , nc + wildcard ) NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT main ( ) NEW_LINE DEDENT


import java . util . * ; import java . lang . * ; import java . math . * ; class Main { static int n ; static int m ; static int ans ; static int [ ] rate ; static int var ; static int ansmin ; static int ansmax ; static int [ ] w ; static int [ ] ww ; static boolean [ ] visit ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; n = sc . nextInt ( ) ; ansmin = 0 ; ansmax = 0 ; rate = new int [ 9 ] ; for ( int i = 0 ; i < n ; i ++ ) { int tmp = sc . nextInt ( ) ; if ( tmp >= 3200 ) { tmp = 3200 ; } rate [ tmp / 400 ] ++ ; } for ( int i = 0 ; i < 7 ; i ++ ) { if ( rate [ i ] != 0 ) { ansmin ++ ; ansmax ++ ; } } if ( rate [ 7 ] == 0 ) { if ( rate [ 8 ] != 0 ) { ansmin ++ ; ansmax += rate [ 8 ] ; } } else { ansmin ++ ; ansmax ++ ; if ( rate [ 8 ] != 0 ) { ansmax += ( rate [ 8 ] ) ; } } System . out . println ( ansmin + " ▁ " + ansmax ) ; sc . close ( ) ; } public static void dfs ( int placenow ) { visit [ placenow ] = true ; boolean success = true ; for ( int i = 0 ; i < n ; i ++ ) { if ( visit [ i ] == false ) { success = false ; break ; } } if ( success ) { ans ++ ; visit [ placenow ] = false ; return ; } for ( int i = 0 ; i < m ; i ++ ) { if ( w [ i ] == placenow && visit [ ww [ i ] ] == false ) { dfs ( ww [ i ] ) ; } else if ( ww [ i ] == placenow && visit [ w [ i ] ] == false ) { dfs ( w [ i ] ) ; } else { continue ; } } visit [ placenow ] = false ; return ; } }


public class Main { private static java . util . Scanner scanner = new java . util . Scanner ( System . in ) ; public static void main ( String [ ] args ) { int n = scanner . nextInt ( ) , ans = 0 , colors [ ] = new int [ 9 ] ; for ( int i = 0 , temp ; i < n ; i ++ ) if ( ++ colors [ temp = Color . getColor ( scanner . nextInt ( ) ) . ordinal ( ) ] == 1 && temp != 8 ) ans ++ ; System . out . println ( Math . max ( 1 , ans ) + " ▁ " + ( ans + colors [ 8 ] ) ) ; } enum Color { GRAY ( 1 , 399 ) , BROWN ( 400 , 799 ) , GREEN ( 800 , 1199 ) , LIGHT_BLUE ( 1200 , 1599 ) , BLUE ( 1600 , 1999 ) , YELLOW ( 2000 , 2399 ) , ORANGE ( 2400 , 2799 ) , RED ( 2800 , 3199 ) , FREE ( 3200 , 4800 ) ; int min , max ; Color ( int min , int max ) { this . min = min ; this . max = max ; } static Color getColor ( int rate ) { for ( Color color : values ( ) ) if ( color . min <= rate && rate <= color . max ) return color ; return null ; } } }


import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner reader = new Scanner ( System . in ) ; int N = reader . nextInt ( ) ; String remain = "01234567" ; int over = 0 ; for ( int i = 0 ; i < N ; i ++ ) { int num = reader . nextInt ( ) / 400 ; if ( num < 8 ) { remain = remain . replace ( Integer . toString ( num ) , " " ) ; } else { over ++ ; } } int min = 8 - remain . length ( ) ; int max = min + over ; if ( min < 1 ) { min = 1 ; } reader . close ( ) ; System . out . print ( min + " ▁ " + max ) ; } }


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 ( ) ; HashSet < Integer > kinds = new HashSet < > ( ) ; int any = 0 ; for ( int i = 0 ; i < N ; i ++ ) { int value = sc . nextInt ( ) ; if ( value <= 399 ) { kinds . add ( 0 ) ; } else if ( value <= 799 ) { kinds . add ( 1 ) ; } else if ( value <= 1199 ) { kinds . add ( 2 ) ; } else if ( value <= 1599 ) { kinds . add ( 3 ) ; } else if ( value <= 1999 ) { kinds . add ( 4 ) ; } else if ( value <= 2399 ) { kinds . add ( 5 ) ; } else if ( value <= 2799 ) { kinds . add ( 6 ) ; } else if ( value <= 3199 ) { kinds . add ( 7 ) ; } else { any ++ ; } } int min = ( kinds . size ( ) == 0 ) ? 1 : kinds . size ( ) ; int max = kinds . size ( ) + any ; System . out . println ( min + " ▁ " + max ) ; } }


import java . util . * ; public class Main { public static boolean isValid ( char c ) { if ( c == ' A ' || c == ' C ' || c == ' T ' || c == ' G ' ) { return true ; } return false ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; int max = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { int count = 0 ; for ( int j = i ; j < s . length ( ) ; j ++ ) { if ( isValid ( s . charAt ( j ) ) ) { count ++ ; max = Math . max ( max , count ) ; } else { break ; } } } System . out . println ( max ) ; } }

print ( len ( max ( " " . join ( str ( int ( c in { " A " , " T " , " G " , " C " } ) ) for c in input ( ) ) . split ( "0" ) ) ) ) NEW_LINE


s = input ( ) NEW_LINE counter = 0 NEW_LINE max_count = 0 NEW_LINE for i in range ( len ( s ) ) : NEW_LINE INDENT if s [ i ] == ' A ' or s [ i ] == ' C ' or s [ i ] == ' G ' or s [ i ] == ' T ' : NEW_LINE INDENT counter += 1 NEW_LINE DEDENT else : NEW_LINE INDENT if counter > max_count : NEW_LINE INDENT max_count = counter NEW_LINE counter = 0 NEW_LINE DEDENT else : NEW_LINE INDENT counter = 0 NEW_LINE DEDENT DEDENT DEDENT if counter > max_count : NEW_LINE INDENT max_count = counter NEW_LINE DEDENT print ( max_count ) NEW_LINE


l = list ( input ( ) ) NEW_LINE counter = 0 NEW_LINE atcorder = [ ] NEW_LINE for i in range ( len ( l ) ) : NEW_LINE INDENT if ( l [ i ] == " A " or l [ i ] == " T " or l [ i ] == " G " or l [ i ] == " C " ) : NEW_LINE INDENT counter += 1 NEW_LINE atcorder . append ( counter ) NEW_LINE continue NEW_LINE DEDENT counter = 0 NEW_LINE DEDENT if ( len ( atcorder ) != 0 ) : NEW_LINE INDENT print ( max ( atcorder ) ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( "0" ) NEW_LINE DEDENT


import sys NEW_LINE def i2s ( ) : NEW_LINE INDENT return sys . stdin . readline ( ) . rstrip ( ) NEW_LINE DEDENT def ii2ss ( n ) : NEW_LINE INDENT return [ sys . stdin . readline ( ) for _ in range ( n ) ] NEW_LINE DEDENT def sp2nn ( sp , sep = ' ▁ ' ) : NEW_LINE INDENT return [ int ( s ) for s in sp . split ( sep ) ] NEW_LINE DEDENT def ss2nn ( ss ) : NEW_LINE INDENT return [ int ( s ) for s in list ( ss ) ] NEW_LINE DEDENT def main ( S ) : NEW_LINE INDENT st = set ( ( ' A ' , ' C ' , ' G ' , ' T ' ) ) NEW_LINE cmax = 0 NEW_LINE c = 0 NEW_LINE for s in S : NEW_LINE INDENT if s in st : NEW_LINE INDENT c += 1 NEW_LINE DEDENT else : NEW_LINE INDENT if cmax < c : NEW_LINE INDENT cmax = c NEW_LINE DEDENT c = 0 NEW_LINE DEDENT DEDENT if cmax < c : NEW_LINE INDENT cmax = c NEW_LINE DEDENT print ( cmax ) NEW_LINE DEDENT main ( i2s ( ) ) NEW_LINE


s = input ( ) NEW_LINE t = [ - 1 ] NEW_LINE for i in range ( len ( s ) ) : NEW_LINE INDENT if s [ i ] != " A " and s [ i ] != " G " and s [ i ] != " C " and s [ i ] != " T " : NEW_LINE INDENT t . append ( i ) NEW_LINE DEDENT DEDENT t . append ( len ( s ) ) NEW_LINE ans = 0 NEW_LINE for j in range ( len ( t ) - 1 ) : NEW_LINE INDENT x = t [ j + 1 ] - t [ j ] - 1 NEW_LINE if x > ans : NEW_LINE INDENT ans = x NEW_LINE DEDENT DEDENT print ( ans ) NEW_LINE


import java . io . IOException ; public class Main { public static void main ( String [ ] args ) throws IOException { char moji [ ] = new char [ 11 ] ; int count [ ] = new int [ 11 ] ; for ( int i = 0 ; i < 10 ; i ++ ) { moji [ i ] = ( char ) System . in . read ( ) ; if ( moji [ i ] == ' \n ' ) { break ; } } for ( int i = 0 , j = 0 ; i < moji . length ; i ++ , j ++ ) { while ( moji [ i ] == ' A ' || moji [ i ] == ' C ' || moji [ i ] == ' G ' || moji [ i ] == ' T ' ) { count [ j ] ++ ; i ++ ; } } int max = 0 ; for ( int i = 0 ; i < count . length ; i ++ ) { if ( max < count [ i ] ) { max = count [ i ] ; } } System . out . println ( max ) ; } }


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 ) ; BATCoder solver = new BATCoder ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class BATCoder { public void solve ( int testNumber , Scanner in , PrintWriter out ) { String s = in . next ( ) ; int longest = 0 ; int current = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == ' A ' || s . charAt ( i ) == ' C ' || s . charAt ( i ) == ' G ' || s . charAt ( i ) == ' T ' ) { current ++ ; if ( current > longest ) { longest = current ; } } else { current = 0 ; } } out . println ( longest ) ; } } }


import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; BufferedWriter bw = new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ; char [ ] arr = br . readLine ( ) . toCharArray ( ) ; int max = 0 , cur = 0 ; for ( char c : arr ) { if ( c == ' A ' || c == ' T ' || c == ' C ' || c == ' G ' ) { max = Math . max ( max , ++ cur ) ; } else { cur = 0 ; } } bw . write ( max + " " ) ; bw . close ( ) ; } }


import java . util . Scanner ; class Main { public static void main ( String args [ ] ) { Main main = new Main ( ) ; main . start ( ) ; } public void start ( ) { Scanner sc = new Scanner ( System . in ) ; String str = sc . next ( ) ; String letters [ ] = str . split ( " " ) ; int max = 0 ; for ( int i = 0 ; i < letters . length ; i ++ ) { int num = countLength ( letters , i ) ; if ( num > max ) max = num ; } System . out . println ( max ) ; } public int countLength ( String [ ] letters , int index ) { int count = 0 ; for ( int i = index ; i < letters . length ; i ++ ) { if ( letters [ i ] . equals ( " A " ) || letters [ i ] . equals ( " C " ) || letters [ i ] . equals ( " T " ) || letters [ i ] . equals ( " G " ) ) { count ++ ; } else { return count ; } } return count ++ ; } }


import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { new Main ( ) . compute ( ) ; } void compute ( ) { Scanner sc = new Scanner ( System . in ) ; long N = sc . nextLong ( ) * 10 ; long ans = 0 ; for ( long i = 10 ; i < 10000000000L ; i *= 10 ) { long digit = N % ( i * 10 ) / i ; ans += N / ( i * 10 ) * i / 10 ; if ( digit == 1 ) { ans += N % i / 10 + 1 ; } else if ( digit != 0 ) { ans += i / 10 ; } } System . out . println ( ans ) ; } }

N = int ( input ( ) ) NEW_LINE ans = 0 NEW_LINE for i in range ( 9 ) : NEW_LINE INDENT A = ( N // ( 10 ** ( i ) ) ) NEW_LINE if ( A ) % 10 == 1 : NEW_LINE INDENT ans += ( A // 10 ) * ( 10 ** i ) NEW_LINE ans += ( N % ( 10 ** ( i ) ) + 1 ) NEW_LINE DEDENT elif ( A ) % 10 > 1 : NEW_LINE INDENT ans += ( A // 10 + 1 ) * ( 10 ** i ) NEW_LINE DEDENT else : NEW_LINE INDENT ans += ( A // 10 ) * ( 10 ** i ) NEW_LINE DEDENT DEDENT print ( ans ) NEW_LINE


def one ( N : int ) -> int : NEW_LINE INDENT res = 0 NEW_LINE M = 10 NEW_LINE while N // M : NEW_LINE INDENT R = N % M NEW_LINE res += ( N - R ) // 10 NEW_LINE if R * 10 >= M : NEW_LINE INDENT if R * 10 < 2 * M : NEW_LINE INDENT res += R - M // 10 + 1 NEW_LINE DEDENT else : NEW_LINE INDENT res += M // 10 NEW_LINE DEDENT DEDENT else : NEW_LINE INDENT res += 0 NEW_LINE DEDENT M *= 10 NEW_LINE DEDENT R = N % M NEW_LINE if R * 10 >= M : NEW_LINE INDENT if R * 10 < 2 * M : NEW_LINE INDENT return res + R - M // 10 + 1 NEW_LINE DEDENT else : NEW_LINE INDENT return res + M // 10 NEW_LINE DEDENT DEDENT return res NEW_LINE DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT N = int ( input ( ) ) NEW_LINE ans = one ( N ) NEW_LINE print ( ans ) NEW_LINE DEDENT


import sys NEW_LINE sys . setrecursionlimit ( 10 ** 9 ) NEW_LINE input = sys . stdin . readline NEW_LINE N = input ( ) [ : - 1 ] NEW_LINE dp = [ [ [ 0 ] * ( len ( N ) + 1 ) for _ in range ( 2 ) ] for _ in range ( len ( N ) + 1 ) ] NEW_LINE dp [ 0 ] [ 0 ] [ 0 ] = 1 NEW_LINE for i in range ( len ( N ) ) : NEW_LINE INDENT for j in range ( 2 ) : NEW_LINE INDENT for k in range ( len ( N ) ) : NEW_LINE INDENT if dp [ i ] [ j ] [ k ] == 0 : NEW_LINE INDENT continue NEW_LINE DEDENT elif j == 1 : NEW_LINE INDENT dp [ i + 1 ] [ 1 ] [ k + 1 ] += dp [ i ] [ j ] [ k ] NEW_LINE dp [ i + 1 ] [ 1 ] [ k ] += dp [ i ] [ j ] [ k ] * 9 NEW_LINE DEDENT else : NEW_LINE INDENT if N [ i ] == '1' : NEW_LINE INDENT dp [ i + 1 ] [ 0 ] [ k + 1 ] += dp [ i ] [ j ] [ k ] NEW_LINE dp [ i + 1 ] [ 1 ] [ k ] += dp [ i ] [ j ] [ k ] NEW_LINE DEDENT elif N [ i ] == '0' : NEW_LINE INDENT dp [ i + 1 ] [ 0 ] [ k ] += dp [ i ] [ j ] [ k ] NEW_LINE DEDENT else : NEW_LINE INDENT dp [ i + 1 ] [ 0 ] [ k ] = dp [ i ] [ j ] [ k ] NEW_LINE dp [ i + 1 ] [ 1 ] [ k ] = dp [ i ] [ j ] [ k ] * ( int ( N [ i ] ) - 1 ) NEW_LINE dp [ i + 1 ] [ 1 ] [ k + 1 ] += dp [ i ] [ j ] [ k ] NEW_LINE DEDENT DEDENT DEDENT DEDENT DEDENT ans = 0 NEW_LINE for j in range ( 2 ) : NEW_LINE INDENT for k in range ( len ( N ) + 1 ) : NEW_LINE INDENT if dp [ len ( N ) ] [ j ] [ k ] : NEW_LINE INDENT ans += k * dp [ len ( N ) ] [ j ] [ k ] NEW_LINE DEDENT DEDENT DEDENT print ( ans ) NEW_LINE


n = input ( ) NEW_LINE memo = [ [ [ None for _ in range ( len ( n ) + 1 ) ] for _ in range ( 2 ) ] for _ in range ( len ( n ) + 1 ) ] NEW_LINE def rec ( i , threshold , s ) : NEW_LINE INDENT if i == len ( n ) : NEW_LINE INDENT return s NEW_LINE DEDENT if memo [ i ] [ threshold ] [ s ] is not None : NEW_LINE INDENT return memo [ i ] [ threshold ] [ s ] NEW_LINE DEDENT ret = 0 NEW_LINE limit = int ( n [ i ] ) if threshold == 1 else 9 NEW_LINE for j in range ( limit + 1 ) : NEW_LINE INDENT nex_threshold = 1 if ( j == limit and threshold == 1 ) else 0 NEW_LINE if j == 1 : NEW_LINE INDENT ret += rec ( i + 1 , nex_threshold , s + 1 ) NEW_LINE DEDENT else : NEW_LINE INDENT ret += rec ( i + 1 , nex_threshold , s ) NEW_LINE DEDENT memo [ i ] [ threshold ] [ s ] = ret NEW_LINE DEDENT return ret NEW_LINE DEDENT print ( rec ( 0 , 1 , 0 ) ) NEW_LINE


def dp_table ( * counts ) : NEW_LINE INDENT if counts : NEW_LINE INDENT return [ dp_table ( * counts [ 1 : ] ) for _ in range ( counts [ 0 ] ) ] NEW_LINE DEDENT else : NEW_LINE INDENT return None NEW_LINE DEDENT DEDENT def solve ( dp , N : str , index : int = 0 , tight : bool = True , amount_1 : int = 0 ) : NEW_LINE INDENT if len ( N ) == index : NEW_LINE INDENT return amount_1 NEW_LINE DEDENT elif dp [ index ] [ tight ] [ amount_1 ] is not None : NEW_LINE INDENT return dp [ index ] [ tight ] [ amount_1 ] NEW_LINE DEDENT else : NEW_LINE INDENT if tight : NEW_LINE INDENT for_max = int ( N [ index ] ) + 1 NEW_LINE DEDENT else : NEW_LINE INDENT for_max = 10 NEW_LINE DEDENT return_ = 0 NEW_LINE for i in range ( for_max ) : NEW_LINE INDENT return_ += solve ( dp , N , index + 1 , tight and i == int ( N [ index ] ) , amount_1 + 1 if i == 1 else amount_1 ) NEW_LINE DEDENT dp [ index ] [ tight ] [ amount_1 ] = return_ NEW_LINE return return_ NEW_LINE DEDENT DEDENT def main ( ) : NEW_LINE INDENT N = int ( input ( ) ) NEW_LINE digit_N = str ( N ) NEW_LINE dp = dp_table ( len ( digit_N ) + 1 , 2 , len ( digit_N ) + 1 ) NEW_LINE print ( solve ( dp , digit_N ) ) NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT main ( ) NEW_LINE 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 ) ; D1 solver = new D1 ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class D1 { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int n = in . nextInt ( ) ; int ans = 0 ; for ( int i = 1 ; i <= 100000000 ; i *= 10 ) { if ( n / i % 10 == 1 ) { ans += n % i + 1 ; } ans += ( n + 8 * i ) / ( 10 * i ) * i ; } out . println ( ans ) ; } } }


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 n = sc . nextInt ( ) ; out . println ( ans ( n , 0 ) ) ; } static int ans ( int n , int c ) { if ( c == 10 ) return 0 ; int temp = 0 ; if ( ( 1 + n ) % power ( 10 , c + 1 ) >= 2 * power ( 10 , c ) ) { temp = power ( 10 , c ) ; } else if ( ( 1 + n ) % power ( 10 , c + 1 ) > power ( 10 , c ) ) { temp = ( n + 1 ) % power ( 10 , c + 1 ) - power ( 10 , c ) ; } return ans ( n , c + 1 ) + power ( 10 , c ) * ( ( n + 1 ) / power ( 10 , c + 1 ) ) + temp ; } static int power ( int n , int m ) { if ( m == 0 ) return 1 ; if ( m % 2 == 1 ) return power ( n , m - 1 ) * n ; int e = power ( n , m / 2 ) ; return e * e ; } }


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long n = sc . nextInt ( ) ; long count = 0 ; for ( int i = 0 ; i < 11 ; i ++ ) { count += ( n / pow10 ( i + 1 ) ) * pow10 ( i ) ; long target = ( n % pow10 ( i + 1 ) ) / pow10 ( i ) ; if ( target > 1 ) { count += pow10 ( i ) ; } else if ( target == 1 ) { count += n % pow10 ( i ) + 1 ; } } System . out . println ( count ) ; } static long pow10 ( int n ) { if ( n == 0 ) { return 1 ; } else { return 10 * pow10 ( n - 1 ) ; } } }


import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i ++ ) a [ i ] = Integer . parseInt ( sc . next ( ) ) ; int c = 0 ; while ( true ) { Arrays . sort ( a ) ; if ( a [ 0 ] == a [ 1 ] && a [ 1 ] == a [ 2 ] ) break ; else if ( a [ 1 ] == a [ 2 ] ) a [ 0 ] += 2 ; else { a [ 0 ] ++ ; a [ 1 ] ++ ; } c ++ ; } System . out . println ( c ) ; } }

def inpl ( ) : return [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE C , B , A = sorted ( inpl ( ) ) NEW_LINE if ( B - C ) % 2 == 0 : NEW_LINE INDENT print ( ( 2 * A - B - C ) // 2 ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( ( 2 * A - B - C + 3 ) // 2 ) NEW_LINE DEDENT


A , B , C = sorted ( map ( int , input ( ) . split ( ) ) ) NEW_LINE ret = 0 NEW_LINE m = A % 2 + B % 2 + C % 2 NEW_LINE if m == 3 or m == 0 : NEW_LINE INDENT pass NEW_LINE DEDENT else : NEW_LINE INDENT ret += 1 NEW_LINE if m == 2 : NEW_LINE INDENT if A % 2 == 0 : NEW_LINE INDENT B += 1 NEW_LINE C += 1 NEW_LINE DEDENT elif B % 2 == 0 : NEW_LINE INDENT A += 1 NEW_LINE C += 1 NEW_LINE DEDENT else : NEW_LINE INDENT A += 1 NEW_LINE B += 1 NEW_LINE DEDENT DEDENT else : NEW_LINE INDENT if A % 2 == 1 : NEW_LINE INDENT B += 1 NEW_LINE C += 1 NEW_LINE DEDENT elif B % 2 == 1 : NEW_LINE INDENT A += 1 NEW_LINE C += 1 NEW_LINE DEDENT else : NEW_LINE INDENT A += 1 NEW_LINE B += 1 NEW_LINE DEDENT DEDENT DEDENT print ( ret + ( C - B ) // 2 + ( C - A ) // 2 ) NEW_LINE


a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE a = sorted ( a ) NEW_LINE c = a [ 0 ] % 2 + a [ 1 ] % 2 + a [ 2 ] % 2 NEW_LINE ans = 0 NEW_LINE if ( c == 0 or c == 3 ) : NEW_LINE INDENT ans += a [ 2 ] - a [ 0 ] + a [ 2 ] - a [ 1 ] NEW_LINE ans //= 2 NEW_LINE DEDENT else : NEW_LINE INDENT if ( c == 1 ) : NEW_LINE INDENT for i in range ( 3 ) : NEW_LINE INDENT if ( a [ i ] % 2 == 0 ) : NEW_LINE INDENT a [ i ] += 1 NEW_LINE DEDENT DEDENT DEDENT elif ( c == 2 ) : NEW_LINE INDENT for i in range ( 3 ) : NEW_LINE INDENT if ( a [ i ] % 2 != 0 ) : NEW_LINE INDENT a [ i ] += 1 NEW_LINE DEDENT DEDENT DEDENT ans += 1 NEW_LINE ans += ( a [ 2 ] - a [ 0 ] + a [ 2 ] - a [ 1 ] ) // 2 NEW_LINE DEDENT print ( ans ) NEW_LINE


import array NEW_LINE from bisect import * NEW_LINE from collections import * NEW_LINE import fractions NEW_LINE import heapq NEW_LINE from itertools import * NEW_LINE import math NEW_LINE import random NEW_LINE import re NEW_LINE import string NEW_LINE import sys NEW_LINE nums = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE nums . sort ( ) NEW_LINE ans = 0 NEW_LINE while nums [ 0 ] != nums [ - 1 ] : NEW_LINE INDENT if nums [ 0 ] < nums [ 1 ] : NEW_LINE INDENT nums [ 0 ] += 2 NEW_LINE DEDENT else : NEW_LINE INDENT nums [ 0 ] += 1 NEW_LINE nums [ 1 ] += 1 NEW_LINE DEDENT ans += 1 NEW_LINE nums . sort ( ) NEW_LINE DEDENT print ( ans ) NEW_LINE


X , Y , Z = sorted ( list ( map ( int , input ( ) . split ( ' ▁ ' ) ) ) ) NEW_LINE print ( ( Z - Y ) + ( Y - X ) // 2 + 2 * ( ( X - Y ) % 2 ) ) NEW_LINE


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 [ ] sl = r . readLine ( ) . split ( " [ \\ s ] + " ) ; int a = Integer . parseInt ( sl [ 0 ] ) ; int b = Integer . parseInt ( sl [ 1 ] ) ; int c = Integer . parseInt ( sl [ 2 ] ) ; if ( a > b ) { int t = a ; a = b ; b = t ; } if ( b > c ) { int t = b ; b = c ; c = t ; } if ( a > b ) { int t = a ; a = b ; b = t ; } if ( a == b && b == c ) { System . out . println ( 0 ) ; System . exit ( 0 ) ; } if ( b == c ) { if ( ( b - a ) % 2 == 0 ) { System . out . println ( ( b - a ) / 2 ) ; System . exit ( 0 ) ; } else { System . out . println ( ( b - a + 1 ) / 2 + 1 ) ; System . exit ( 0 ) ; } } if ( a == b ) { System . out . println ( c - a ) ; System . exit ( 0 ) ; } int v = 0 ; v += c - b ; a += c - b ; b += c - b ; if ( ( b - a ) % 2 == 0 ) { System . out . println ( v + ( b - a ) / 2 ) ; System . exit ( 0 ) ; } else { System . out . println ( v + ( b - a + 1 ) / 2 + 1 ) ; System . exit ( 0 ) ; } } }


import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { new Main ( ) . solveA ( ) ; } private void solveA ( ) { List < Integer > list = new ArrayList < > ( ) ; try ( Scanner sc = new Scanner ( System . in ) ; ) { list . add ( sc . nextInt ( ) ) ; list . add ( sc . nextInt ( ) ) ; list . add ( sc . nextInt ( ) ) ; } Collections . sort ( list ) ; int min = list . get ( 0 ) ; int middle = list . get ( 1 ) ; int max = list . get ( 2 ) ; int count = 0 ; while ( min != middle || middle != max ) { for ( int i = 0 ; i < 2 ; i ++ ) { min ++ ; if ( min > middle ) { int tmp = middle ; middle = min ; min = tmp ; } if ( min > max ) { int tmp = max ; max = min ; min = tmp ; } } count ++ ; } System . out . println ( count ) ; } }


import java . io . * ; import java . util . Arrays ; import java . util . StringTokenizer ; class Main { public static void main ( String [ ] args ) throws IOException { init ( System . in ) ; int [ ] abc = new int [ 3 ] ; for ( int i = 0 ; i < abc . length ; i ++ ) abc [ i ] = nextInt ( ) ; Arrays . sort ( abc ) ; int diff1 = abc [ 2 ] - abc [ 0 ] ; int diff2 = abc [ 2 ] - abc [ 1 ] ; if ( diff1 % 2 == 0 && diff2 % 2 == 0 ) System . out . println ( diff1 / 2 + diff2 / 2 ) ; else if ( diff1 % 2 == 1 && diff2 % 2 == 0 ) System . out . println ( 1 + diff2 / 2 + ( diff1 + 1 ) / 2 ) ; else if ( diff1 % 2 == 0 && diff2 % 2 == 1 ) System . out . println ( 1 + diff1 / 2 + ( diff2 + 1 ) / 2 ) ; else System . out . println ( 1 + ( diff1 - 1 ) / 2 + ( diff2 - 1 ) / 2 ) ; } private static BufferedReader reader ; private static StringTokenizer tokenizer ; private static void init ( InputStream inputStream ) { reader = new BufferedReader ( new InputStreamReader ( inputStream ) ) ; tokenizer = new StringTokenizer ( " " ) ; } private static String next ( ) throws IOException { String read ; while ( ! tokenizer . hasMoreTokens ( ) ) { read = reader . readLine ( ) ; if ( read == null || read . equals ( " " ) ) return " - 1" ; tokenizer = new StringTokenizer ( read ) ; } return tokenizer . nextToken ( ) ; } private static int nextInt ( ) throws IOException { return Integer . parseInt ( next ( ) ) ; } }


import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; String [ ] tokens = in . nextLine ( ) . split ( " ▁ " ) ; List < Integer > values = new ArrayList < > ( ) ; for ( String token : tokens ) { values . add ( Integer . parseInt ( token ) ) ; } Collections . sort ( values ) ; int result = 0 ; while ( true ) { int r = operation ( values ) ; if ( r == 0 ) { break ; } result += r ; Collections . sort ( values ) ; } System . out . println ( result ) ; in . close ( ) ; } public static int operation ( List < Integer > values ) { if ( values . get ( 0 ) == values . get ( 2 ) ) { return 0 ; } if ( values . get ( 0 ) == values . get ( 1 ) ) { int result = values . get ( 2 ) - values . get ( 1 ) ; values . set ( 0 , values . get ( 2 ) ) ; values . set ( 1 , values . get ( 2 ) ) ; return result ; } if ( ( values . get ( 1 ) - values . get ( 0 ) ) % 2 == 0 ) { int result = ( values . get ( 1 ) - values . get ( 0 ) ) / 2 ; values . set ( 0 , values . get ( 1 ) ) ; return result ; } else { int result = ( values . get ( 1 ) + 1 - values . get ( 0 ) ) / 2 ; values . set ( 0 , values . get ( 1 ) ) ; values . set ( 1 , values . get ( 1 ) + 1 ) ; return result ; } } }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int num = Integer . parseInt ( br . readLine ( ) ) ; int tenNum = num / 10 ; int remainder = num % 10 ; int answer = 0 ; if ( remainder * 15 > 100 ) { answer = ( tenNum + 1 ) * 100 ; } else { answer = tenNum * 100 + remainder * 15 ; } System . out . println ( answer ) ; } }


import sys NEW_LINE import copy NEW_LINE input = sys . stdin . readline NEW_LINE N = int ( input ( ) ) NEW_LINE ans = 1000000000000000 NEW_LINE for i in range ( 100 ) : NEW_LINE INDENT for j in range ( 100 ) : NEW_LINE INDENT money = i * 15 + j * 100 NEW_LINE tako = i + j * 10 NEW_LINE if tako >= N : NEW_LINE INDENT ans = min ( ans , money ) NEW_LINE DEDENT DEDENT DEDENT print ( ans ) NEW_LINE


n = int ( input ( ) ) NEW_LINE num = float ( ' inf ' ) NEW_LINE for i in range ( 100 ) : NEW_LINE INDENT num = min ( num , i * 100 + max ( 0 , ( n - i * 10 ) ) * 15 ) NEW_LINE DEDENT print ( num ) NEW_LINE


def main ( ) : NEW_LINE INDENT n = int ( input ( ) ) NEW_LINE print ( min ( ( n // 10 ) * 100 + ( n % 10 ) * 15 , ( ( n - 1 ) // 10 + 1 ) * 100 ) ) NEW_LINE DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT main ( ) NEW_LINE DEDENT


n = int ( input ( ) ) NEW_LINE ten = n // 10 NEW_LINE one = n % 10 NEW_LINE print ( min ( ( ten + 1 ) * 100 , ten * 100 + one * 15 ) ) NEW_LINE


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 n = sc . nextInt ( ) ; out . println ( n >= 10 ? min ( ( n / 10 ) * 100 + ( n % 10 ) * 15 , ( n / 10 + 1 ) * 100 ) : min ( n * 15 , 100 ) ) ; } }


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 n = in . nextInt ( ) ; out . println ( 100 * ( n / 10 ) + Math . min ( ( n % 10 ) * 15 , 100 ) ) ; } } 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 ( ) ; pl ( Math . min ( ( ( N / 10 ) * 100 + ( N % 10 ) * 15 ) , ( ( N + 9 ) / 10 ) * 100 ) ) ; } 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 . 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 N = in . nextInt ( ) ; int ans = 0 ; while ( N > 10 ) { N -= 10 ; ans += 100 ; } if ( N >= 7 ) { out . println ( ans + 100 ) ; } else { out . println ( ans + N * 15 ) ; } } } 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 . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int L = 2 * N - 1 ; int [ ] a = new int [ L ] ; for ( int i = 0 ; i < L ; i ++ ) a [ i ] = sc . nextInt ( ) ; int min = 1 ; int max = L ; boolean b [ ] = new boolean [ L ] ; while ( min + 1 < max ) { int mid = ( min + max ) / 2 ; for ( int i = 0 ; i < L ; i ++ ) b [ i ] = a [ i ] >= mid ; if ( satisfy ( b ) ) min = mid ; else max = mid ; } System . out . println ( min ) ; sc . close ( ) ; } static boolean satisfy ( boolean [ ] b ) { int L = b . length ; int N = ( L + 1 ) / 2 ; int l = N - 1 ; while ( l > 0 && b [ l ] != b [ l - 1 ] ) l -- ; int r = N - 1 ; while ( r < L - 1 && b [ r ] != b [ r + 1 ] ) r ++ ; if ( l > 0 ) { if ( r < L - 1 ) { if ( b [ l ] == b [ r ] ) return b [ l ] ; else return ( l + r ) / 2 >= N - 1 ? b [ l ] : b [ r ] ; } else { return b [ l ] ; } } else if ( r < L - 1 ) { return b [ r ] ; } else { return b [ N - 1 ] ^ N % 2 == 0 ; } } }

N = int ( input ( ) ) NEW_LINE a = [ 0 ] + list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE def check ( n ) : NEW_LINE INDENT b = [ False ] * ( len ( a ) ) NEW_LINE for i in range ( 1 , len ( a ) ) : NEW_LINE INDENT if a [ i ] >= n : NEW_LINE INDENT b [ i ] = True NEW_LINE DEDENT else : NEW_LINE INDENT b [ i ] = False NEW_LINE DEDENT DEDENT r = int ( 1e9 ) NEW_LINE l = int ( 1e9 ) NEW_LINE rb = b [ N ] NEW_LINE lb = b [ N ] NEW_LINE for i in range ( 1 , N ) : NEW_LINE INDENT if lb == b [ N - i ] : NEW_LINE INDENT l = i NEW_LINE break NEW_LINE DEDENT else : NEW_LINE INDENT lb = b [ N - i ] NEW_LINE DEDENT DEDENT for i in range ( 1 , N ) : NEW_LINE INDENT if rb == b [ N + i ] : NEW_LINE INDENT r = i NEW_LINE break NEW_LINE DEDENT else : NEW_LINE INDENT rb = b [ N + i ] NEW_LINE DEDENT DEDENT if r == int ( 1e9 ) and l == int ( 1e9 ) : NEW_LINE INDENT if N % 2 == 1 : NEW_LINE INDENT return b [ N ] NEW_LINE DEDENT else : NEW_LINE INDENT return not b [ N ] NEW_LINE DEDENT DEDENT else : NEW_LINE INDENT if r < l : NEW_LINE INDENT return rb NEW_LINE DEDENT else : NEW_LINE INDENT return lb NEW_LINE DEDENT DEDENT DEDENT def binarySearch ( small , big ) : NEW_LINE INDENT mid = ( big + small ) // 2 NEW_LINE if big - small <= 1 : NEW_LINE INDENT if check ( small ) : return small NEW_LINE else : return big NEW_LINE DEDENT else : NEW_LINE INDENT if not check ( mid ) : NEW_LINE INDENT return binarySearch ( small , mid ) NEW_LINE DEDENT else : NEW_LINE INDENT return binarySearch ( mid , big ) NEW_LINE DEDENT DEDENT DEDENT print ( binarySearch ( 2 , 2 * N - 2 ) ) NEW_LINE


import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] [ ] A = new int [ N ] [ N ] ; long sum = 0 ; for ( int i = 0 ; i < N ; i ++ ) for ( int j = 0 ; j < N ; j ++ ) { A [ i ] [ j ] = sc . nextInt ( ) ; sum += A [ i ] [ j ] ; } sum /= 2 ; for ( int i = 0 ; i < N ; i ++ ) { for ( int j = i + 1 ; j < N ; j ++ ) { for ( int k = 0 ; k < N ; k ++ ) { if ( i == k || j == k ) continue ; if ( A [ i ] [ j ] > A [ i ] [ k ] + A [ k ] [ j ] ) { System . out . println ( - 1 ) ; return ; } if ( A [ i ] [ j ] == A [ i ] [ k ] + A [ k ] [ j ] ) { sum -= A [ i ] [ j ] ; break ; } } } } System . out . println ( sum ) ; } }

def inpl ( ) : return [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE import sys NEW_LINE import numpy NEW_LINE N = int ( input ( ) ) NEW_LINE A = numpy . asarray ( [ inpl ( ) for _ in range ( N ) ] ) NEW_LINE ans = 0 NEW_LINE for i in range ( N ) : NEW_LINE INDENT A [ i ] [ i ] = 10 ** 9 + 1 NEW_LINE DEDENT for i in range ( N ) : NEW_LINE INDENT for j in range ( i ) : NEW_LINE INDENT mindis = numpy . min ( [ A [ i ] + A [ j ] ] ) NEW_LINE if mindis > A [ i ] [ j ] : NEW_LINE INDENT ans += A [ i ] [ j ] NEW_LINE continue NEW_LINE DEDENT if mindis < A [ i ] [ j ] : NEW_LINE INDENT print ( - 1 ) NEW_LINE sys . exit ( ) NEW_LINE DEDENT DEDENT DEDENT print ( ans ) NEW_LINE


import numpy as np NEW_LINE import scipy . sparse . csgraph as csg NEW_LINE if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT N = int ( input ( ) ) NEW_LINE A = [ list ( map ( int , input ( ) . split ( ) ) ) for i in range ( N ) ] NEW_LINE G = np . asarray ( A , dtype = np . uint32 ) NEW_LINE G2 = csg . floyd_warshall ( G , directed = False ) NEW_LINE if np . any ( G != G2 ) : NEW_LINE INDENT print ( - 1 ) NEW_LINE exit ( ) NEW_LINE DEDENT ans = 0 NEW_LINE G [ G == 0 ] = 1 NEW_LINE for i in range ( N ) : NEW_LINE INDENT for j in range ( i + 1 , N ) : NEW_LINE INDENT n = np . min ( G [ i ] + G [ j ] ) NEW_LINE if n > G [ i , j ] : NEW_LINE INDENT ans += G [ i , j ] NEW_LINE DEDENT DEDENT DEDENT print ( ans ) NEW_LINE DEDENT


def solve ( n , tbl ) : NEW_LINE INDENT ans = 0 NEW_LINE for i , row_i in enumerate ( tbl ) : NEW_LINE INDENT for j in range ( i + 1 , n ) : NEW_LINE INDENT row_j = tbl [ j ] NEW_LINE ij = row_i [ j ] NEW_LINE mind = min ( ( ik + kj for ik , kj in zip ( row_i , row_j ) if ik and kj ) , default = float ( ' inf ' ) ) NEW_LINE if ij > mind : NEW_LINE INDENT return - 1 NEW_LINE DEDENT if ij < mind : NEW_LINE INDENT ans += ij NEW_LINE DEDENT DEDENT DEDENT return ans NEW_LINE DEDENT n = int ( input ( ) ) NEW_LINE tbl = [ list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( n ) ] NEW_LINE print ( solve ( n , tbl ) ) NEW_LINE


N = int ( input ( ) ) NEW_LINE inf = float ( " inf " ) NEW_LINE A = [ list ( map ( int , input ( ) . split ( ) ) ) for _ in [ 0 ] * N ] NEW_LINE for i in range ( N ) : NEW_LINE INDENT A [ i ] [ i ] = inf NEW_LINE DEDENT result = 0 NEW_LINE for i in range ( N - 1 ) : NEW_LINE INDENT for j , dist in enumerate ( A [ i ] [ i + 1 : ] , start = i + 1 ) : NEW_LINE INDENT for _A in A : NEW_LINE INDENT if dist >= _A [ i ] + _A [ j ] : NEW_LINE INDENT if dist > _A [ i ] + _A [ j ] : NEW_LINE INDENT print ( - 1 ) NEW_LINE exit ( ) NEW_LINE DEDENT break NEW_LINE DEDENT DEDENT else : NEW_LINE INDENT result += dist NEW_LINE DEDENT DEDENT DEDENT print ( result ) NEW_LINE


import numpy as np NEW_LINE N = int ( input ( ) ) NEW_LINE dist = [ [ 0.0 for _ in range ( N ) ] for _ in range ( N ) ] NEW_LINE for i in range ( N ) : NEW_LINE INDENT for j , x in enumerate ( map ( int , input ( ) . split ( ) ) ) : NEW_LINE INDENT dist [ i ] [ j ] = float ( x ) NEW_LINE DEDENT DEDENT dist = np . array ( dist ) NEW_LINE for i in range ( N ) : NEW_LINE INDENT dist [ i , i ] = float ( ' inf ' ) NEW_LINE DEDENT ans = 0 NEW_LINE for i in range ( N ) : NEW_LINE INDENT for j in range ( i + 1 , N ) : NEW_LINE INDENT min_ = min ( dist [ i ] + dist [ j ] ) NEW_LINE if min_ < dist [ i , j ] : NEW_LINE INDENT ans = - 1 NEW_LINE break NEW_LINE DEDENT elif min_ > dist [ i , j ] : NEW_LINE INDENT ans += dist [ i , j ] NEW_LINE DEDENT DEDENT if ans < 0 : NEW_LINE INDENT break NEW_LINE DEDENT DEDENT print ( int ( ans ) ) NEW_LINE


import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; long [ ] [ ] dist = new long [ n + 1 ] [ n + 1 ] ; for ( int i = 1 ; i <= n ; ++ i ) { for ( int j = 1 ; j <= n ; ++ j ) { long a = scanner . nextInt ( ) ; dist [ i ] [ j ] = a ; } } long totalLength = 0 ; for ( int i = 1 ; i <= n ; ++ i ) { for ( int j = i + 1 ; j <= n ; ++ j ) { boolean isNecessary = true ; for ( int k = 1 ; k <= n ; ++ k ) { if ( i == k || j == k ) { continue ; } if ( dist [ i ] [ k ] + dist [ k ] [ j ] < dist [ i ] [ j ] ) { System . out . println ( - 1 ) ; return ; } else if ( dist [ i ] [ k ] + dist [ k ] [ j ] == dist [ i ] [ j ] ) { isNecessary = false ; break ; } } if ( isNecessary ) { totalLength += dist [ i ] [ j ] ; } } } System . out . println ( totalLength ) ; } }


import java . util . * ; import java . util . stream . Stream ; public class Main { private static int N ; private static int A [ ] [ ] ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; N = sc . nextInt ( ) ; A = new int [ N ] [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { for ( int j = 0 ; j < N ; j ++ ) { A [ i ] [ j ] = sc . nextInt ( ) ; } } System . out . println ( solve ( ) ) ; } static long solve ( ) { boolean [ ] [ ] indirect = new boolean [ N ] [ N ] ; for ( int i = 0 ; i < N - 1 ; i ++ ) { for ( int j = i + 1 ; j < N ; j ++ ) { for ( int k = 0 ; k < N ; k ++ ) { if ( k == i || k == j ) continue ; int ikj = A [ i ] [ k ] + A [ k ] [ j ] ; int ij = A [ i ] [ j ] ; if ( ikj < ij ) { return - 1 ; } else if ( ikj == ij ) { indirect [ i ] [ j ] = true ; } } } } long ans = 0 ; for ( int i = 0 ; i < N - 1 ; i ++ ) { for ( int j = i + 1 ; j < N ; j ++ ) { if ( ! indirect [ i ] [ j ] ) { ans += A [ i ] [ j ] ; } } } return ans ; } }


import java . util . Scanner ; public class Main { static int n ; static int [ ] [ ] dist ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; n = sc . nextInt ( ) ; dist = new int [ n ] [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { dist [ i ] [ j ] = sc . nextInt ( ) ; } } long sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = i + 1 ; j < n ; j ++ ) { sum += ( long ) dist [ i ] [ j ] ; } } boolean [ ] [ ] subtracted = new boolean [ n ] [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = i + 1 ; j < n ; j ++ ) { for ( int k = 0 ; k < n ; k ++ ) { if ( k == i || k == j ) { continue ; } if ( dist [ i ] [ j ] > dist [ i ] [ k ] + dist [ k ] [ j ] ) { System . out . println ( - 1 ) ; return ; } if ( ! subtracted [ i ] [ j ] && dist [ i ] [ j ] == dist [ i ] [ k ] + dist [ k ] [ j ] ) { sum -= ( long ) dist [ i ] [ j ] ; subtracted [ i ] [ j ] = true ; } } } } System . out . println ( sum ) ; } }


import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; long [ ] [ ] A = new long [ N ] [ N ] ; long [ ] [ ] D = new long [ N ] [ N ] ; Boolean nes [ ] [ ] = new Boolean [ N ] [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { for ( int j = 0 ; j < N ; j ++ ) { A [ i ] [ j ] = sc . nextLong ( ) ; if ( A [ i ] [ j ] == 0 && i != j ) { A [ i ] [ j ] = ( long ) 10e12 ; } D [ i ] [ j ] = A [ i ] [ j ] ; nes [ i ] [ j ] = true ; } } for ( int i = 0 ; i < N ; i ++ ) { for ( int j = 0 ; j < N ; j ++ ) { for ( int k = 0 ; k < N ; k ++ ) { if ( j != i && k != i && D [ j ] [ k ] == D [ j ] [ i ] + D [ i ] [ k ] ) { nes [ j ] [ k ] = false ; } D [ j ] [ k ] = Math . min ( D [ j ] [ k ] , D [ j ] [ i ] + D [ i ] [ k ] ) ; } } } long ans = 0 ; for ( int i = 0 ; i < N ; i ++ ) { for ( int j = i + 1 ; j < N ; j ++ ) { if ( A [ i ] [ j ] != D [ i ] [ j ] ) { System . out . println ( - 1 ) ; return ; } if ( nes [ i ] [ j ] ) { ans += D [ i ] [ j ] ; } } } System . out . println ( ans ) ; } }


import java . util . Collections ; import java . util . HashMap ; import java . util . HashSet ; import java . util . Map ; import java . util . Scanner ; import java . util . Set ; import java . util . TreeMap ; import java . util . Map . Entry ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ; ) { new Main ( ) . solve ( sc ) ; } } void solve ( Scanner sc ) { int n = sc . nextInt ( ) ; Map < Integer , Integer > aMap = new TreeMap < > ( ( x , y ) -> y - x ) ; for ( int i = 0 ; i < n ; i ++ ) { int a = sc . nextInt ( ) ; Integer count = aMap . getOrDefault ( a , 0 ) + 1 ; aMap . put ( a , count ) ; } long x = 0 ; for ( Entry < Integer , Integer > e : aMap . entrySet ( ) ) { if ( e . getValue ( ) >= 4 && x == 0 ) { System . out . println ( ( long ) e . getKey ( ) * e . getKey ( ) ) ; return ; } if ( e . getValue ( ) >= 2 && x == 0 ) { x = e . getKey ( ) ; continue ; } if ( e . getValue ( ) >= 2 ) { System . out . println ( x * e . getKey ( ) ) ; return ; } } System . out . println ( 0 ) ; } }

import sys NEW_LINE import collections NEW_LINE ns = lambda : sys . stdin . readline ( ) . rstrip ( ) NEW_LINE ni = lambda : int ( ns ( ) ) NEW_LINE nm = lambda : map ( int , sys . stdin . readline ( ) . split ( ) ) NEW_LINE nl = lambda : list ( nm ( ) ) NEW_LINE nsl = lambda : map ( str , sys . stdin . readline ( ) . split ( ) ) NEW_LINE n = ni ( ) NEW_LINE a = nl ( ) NEW_LINE c = collections . Counter ( a ) NEW_LINE key = list ( c . keys ( ) ) NEW_LINE key . sort ( reverse = True ) NEW_LINE count = 0 NEW_LINE for i in range ( len ( key ) ) : NEW_LINE INDENT if c [ key [ i ] ] >= 4 and count != 1 : NEW_LINE INDENT print ( key [ i ] ** 2 ) NEW_LINE exit ( ) NEW_LINE DEDENT if c [ key [ i ] ] >= 2 : NEW_LINE INDENT if count == 0 : NEW_LINE INDENT a = key [ i ] NEW_LINE count += 1 NEW_LINE DEDENT elif count == 1 : NEW_LINE INDENT b = key [ i ] NEW_LINE count += 1 NEW_LINE DEDENT DEDENT if count >= 2 : NEW_LINE INDENT print ( a * b ) NEW_LINE exit ( ) NEW_LINE DEDENT DEDENT print ( 0 ) NEW_LINE


N = int ( input ( ) ) NEW_LINE A = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE dic = { } NEW_LINE max1 , max2 = 0 , 0 NEW_LINE count = 0 NEW_LINE for i in range ( N ) : NEW_LINE INDENT if ( A [ i ] in dic ) : NEW_LINE INDENT dic [ A [ i ] ] += 1 NEW_LINE if ( dic [ A [ i ] ] % 2 == 0 ) : NEW_LINE INDENT count += 1 NEW_LINE if ( max1 < A [ i ] ) : NEW_LINE INDENT max2 = max1 NEW_LINE max1 = A [ i ] NEW_LINE DEDENT if ( A [ i ] < max1 ) : NEW_LINE INDENT max2 = max ( max2 , A [ i ] ) NEW_LINE DEDENT DEDENT DEDENT else : NEW_LINE INDENT dic [ A [ i ] ] = 1 NEW_LINE DEDENT DEDENT ans = 0 NEW_LINE if ( count >= 2 ) : NEW_LINE INDENT if ( dic [ max1 ] >= 4 ) : NEW_LINE INDENT ans = max1 * max1 NEW_LINE DEDENT else : NEW_LINE INDENT ans = max1 * max2 NEW_LINE DEDENT DEDENT print ( ans ) NEW_LINE


N = int ( input ( ) ) NEW_LINE A = [ int ( a ) for a in input ( ) . split ( ) ] NEW_LINE d = { } NEW_LINE for a in A : NEW_LINE INDENT d [ a ] = d . get ( a , 0 ) + 1 NEW_LINE DEDENT B = [ 0 , 0 ] NEW_LINE for k in d : NEW_LINE INDENT if d [ k ] >= 4 : NEW_LINE INDENT B . append ( k ) NEW_LINE B . append ( k ) NEW_LINE DEDENT elif d [ k ] >= 2 : NEW_LINE INDENT B . append ( k ) NEW_LINE DEDENT DEDENT B . sort ( ) NEW_LINE print ( B [ - 1 ] * B [ - 2 ] ) NEW_LINE


import array NEW_LINE from bisect import * NEW_LINE from collections import * NEW_LINE import fractions NEW_LINE import heapq NEW_LINE from itertools import * NEW_LINE import math NEW_LINE import random NEW_LINE import re NEW_LINE import string NEW_LINE import sys NEW_LINE N = int ( input ( ) ) NEW_LINE As = map ( int , input ( ) . split ( ) ) NEW_LINE c = Counter ( As ) NEW_LINE ans = [ ] NEW_LINE for k in reversed ( sorted ( c . keys ( ) ) ) : NEW_LINE INDENT v = c [ k ] NEW_LINE while v >= 2 : NEW_LINE INDENT ans . append ( k ) NEW_LINE v -= 2 NEW_LINE if len ( ans ) == 2 : NEW_LINE INDENT print ( ans [ 0 ] * ans [ 1 ] ) NEW_LINE sys . exit ( 0 ) NEW_LINE DEDENT DEDENT DEDENT print ( 0 ) NEW_LINE


from collections import Counter NEW_LINE import sys NEW_LINE h = w = index = 0 NEW_LINE n = int ( input ( ) ) NEW_LINE a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE l = Counter ( a ) NEW_LINE l2 = sorted ( l . items ( ) , reverse = True ) NEW_LINE for i in range ( len ( l2 ) ) : NEW_LINE INDENT if l2 [ i ] [ 1 ] >= 2 : NEW_LINE INDENT if l2 [ i ] [ 1 ] >= 4 : NEW_LINE INDENT print ( l2 [ i ] [ 0 ] ** 2 ) NEW_LINE sys . exit ( ) NEW_LINE DEDENT w = l2 [ i ] [ 0 ] NEW_LINE index = i NEW_LINE break NEW_LINE DEDENT DEDENT for i in range ( index + 1 , len ( l2 ) ) : NEW_LINE INDENT if l2 [ i ] [ 1 ] >= 2 : NEW_LINE INDENT h = l2 [ i ] [ 0 ] NEW_LINE break NEW_LINE DEDENT DEDENT print ( h * w ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ; public class Main { int n ; public static void main ( String args [ ] ) { new Main ( ) . run ( ) ; } void run ( ) { FastReader sc = new FastReader ( ) ; n = sc . nextInt ( ) ; SortedMap < Integer , Integer > counts = new TreeMap < > ( Collections . reverseOrder ( ) ) ; for ( int i = 0 ; i < n ; i ++ ) { int a = sc . nextInt ( ) ; if ( ! counts . containsKey ( a ) ) { counts . put ( a , 1 ) ; } else { counts . put ( a , counts . get ( a ) + 1 ) ; } } int first = 0 ; int second = 0 ; for ( Map . Entry < Integer , Integer > entry : counts . entrySet ( ) ) { int value = entry . getValue ( ) ; if ( value >= 4 ) { if ( first == 0 ) { first = entry . getKey ( ) ; } second = entry . getKey ( ) ; break ; } else if ( value >= 2 ) { if ( first == 0 ) { first = entry . getKey ( ) ; } else { second = entry . getKey ( ) ; break ; } } } System . out . println ( ( long ) first * second ) ; } static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } }


import java . util . * ; import java . lang . * ; class Pair implements Comparable < Pair > { long a ; int cnt ; public Pair ( long i , int j ) { this . a = i ; this . cnt = j ; } public int compareTo ( Pair p ) { if ( this . cnt >= 2 && p . cnt >= 2 && this . a < p . a ) return - 1 ; if ( this . cnt < 2 && p . cnt >= 2 ) 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 < Long , Pair > map = new HashMap < > ( ) ; ArrayList < Pair > l = new ArrayList < > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { long c = Long . parseLong ( sc . next ( ) ) ; 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 ) ; int size = l . size ( ) ; Pair p1 = l . get ( size - 1 ) ; Pair p2 = l . get ( size - 2 ) ; long res = 0 ; if ( p1 . cnt >= 4 ) res = p1 . a * p1 . a ; else if ( p1 . cnt >= 2 && p2 . cnt >= 2 ) res = p1 . a * p2 . a ; System . out . println ( res ) ; } }


import java . util . * ; import java . awt . * ; import java . awt . geom . * ; import static java . lang . System . * ; import static java . lang . Math . * ; public class Main { public static void main ( String [ ] $ ) { Scanner sc = new Scanner ( in ) ; int n = sc . nextInt ( ) ; long [ ] a = new long [ n ] ; long edge1 = 0 , edge2 = 0 ; TreeMap < Long , Long > tm = new TreeMap < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextLong ( ) ; tm . put ( a [ i ] , tm . getOrDefault ( a [ i ] , 0l ) + 1 ) ; } while ( tm . size ( ) > 0 && edge1 == 0 ) { Map . Entry < Long , Long > temp = tm . pollLastEntry ( ) ; if ( temp . getValue ( ) > 1 ) { edge1 = temp . getKey ( ) ; tm . put ( temp . getKey ( ) , temp . getValue ( ) - 2 ) ; } } while ( tm . size ( ) > 0 && edge2 == 0 ) { Map . Entry < Long , Long > temp = tm . pollLastEntry ( ) ; if ( temp . getValue ( ) > 1 ) { edge2 = temp . getKey ( ) ; } } out . println ( edge1 * edge2 ) ; } }


import java . util . ArrayList ; import java . util . HashMap ; import java . util . HashSet ; import java . util . List ; import java . util . Map ; import java . util . Scanner ; import java . util . Set ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( sc . hasNextInt ( ) ) { int N = sc . nextInt ( ) ; Map < Long , Integer > cnt = new HashMap < > ( ) ; Set < Long > set = new HashSet < > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { long x = sc . nextLong ( ) ; int nowCnt = cnt . getOrDefault ( x , 0 ) ; nowCnt ++ ; cnt . put ( x , nowCnt ) ; set . add ( x ) ; } List < Long > sortList = new ArrayList < > ( set ) ; sortList . sort ( Long :: compareTo ) ; long ans = 0 ; List < Long > hen = new ArrayList < > ( ) ; for ( int i = sortList . size ( ) - 1 ; hen . size ( ) < 2 && i >= 0 ; i -- ) { long len = sortList . get ( i ) ; if ( cnt . get ( len ) >= 2 ) { hen . add ( len ) ; } if ( cnt . get ( len ) >= 4 ) { hen . add ( len ) ; } } if ( hen . size ( ) >= 2 ) { ans = hen . get ( 0 ) * hen . get ( 1 ) ; } System . out . println ( ans ) ; } } }


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String s = sc . next ( ) ; int r = 0 ; int g = 0 ; int b = 0 ; for ( char c : s . toCharArray ( ) ) { switch ( c ) { case ' R ' : r ++ ; break ; case ' G ' : g ++ ; break ; case ' B ' : b ++ ; break ; } } System . out . println ( r % 2 + g % 2 + b % 2 ) ; } }

print ( ( lambda n , l : sum ( [ l . count ( c ) % 2 for c in [ ' R ' , ' G ' , ' B ' ] ] ) ) ( input ( ) , input ( ) ) ) NEW_LINE


N = int ( input ( ) ) NEW_LINE S = input ( ) NEW_LINE slot = ' ' NEW_LINE for idx in range ( 0 , len ( S ) , 1 ) : NEW_LINE INDENT if len ( slot ) == 0 : NEW_LINE INDENT slot = S [ idx ] NEW_LINE DEDENT elif len ( slot ) == 1 : NEW_LINE INDENT slot = slot + S [ idx ] NEW_LINE if slot [ 0 ] == slot [ 1 ] : NEW_LINE INDENT slot = ' ' NEW_LINE DEDENT DEDENT else : NEW_LINE INDENT if S [ idx ] == slot [ 0 ] : NEW_LINE INDENT slot = slot [ 1 : len ( slot ) ] NEW_LINE DEDENT elif S [ idx ] == slot [ - 1 ] : NEW_LINE INDENT slot = slot [ 0 : len ( slot ) - 1 ] NEW_LINE DEDENT else : NEW_LINE INDENT if idx == len ( S ) - 1 : NEW_LINE INDENT slot = slot + S [ idx ] NEW_LINE DEDENT else : NEW_LINE INDENT if S [ idx + 1 ] == slot [ 0 ] : NEW_LINE INDENT slot = slot + S [ idx ] NEW_LINE DEDENT else : NEW_LINE INDENT slot = S [ idx ] + slot NEW_LINE DEDENT DEDENT DEDENT DEDENT DEDENT print ( len ( slot ) ) NEW_LINE


import sys NEW_LINE from collections import defaultdict , Counter NEW_LINE from itertools import product , groupby , count , permutations , combinations NEW_LINE from math import pi , sqrt , ceil , floor NEW_LINE from collections import deque NEW_LINE from bisect import bisect , bisect_left , bisect_right NEW_LINE from string import ascii_lowercase NEW_LINE INF = float ( " inf " ) NEW_LINE sys . setrecursionlimit ( 10 ** 7 ) NEW_LINE dy = [ 0 , - 1 , 0 , 1 ] NEW_LINE dx = [ 1 , 0 , - 1 , 0 ] NEW_LINE def inside ( y : int , x : int , H : int , W : int ) -> bool : return 0 <= y < H and 0 <= x < W NEW_LINE def main ( ) : NEW_LINE INDENT global S NEW_LINE N = input ( ) NEW_LINE S = input ( ) NEW_LINE r , g , b = S . count ( " R " ) , S . count ( " G " ) , S . count ( " B " ) NEW_LINE print ( r % 2 + g % 2 + b % 2 ) NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT main ( ) NEW_LINE DEDENT


N = int ( input ( ) ) NEW_LINE S = input ( ) NEW_LINE beam_width = 3 * 10 ** 4 NEW_LINE next_set = { " " } NEW_LINE for c in S : NEW_LINE INDENT a = sorted ( next_set , key = len ) [ : beam_width ] NEW_LINE next_set = set ( ) NEW_LINE add = next_set . add NEW_LINE if a [ 0 ] == " " : NEW_LINE INDENT add ( c ) NEW_LINE a = a [ 1 : ] NEW_LINE DEDENT for s in a : NEW_LINE INDENT add ( c + s if c != s [ 0 ] else s [ 1 : ] ) NEW_LINE add ( s + c if c != s [ - 1 ] else s [ : - 1 ] ) NEW_LINE DEDENT DEDENT ss = sorted ( next_set , key = len ) NEW_LINE print ( len ( ss [ 0 ] ) ) NEW_LINE


from collections import Counter NEW_LINE N = int ( input ( ) ) NEW_LINE S = input ( ) NEW_LINE counter = Counter ( S ) NEW_LINE ans = 0 NEW_LINE ans += counter [ ' R ' ] % 2 NEW_LINE ans += counter [ ' G ' ] % 2 NEW_LINE ans += counter [ ' B ' ] % 2 NEW_LINE print ( ans ) NEW_LINE


import java . util . * ; import java . util . stream . Collectors ; public class Main { enum Color { R ( " R " ) , B ( " B " ) , G ( " G " ) ; public String name ; private Color ( String string ) { this . name = string ; } public static Color toEnum ( String string ) { if ( string . equals ( R . name ) ) { return R ; } else if ( string . equals ( B . name ) ) { return B ; } else { return G ; } } } public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; final int N = scanner . nextInt ( ) ; final String S = scanner . next ( ) ; Deque < Color > deque = new ArrayDeque < > ( ) ; String [ ] strings = S . split ( " " ) ; for ( int i = 0 ; i < N ; i ++ ) { Color ball = Color . toEnum ( strings [ i ] ) ; if ( deque . size ( ) == 0 ) { deque . addLast ( ball ) ; continue ; } if ( deque . size ( ) == 1 ) { Color ball1 = deque . getFirst ( ) ; if ( ball1 == ball ) { deque . removeFirst ( ) ; } else { deque . addLast ( ball ) ; } continue ; } Color ball1 = deque . getFirst ( ) ; Color ball2 = deque . getLast ( ) ; if ( ball == ball1 ) { deque . removeFirst ( ) ; continue ; } if ( ball == ball2 ) { deque . removeLast ( ) ; continue ; } if ( i == N - 1 ) { deque . addLast ( ball ) ; continue ; } Color nextBall = Color . toEnum ( strings [ i + 1 ] ) ; if ( ball == nextBall ) { deque . addLast ( ball ) ; continue ; } if ( ball1 == nextBall ) { deque . addLast ( ball ) ; } else if ( ball2 == nextBall ) { deque . addFirst ( ball ) ; } } System . out . println ( deque . size ( ) ) ; } }


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; char s [ ] = sc . next ( ) . toCharArray ( ) ; int [ ] num = new int [ 3 ] ; for ( int i = 0 ; i < N ; i ++ ) { switch ( s [ i ] ) { case ' R ' : num [ 0 ] ++ ; break ; case ' G ' : num [ 1 ] ++ ; break ; case ' B ' : num [ 2 ] ++ ; break ; } } int ans = 0 ; for ( int i = 0 ; i < 3 ; i ++ ) { ans += num [ i ] % 2 ; } System . out . println ( ans ) ; } }


import java . util . Scanner ; 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 ( ) ; sc . close ( ) ; if ( a == b ) { System . out . println ( " Draw " ) ; } else if ( a == 1 ) { System . out . println ( " Alice " ) ; } else if ( b == 1 ) { System . out . println ( " Bob " ) ; } else if ( a > b ) { System . out . println ( " Alice " ) ; } else { System . out . println ( " Bob " ) ; } } }

a , b = map ( int , input ( ) . split ( ) ) NEW_LINE if a == b : print ( " Draw " ) NEW_LINE elif a == 1 : print ( " Alice " ) NEW_LINE elif b == 1 : print ( " Bob " ) NEW_LINE elif a > b : print ( " Alice " ) NEW_LINE else : print ( " Bob " ) NEW_LINE


from functools import reduce NEW_LINE import math NEW_LINE def main ( ) : NEW_LINE INDENT a , b = ( int ( _ ) for _ in input ( ) . split ( ) ) NEW_LINE if a == 1 : NEW_LINE INDENT a = 14 NEW_LINE DEDENT if b == 1 : NEW_LINE INDENT b = 14 NEW_LINE DEDENT if a > b : NEW_LINE INDENT ans = ' Alice ' NEW_LINE DEDENT elif a == b : NEW_LINE INDENT ans = ' Draw ' NEW_LINE DEDENT else : NEW_LINE INDENT ans = ' Bob ' NEW_LINE DEDENT print ( ans ) NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT main ( ) NEW_LINE DEDENT


A , B = map ( int , input ( ) . split ( ) ) NEW_LINE a = ( A - 2 ) % 13 NEW_LINE b = ( B - 2 ) % 13 NEW_LINE print ( ' Alice ' if a > b else ' Bob ' if a < b else ' Draw ' ) NEW_LINE


A , B = map ( int , input ( ) . split ( ) ) NEW_LINE cards = [ num for num in range ( 2 , 14 ) ] NEW_LINE cards . append ( 1 ) NEW_LINE for i in reversed ( cards ) : NEW_LINE INDENT if i == A and i == B : NEW_LINE INDENT print ( " Draw " ) NEW_LINE DEDENT elif i == A and i != B : NEW_LINE INDENT print ( " Alice " ) NEW_LINE break NEW_LINE DEDENT elif i == B and i != A : NEW_LINE INDENT print ( " Bob " ) NEW_LINE break NEW_LINE DEDENT DEDENT


a , b = ( ( int ( x ) - 2 ) % 100 for x in input ( ) . split ( ) ) NEW_LINE print ( ' Draw ' if a == b else ' Alice ' if a > b else ' Bob ' ) NEW_LINE


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 B = in . nextInt ( ) ; if ( A == B ) { out . println ( " Draw " ) ; } else if ( ( A > B || A == 1 ) && B != 1 ) { out . println ( " Alice " ) ; } else { out . println ( " Bob " ) ; } } } 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 char nextChar ( ) { return next ( ) . charAt ( 0 ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } public double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } } }


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 ( ) ; if ( A == 1 ) { A = 14 ; } if ( B == 1 ) { B = 14 ; } if ( A == B ) { System . out . println ( " Draw " ) ; } else if ( A > B ) { System . out . println ( " Alice " ) ; } else { System . out . println ( " Bob " ) ; } } }


import java . util . Scanner ; public class Main { private static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int a = sc . nextInt ( ) , b = sc . nextInt ( ) ; if ( a == b ) { System . out . println ( " Draw " ) ; return ; } if ( a == 1 ) { a += 13 ; } if ( b == 1 ) { b += 13 ; } System . out . println ( a > b ? " Alice " : " Bob " ) ; } }


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 == 1 ) A = 14 ; if ( B == 1 ) B = 14 ; String ans ; if ( A > B ) { ans = " Alice " ; } else if ( A < B ) { ans = " Bob " ; } else { ans = " Draw " ; } System . out . print ( ans ) ; } }


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

N , A , B = map ( int , input ( ) . split ( ) ) NEW_LINE print ( ( N - 5 ) * A + 5 * B if N > 5 else N * B ) NEW_LINE


def main ( ) : NEW_LINE INDENT n , a , b = map ( int , input ( ) . split ( ) ) NEW_LINE if n <= 5 : NEW_LINE INDENT print ( n * b ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( 5 * b + ( n - 5 ) * a ) NEW_LINE DEDENT DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT main ( ) NEW_LINE DEDENT


import sys NEW_LINE sys . setrecursionlimit ( 10 ** 9 ) NEW_LINE input = sys . stdin . readline NEW_LINE N , A , B = map ( int , input ( ) . split ( ) ) NEW_LINE print ( max ( 0 , ( N - 5 ) ) * A + B * min ( 5 , N ) ) NEW_LINE


def main ( ) : NEW_LINE INDENT n , a , b = map ( int , input ( ) . split ( ) ) NEW_LINE nb = min ( n , 5 ) NEW_LINE na = n - nb NEW_LINE r = b * nb + a * na NEW_LINE print ( r ) NEW_LINE DEDENT main ( ) NEW_LINE


N , A , B = map ( int , input ( ) . split ( " ▁ " ) ) NEW_LINE c = 0 NEW_LINE ans = 0 NEW_LINE for i in range ( N ) : NEW_LINE INDENT if c < 5 : NEW_LINE INDENT ans += B NEW_LINE c += 1 NEW_LINE DEDENT else : NEW_LINE INDENT ans += A NEW_LINE DEDENT 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 ) ; Task solver = new Task ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class Task { public void solve ( int testNumber , FastScanner in , PrintWriter out ) { int n = in . nextInt ( ) ; int d = Math . min ( 5 , n ) ; int a = in . nextInt ( ) ; int b = in . nextInt ( ) ; out . println ( d * b + ( n - d ) * a ) ; } } 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 ( ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; if ( N <= 5 ) { pl ( B * N ) ; } else if ( N > 5 ) { pl ( ( B * 5 + ( N - 5 ) * A ) ) ; } } 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 ; class Main { static int min ( int a , int b ) { if ( a > b ) return b ; else return a ; } static void solve ( ) { int n , sc , di ; Scanner cin = new Scanner ( System . in ) ; n = cin . nextInt ( ) ; sc = cin . nextInt ( ) ; di = cin . nextInt ( ) ; System . out . println ( ( min ( n , 5 ) * di ) + ( n - min ( n , 5 ) ) * sc ) ; } public static void main ( String args [ ] ) { solve ( ) ; } }


import java . util . * ; import java . awt . * ; import java . awt . geom . * ; import static java . lang . System . * ; import static java . lang . Math . * ; public class Main { public static void main ( String [ ] $ ) { Scanner sc = new Scanner ( in ) ; int n = sc . nextInt ( ) , a = sc . nextInt ( ) , b = sc . nextInt ( ) ; int ans = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { if ( i <= 5 ) ans += b ; else ans += a ; } out . println ( ans ) ; } }


import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; long x = in . nextLong ( ) , y = in . nextLong ( ) ; System . out . println ( Math . abs ( x - y ) <= 1 ? " Brown " : " Alice " ) ; } }

a , b = map ( int , input ( ) . split ( ) ) NEW_LINE print ( ' Alice ' if abs ( a - b ) > 1 else ' Brown ' ) NEW_LINE


X , Y = [ int ( _ ) for _ in input ( ) . split ( ) ] NEW_LINE cache = { } NEW_LINE def calc ( X , Y ) : NEW_LINE INDENT if X < Y : NEW_LINE INDENT X , Y = Y , X NEW_LINE DEDENT def cal ( X , Y ) : NEW_LINE INDENT if X <= 1 : NEW_LINE INDENT return False NEW_LINE DEDENT for n in range ( 1 , X // 2 + 1 ) : NEW_LINE INDENT if calc ( X - n * 2 , Y + n ) == False : NEW_LINE INDENT return True NEW_LINE DEDENT DEDENT for n in range ( 1 , Y // 2 + 1 ) : NEW_LINE INDENT if calc ( X + n , Y - n * 2 ) == False : NEW_LINE INDENT return True NEW_LINE DEDENT DEDENT return False NEW_LINE DEDENT k = ( X , Y ) NEW_LINE if k in cache : NEW_LINE INDENT return cache [ k ] NEW_LINE DEDENT r = cal ( X , Y ) NEW_LINE cache [ k ] = r NEW_LINE return r NEW_LINE DEDENT def calc1 ( X , Y ) : NEW_LINE INDENT if abs ( X - Y ) < 2 : NEW_LINE INDENT return False NEW_LINE DEDENT return True NEW_LINE DEDENT if calc1 ( X , Y ) : NEW_LINE INDENT print ( " Alice " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " Brown " ) NEW_LINE DEDENT


import sys NEW_LINE stdin = sys . stdin NEW_LINE sys . setrecursionlimit ( 10 ** 5 ) NEW_LINE def li ( ) : return map ( int , stdin . readline ( ) . split ( ) ) NEW_LINE def li_ ( ) : return map ( lambda x : int ( x ) - 1 , stdin . readline ( ) . split ( ) ) NEW_LINE def lf ( ) : return map ( float , stdin . readline ( ) . split ( ) ) NEW_LINE def ls ( ) : return stdin . readline ( ) . split ( ) NEW_LINE def ns ( ) : return stdin . readline ( ) . rstrip ( ) NEW_LINE def lc ( ) : return list ( ns ( ) ) NEW_LINE def ni ( ) : return int ( stdin . readline ( ) ) NEW_LINE def nf ( ) : return float ( stdin . readline ( ) ) NEW_LINE x , y = li ( ) NEW_LINE print ( " Brown " ) if abs ( x - y ) <= 1 else print ( " Alice " ) NEW_LINE


print ( [ ' Alice ' , ' Brown ' ] [ abs ( eval ( input ( ) . replace ( ' ▁ ' , ' - ' ) ) ) < 2 ] ) NEW_LINE


x , y = map ( int , input ( ) . split ( ) ) NEW_LINE m = min ( x , y ) NEW_LINE x -= m NEW_LINE y -= m NEW_LINE if x == y : NEW_LINE INDENT print ( " Brown " ) NEW_LINE DEDENT else : NEW_LINE INDENT if max ( x , y ) == 1 : NEW_LINE INDENT print ( " Brown " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " Alice " ) NEW_LINE DEDENT DEDENT


import java . io . IOException ; import java . io . PrintWriter ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . List ; import java . util . Scanner ; class Main { public static void main ( String [ ] args ) throws IOException { new Main ( ) . run ( ) ; } void run ( ) { Scanner sc = new Scanner ( System . in ) ; long [ ] V = { sc . nextLong ( ) , sc . nextLong ( ) } ; Arrays . sort ( V ) ; if ( V [ 1 ] - V [ 0 ] > 1 ) { System . out . println ( " Alice " ) ; } else { System . out . println ( " Brown " ) ; } } int [ ] [ ] memo = new int [ 1000 ] [ 1000 ] ; boolean dfs ( int a , int b ) { if ( memo [ a ] [ b ] != 0 ) { return memo [ a ] [ b ] == 1 ; } boolean f = false ; for ( int i = 1 ; 2 * i <= a ; ++ i ) { f |= ! dfs ( a - i * 2 , b + i ) ; } for ( int i = 1 ; 2 * i <= b ; ++ i ) { f |= ! dfs ( a + i , b - 2 * i ) ; } if ( f ) { memo [ a ] [ b ] = 1 ; } else { memo [ a ] [ b ] = - 1 ; } return f ; } void tr ( Object ... objects ) { System . out . println ( Arrays . deepToString ( objects ) ) ; } }


import java . io . * ; import java . util . * ; class Main { public static void main ( String [ ] args ) { MyScanner sc = new MyScanner ( ) ; out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ; long x = sc . nextLong ( ) ; long y = sc . nextLong ( ) ; out . println ( Math . abs ( x - y ) <= 1 ? " Brown " : " Alice " ) ; out . close ( ) ; } 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 . 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 ) ; long x = sc . nextLong ( ) ; long y = sc . nextLong ( ) ; out . println ( abs ( x - y ) <= 1 ? " Brown " : " Alice " ) ; 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 . io . * ; import java . math . * ; import java . util . * ; public class Main { private static boolean debug = false ; private static boolean elapsed = false ; private static PrintWriter _out = new PrintWriter ( System . out ) ; private static PrintWriter _err = new PrintWriter ( System . err ) ; private void solve ( Scanner sc ) { long X = sc . nextLong ( ) ; long Y = sc . nextLong ( ) ; if ( Math . abs ( X - Y ) <= 1 ) { _out . println ( " Brown " ) ; } else { _out . println ( " Alice " ) ; } } private static BigInteger C ( long n , long r ) { BigInteger res = BigInteger . ONE ; for ( long i = n ; i > n - r ; -- i ) { res = res . multiply ( BigInteger . valueOf ( i ) ) ; } for ( long i = r ; i > 1 ; -- i ) { res = res . divide ( BigInteger . valueOf ( i ) ) ; } return res ; } private static BigInteger P ( long n , long r ) { BigInteger res = BigInteger . ONE ; for ( long i = n ; i > n - r ; -- i ) { res = res . multiply ( BigInteger . valueOf ( i ) ) ; } return res ; } public static void main ( String [ ] args ) { long S = System . currentTimeMillis ( ) ; Scanner sc = new Scanner ( System . in ) ; new Main ( ) . solve ( sc ) ; _out . flush ( ) ; long G = System . currentTimeMillis ( ) ; if ( elapsed ) { _err . println ( ( G - S ) + " ms " ) ; } _err . flush ( ) ; } }


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

n = int ( input ( ) ) ; print ( n * ( n + 1 ) // 2 ) NEW_LINE