import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . stream . IntStream ; import java . io . UncheckedIOException ; 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 ; LightScanner in = new LightScanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; B solver = new B ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class B { private static final String YES = " YES " ; private static final String NO = " NO " ; public void solve ( int testNumber , LightScanner in , PrintWriter out ) { int [ ] a = in . ints ( 4 ) ; if ( a [ 0 ] == a [ 2 ] || a [ 1 ] == a [ 2 ] || a [ 0 ] == a [ 3 ] || a [ 1 ] == a [ 3 ] ) { out . println ( YES ) ; } else { out . println ( NO ) ; } } } static class LightScanner { private BufferedReader reader = null ; private StringTokenizer tokenizer = null ; public LightScanner ( InputStream in ) { reader = new BufferedReader ( new InputStreamReader ( in ) ) ; } public String string ( ) { if ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new UncheckedIOException ( e ) ; } } return tokenizer . nextToken ( ) ; } public int ints ( ) { return Integer . parseInt ( string ( ) ) ; } public int [ ] ints ( int length ) { return IntStream . range ( 0 , length ) . map ( x -> ints ( ) ) . toArray ( ) ; } } }


def display ( H1 : int , W1 : int , H2 : int , W2 : int ) -> bool : NEW_LINE INDENT return H1 == H2 or H1 == W2 or W1 == H2 or W1 == W2 NEW_LINE DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT H1 , W1 = map ( int , input ( ) . split ( ) ) NEW_LINE H2 , W2 = map ( int , input ( ) . split ( ) ) NEW_LINE yes = display ( H1 , W1 , H2 , W2 ) NEW_LINE print ( ' YES ' if yes else ' NO ' ) NEW_LINE DEDENT


a , b = input ( ) . split ( ) NEW_LINE c = input ( ) . split ( ) NEW_LINE if a in c : NEW_LINE INDENT print ( ' YES ' ) NEW_LINE DEDENT elif b in c : NEW_LINE INDENT print ( ' YES ' ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( ' NO ' ) NEW_LINE DEDENT


a , b = map ( int , input ( ) . split ( ) ) NEW_LINE c , d = map ( int , input ( ) . split ( ) ) NEW_LINE print ( " YES " if { a , b } & { c , d } != set ( ) else " NO " ) NEW_LINE


H1 , W1 = map ( int , input ( ) . split ( ) ) NEW_LINE H2 , W2 = map ( int , input ( ) . split ( ) ) NEW_LINE flag = False NEW_LINE if H1 == H2 : NEW_LINE INDENT flag = True NEW_LINE DEDENT if H1 == W2 : NEW_LINE INDENT flag = True NEW_LINE DEDENT if W1 == H2 : NEW_LINE INDENT flag = True NEW_LINE DEDENT if W1 == W2 : NEW_LINE INDENT flag = True NEW_LINE DEDENT if flag : NEW_LINE INDENT print ( ' YES ' ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( ' NO ' ) NEW_LINE DEDENT


import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . InputMismatchException ; import java . io . IOException ; import java . io . InputStream ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; FastScanner in = new FastScanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskB solver = new TaskB ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskB { public void solve ( int testNumber , FastScanner in , PrintWriter out ) { int h1 = in . nextInt ( ) ; int w1 = in . nextInt ( ) ; int h2 = in . nextInt ( ) ; int w2 = in . nextInt ( ) ; if ( h1 == h2 || w1 == w2 || h1 == w2 || h2 == w1 ) out . println ( " YES " ) ; else out . println ( " NO " ) ; } } static class FastScanner { private InputStream in ; private byte [ ] buffer = new byte [ 1024 ] ; private int bufPointer ; private int bufLength ; public FastScanner ( InputStream in ) { this . in = in ; } private int readByte ( ) { if ( bufPointer >= bufLength ) { if ( bufLength == - 1 ) throw new InputMismatchException ( ) ; bufPointer = 0 ; try { bufLength = in . read ( buffer ) ; } catch ( IOException e ) { throw new InputMismatchException ( ) ; } if ( bufLength <= 0 ) return - 1 ; } return buffer [ bufPointer ++ ] ; } private static boolean 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 ; } } }

a = [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE b = [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE ans = " NO " NEW_LINE for i in a : NEW_LINE INDENT if i in b : NEW_LINE INDENT ans = " YES " NEW_LINE DEDENT DEDENT print ( ans ) NEW_LINE


import java . util . * ; import static java . lang . System . in ; import static java . lang . System . out ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( in ) ; String [ ] input1 = sc . nextLine ( ) . split ( " ▁ " , 0 ) ; String [ ] input2 = sc . nextLine ( ) . split ( " ▁ " , 0 ) ; int [ ] hw1 = new int [ 2 ] ; int [ ] hw2 = new int [ 2 ] ; for ( int i = 0 ; i < 2 ; i ++ ) { hw1 [ i ] = Integer . parseInt ( input1 [ i ] ) ; hw2 [ i ] = Integer . parseInt ( input2 [ i ] ) ; } for ( int i = 0 ; i < 2 ; i ++ ) for ( int j = 0 ; j < 2 ; j ++ ) { if ( hw1 [ i ] == hw2 [ j ] ) { out . println ( " YES " ) ; return ; } } out . println ( " NO " ) ; } }


import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Main main = new Main ( ) ; main . solve ( ) ; } void solve ( ) { Scanner sc = new Scanner ( System . in ) ; int h1 = Integer . parseInt ( sc . next ( ) ) ; int w1 = Integer . parseInt ( sc . next ( ) ) ; int h2 = Integer . parseInt ( sc . next ( ) ) ; int w2 = Integer . parseInt ( sc . next ( ) ) ; sc . close ( ) ; if ( h1 == h2 || h1 == w2 || w1 == h2 || w1 == w2 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } }


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

S , T = map ( int , input ( ) . split ( ) ) NEW_LINE print ( T - S + 1 ) NEW_LINE


import numpy as np NEW_LINE class Calculator : NEW_LINE INDENT def __init__ ( self , arr ) : NEW_LINE INDENT self . arr = arr NEW_LINE self . calc ( ) NEW_LINE DEDENT def calc ( self ) : NEW_LINE INDENT self . num = np . sum ( self . arr > 0 ) NEW_LINE DEDENT def get_num ( self ) : NEW_LINE INDENT return self . num NEW_LINE DEDENT DEDENT def main ( ) : NEW_LINE INDENT S , T , = map ( int , input ( ) . split ( ) ) NEW_LINE arr = np . arange ( S , T + 1 ) NEW_LINE calc = Calculator ( arr ) NEW_LINE print ( calc . get_num ( ) ) NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT main ( ) NEW_LINE DEDENT


s = input ( ) . split ( ) NEW_LINE S = int ( s [ 0 ] ) NEW_LINE T = int ( s [ 1 ] ) NEW_LINE if 1 <= S <= T <= 1000 : NEW_LINE INDENT print ( T - S + 1 ) NEW_LINE DEDENT


print ( len ( range ( * map ( int , input ( ) . split ( ) ) ) ) + 1 ) NEW_LINE


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


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


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


import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String range = scanner . nextLine ( ) ; scanner . close ( ) ; int delimiterPos = range . indexOf ( " ▁ " ) ; int s = Integer . parseInt ( range . substring ( 0 , delimiterPos ) ) ; int t = Integer . parseInt ( range . substring ( delimiterPos + 1 ) ) ; int num = t - ( s - 1 ) ; System . out . println ( num ) ; } }


import java . io . PrintWriter ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; String S = sc . next ( ) ; if ( S . charAt ( 0 ) == S . charAt ( 2 ) ) { out . println ( " Yes " ) ; } else { out . println ( " No " ) ; } out . flush ( ) ; } }

N = input ( ) NEW_LINE print ( ' Yes ' if int ( N ) == int ( N [ : : - 1 ] ) else ' No ' ) NEW_LINE


n = list ( input ( ) ) NEW_LINE t = list ( reversed ( n ) ) NEW_LINE if t == n : NEW_LINE INDENT print ( " Yes " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " No " ) NEW_LINE DEDENT


print ( " YNeos " [ len ( set ( input ( ) [ 0 : 3 : 2 ] ) ) - 1 : : 2 ] ) NEW_LINE


n = input ( ) NEW_LINE ans = ' No ' NEW_LINE if n [ 0 ] == n [ 2 ] : NEW_LINE INDENT ans = ' Yes ' NEW_LINE DEDENT print ( ans ) NEW_LINE


a = input ( ) NEW_LINE b = a [ : : - 1 ] NEW_LINE print ( " Yes " if a == b else " No " ) 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 N = in . next ( ) ; if ( N . charAt ( 0 ) == N . charAt ( 2 ) ) { out . println ( " Yes " ) ; } else { out . println ( " No " ) ; } } } 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 . io . BufferedReader ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( input . readLine ( ) ) ; System . out . println ( n == getRevers ( n ) ? " Yes " : " No " ) ; } public static int getRevers ( int n ) { int reverse = 0 ; while ( n > 9 ) { reverse = reverse * 10 + ( n % 10 ) ; n /= 10 ; } if ( n > 0 ) reverse = reverse * 10 + n ; return reverse ; } }


import java . util . * ; import static java . lang . Math . abs ; public class Main { public static void main ( String ... args ) { Scanner sc = new Scanner ( System . in ) ; String string = sc . next ( ) ; if ( string . charAt ( 0 ) == string . charAt ( 2 ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } }


import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int hundred = N / 100 ; int one = N % 10 ; System . out . println ( ( hundred == one ) ? " Yes " : " No " ) ; } }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . HashSet ; import java . util . Set ; import java . util . StringTokenizer ; public class Main { int n , k ; Set < Integer > ds ; public static void main ( String args [ ] ) { new Main ( ) . run ( ) ; } void run ( ) { FastReader sc = new FastReader ( ) ; n = sc . nextInt ( ) ; k = sc . nextInt ( ) ; ds = new HashSet < > ( ) ; for ( int i = 0 ; i < k ; i ++ ) { ds . add ( sc . nextInt ( ) ) ; } solve ( ) ; } void solve ( ) { while ( true ) { boolean flag = true ; int temp = n ; while ( temp > 0 ) { if ( ds . contains ( temp % 10 ) ) { flag = false ; break ; } temp /= 10 ; } if ( flag ) { System . out . println ( n ) ; return ; } else { n ++ ; } } } 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 ; } } }

n , a = open ( 0 ) ; n = int ( n . split ( ) [ 0 ] ) NEW_LINE while set ( a ) & set ( str ( n ) ) : n += 1 NEW_LINE print ( n ) NEW_LINE


import bisect NEW_LINE N , K = input ( ) . split ( ) NEW_LINE dList = [ int ( x ) for x in input ( ) . split ( ) ] NEW_LINE useList = [ 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 ] NEW_LINE for d in dList : NEW_LINE INDENT useList . remove ( d ) NEW_LINE DEDENT result = ' ' NEW_LINE if int ( N [ 0 ] ) > max ( useList ) : NEW_LINE INDENT if useList [ 0 ] != 0 : NEW_LINE INDENT result += str ( useList [ 0 ] ) NEW_LINE DEDENT else : NEW_LINE INDENT result += str ( useList [ 1 ] ) NEW_LINE DEDENT result += str ( useList [ 0 ] ) * ( len ( N ) ) NEW_LINE DEDENT else : NEW_LINE INDENT for i in range ( len ( N ) ) : NEW_LINE INDENT a = int ( N [ i ] ) NEW_LINE if a in useList : NEW_LINE INDENT result += N [ i ] NEW_LINE continue NEW_LINE DEDENT else : NEW_LINE INDENT count = 0 NEW_LINE if a > max ( useList ) : NEW_LINE INDENT while not max ( useList ) > int ( result [ - 1 ] ) : NEW_LINE INDENT count += 1 NEW_LINE result = result [ : - 1 ] NEW_LINE if result == ' ' : NEW_LINE INDENT break NEW_LINE DEDENT DEDENT if result == ' ' : NEW_LINE INDENT if useList [ 0 ] != 0 : NEW_LINE INDENT result += str ( useList [ 0 ] ) NEW_LINE DEDENT else : NEW_LINE INDENT result += str ( useList [ 1 ] ) NEW_LINE DEDENT result += str ( useList [ 0 ] ) * ( len ( N ) ) NEW_LINE break NEW_LINE DEDENT count += 1 NEW_LINE sect = int ( result [ - 1 ] ) NEW_LINE result = result [ : - 1 ] NEW_LINE result += str ( useList [ bisect . bisect_right ( useList , sect ) ] ) NEW_LINE result += str ( useList [ 0 ] ) * ( len ( N ) - len ( result ) ) NEW_LINE DEDENT else : NEW_LINE INDENT result += str ( useList [ bisect . bisect_right ( useList , a ) ] ) NEW_LINE result += str ( useList [ 0 ] ) * ( len ( N ) - i - 1 ) NEW_LINE DEDENT break NEW_LINE DEDENT DEDENT DEDENT print ( result ) NEW_LINE


import itertools NEW_LINE N , K = map ( int , input ( ) . split ( ) ) NEW_LINE Ds = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE NDs = list ( set ( [ i for i in range ( 10 ) ] ) - set ( Ds ) ) NEW_LINE NDs = list ( map ( str , NDs ) ) NEW_LINE min_price = 100000 NEW_LINE for p in itertools . product ( NDs , repeat = len ( str ( N ) ) ) : NEW_LINE INDENT if p [ 0 ] == '0' : NEW_LINE INDENT continue NEW_LINE DEDENT price = int ( ' ' . join ( p ) ) NEW_LINE if price < N : NEW_LINE INDENT continue NEW_LINE DEDENT min_price = min ( price , min_price ) NEW_LINE DEDENT if min_price == 100000 : NEW_LINE INDENT for p in itertools . product ( NDs , repeat = len ( str ( N ) ) + 1 ) : NEW_LINE INDENT if p [ 0 ] == '0' : NEW_LINE INDENT continue NEW_LINE DEDENT price = int ( ' ' . join ( p ) ) NEW_LINE min_price = min ( price , min_price ) NEW_LINE DEDENT DEDENT print ( min_price ) NEW_LINE


import sys NEW_LINE sys . setrecursionlimit ( 10 ** 6 ) NEW_LINE def main ( ) : NEW_LINE INDENT n , k = map ( int , input ( ) . split ( ) ) NEW_LINE lst = list ( input ( ) . split ( ) ) NEW_LINE for i in range ( n , 1000000 ) : NEW_LINE INDENT flg = True NEW_LINE for j in str ( i ) : NEW_LINE INDENT if j in lst : NEW_LINE INDENT flg = False NEW_LINE DEDENT DEDENT if flg : NEW_LINE INDENT print ( i ) NEW_LINE return NEW_LINE DEDENT DEDENT DEDENT main ( ) NEW_LINE


N , K = map ( int , input ( ) . split ( ) ) NEW_LINE D = [ int ( x ) for x in input ( ) . split ( ) ] NEW_LINE kazu = [ 9 , 8 , 7 , 6 , 5 , 4 , 3 , 2 , 1 , 0 ] NEW_LINE for item in D : NEW_LINE INDENT kazu . remove ( item ) NEW_LINE DEDENT p = [ ] NEW_LINE m = len ( str ( N ) ) NEW_LINE for i in range ( m ) : NEW_LINE INDENT p . append ( kazu [ 0 ] * ( 10 ** i ) ) NEW_LINE DEDENT p . sort ( reverse = True ) NEW_LINE j = 0 NEW_LINE while j < m : NEW_LINE INDENT for i in range ( 1 , len ( kazu ) ) : NEW_LINE INDENT if sum ( p ) - p [ j ] + kazu [ i ] * ( 10 ** ( m - j - 1 ) ) >= N : NEW_LINE INDENT p [ j ] = kazu [ i ] * ( 10 ** ( m - j - 1 ) ) NEW_LINE DEDENT else : NEW_LINE INDENT break NEW_LINE DEDENT DEDENT j += 1 NEW_LINE DEDENT if sum ( p ) < N : NEW_LINE INDENT if kazu [ - 1 ] != 0 : NEW_LINE INDENT ans = 0 NEW_LINE for i in range ( m + 1 ) : NEW_LINE INDENT ans += kazu [ - 1 ] * ( 10 ** i ) NEW_LINE DEDENT DEDENT else : NEW_LINE INDENT ans = kazu [ - 2 ] * ( 10 ) ** m NEW_LINE DEDENT DEDENT else : NEW_LINE INDENT ans = sum ( p ) NEW_LINE DEDENT print ( ans ) NEW_LINE


import java . io . * ; import java . util . * ; import java . util . function . * ; public class Main { public static void main ( String [ ] args ) { new Main ( ) . solve ( ) ; } int N , K ; boolean [ ] D ; public Main ( ) { Scanner in = new Scanner ( System . in ) ; N = in . nextInt ( ) ; K = in . nextInt ( ) ; D = new boolean [ 10 ] ; for ( int i = 0 ; i < K ; i ++ ) { D [ in . nextInt ( ) ] = true ; } } void solve ( ) { Function < Integer , Boolean > ok = ( n ) -> { while ( n > 0 ) { if ( D [ n % 10 ] ) return false ; n /= 10 ; } return true ; } ; for ( int n = N ; ; n ++ ) { if ( ok . apply ( n ) ) { System . out . println ( n ) ; break ; } } } }


import java . util . * ; import java . lang . * ; import java . io . * ; public class Main { static class Fast { BufferedReader br ; StringTokenizer st ; public Fast ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } public static void main ( String args [ ] ) throws Exception { Fast in = new Fast ( ) ; int arr [ ] = new int [ 10 ] ; int n = in . nextInt ( ) , k = in . nextInt ( ) ; for ( int i = 0 ; i < k ; i ++ ) { arr [ in . nextInt ( ) ] = 1 ; } l : for ( int i = n ; i < 10000000 ; i ++ ) { String str = " " + i ; for ( int j = 0 ; j < str . length ( ) ; j ++ ) { if ( arr [ str . charAt ( j ) - '0' ] == 1 ) { continue l ; } } System . out . println ( i ) ; return ; } } }


import java . util . * ; import java . io . * ; public class Main { public static boolean hated ( int price , Set < Integer > hateNum ) { if ( price < 10 ) return hateNum . contains ( price ) ; else return hateNum . contains ( price % 10 ) || hated ( price / 10 , hateNum ) ; } public static int pay ( int price , Set < Integer > hateNum ) { while ( hated ( price , hateNum ) ) { price ++ ; } return price ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; Set < Integer > hateNum = new HashSet < > ( ) ; for ( int k = 0 ; k < K ; k ++ ) hateNum . add ( sc . nextInt ( ) ) ; System . out . println ( pay ( N , hateNum ) ) ; } }


import java . io . BufferedInputStream ; import java . util . HashSet ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( new BufferedInputStream ( System . in ) ) ; String N = scan . next ( ) ; int K = scan . nextInt ( ) ; HashSet < Integer > dis = new HashSet < > ( ) ; for ( int i = 0 ; i < K ; i ++ ) dis . add ( scan . nextInt ( ) ) ; int low = 0 ; while ( dis . contains ( low ) ) low ++ ; int [ ] num = new int [ N . length ( ) ] ; for ( int i = 0 ; i < num . length ; i ++ ) num [ i ] = N . charAt ( i ) - '0' ; String res = dfs ( dis , 0 , num , low ) ; if ( res != null ) { System . out . println ( res ) ; return ; } int first = low ; if ( first == 0 ) { first ++ ; while ( dis . contains ( first ) ) first ++ ; } System . out . print ( first ) ; for ( int i = 0 ; i < num . length ; i ++ ) System . out . print ( low ) ; System . out . println ( ) ; } private static String dfs ( HashSet < Integer > dis , int idx , int [ ] num , int low ) { if ( idx == num . length ) return " " ; int i = num [ idx ] ; while ( dis . contains ( i ) ) i ++ ; if ( i > 9 ) return null ; if ( i == num [ idx ] ) { String next = dfs ( dis , idx + 1 , num , low ) ; if ( next != null ) return " " + i + next ; i ++ ; while ( dis . contains ( i ) ) i ++ ; if ( i > 9 ) return null ; } StringBuilder sb = new StringBuilder ( ) ; sb . append ( i ) ; for ( int j = 0 ; j < num . length - idx - 1 ; j ++ ) sb . append ( low ) ; return sb . toString ( ) ; } }


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; char [ ] arr = sc . next ( ) . toCharArray ( ) ; int n = sc . nextInt ( ) ; System . out . println ( " " + arr [ ( n - 1 ) / 5 % 5 ] + arr [ ( n - 1 ) % 5 ] ) ; } }

S = input ( ' ' ) NEW_LINE N = int ( input ( ) ) NEW_LINE a = N % 5 NEW_LINE b = int ( N - 1 ) // 5 NEW_LINE print ( S [ b ] + S [ a - 1 ] ) NEW_LINE


def string25 ( S : str , N : int ) -> str : NEW_LINE INDENT sortedS = sorted ( S ) NEW_LINE count = 1 NEW_LINE for c1 in sortedS : NEW_LINE INDENT for c2 in sortedS : NEW_LINE INDENT if count == N : NEW_LINE INDENT return c1 + c2 NEW_LINE DEDENT count += 1 NEW_LINE DEDENT DEDENT return " hoge " NEW_LINE DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT S = input ( ) NEW_LINE N = int ( input ( ) ) NEW_LINE ans = string25 ( S , N ) NEW_LINE print ( ans ) NEW_LINE DEDENT


S = input ( ) NEW_LINE N = int ( input ( ) ) NEW_LINE S = sorted ( S ) NEW_LINE cnt = 0 NEW_LINE for s in S : NEW_LINE INDENT for t in S : NEW_LINE INDENT cnt += 1 NEW_LINE ans = s + t NEW_LINE if cnt == N : NEW_LINE INDENT break NEW_LINE DEDENT DEDENT if cnt == N : NEW_LINE INDENT break NEW_LINE DEDENT DEDENT print ( ans ) NEW_LINE


s , n = open ( 0 ) ; n = int ( n ) - 1 ; print ( s [ n // 5 ] + s [ n % 5 ] ) NEW_LINE


import math NEW_LINE s = list ( input ( ) ) NEW_LINE n = int ( input ( ) ) NEW_LINE a = math . floor ( n / 5 ) NEW_LINE b = n % 5 NEW_LINE if a != 0 and b != 0 : NEW_LINE INDENT print ( s [ a ] + s [ b - 1 ] ) NEW_LINE DEDENT elif a == 0 and b != 0 : NEW_LINE INDENT print ( s [ a ] + s [ b - 1 ] ) NEW_LINE DEDENT elif a != 0 and b == 0 : NEW_LINE INDENT print ( s [ a - 1 ] + s [ b + 4 ] ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( s [ a ] + s [ b ] ) NEW_LINE DEDENT


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


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


import java . util . ArrayList ; import java . util . List ; 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 ( ) ; int n = sc . nextInt ( ) ; String [ ] ss = new String [ 5 ] ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { ss [ i ] = s . charAt ( i ) + " " ; } List < String > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < ss . length ; i ++ ) { for ( int j = 0 ; j < ss . length ; j ++ ) { list . add ( ss [ i ] + ss [ j ] ) ; } } System . out . println ( list . get ( n - 1 ) ) ; } }


import java . util . * ; import java . util . stream . * ; import static java . lang . System . * ; class Main { static Scanner sc = new Scanner ( System . in ) ; static int nextInt ( ) { return Integer . parseInt ( sc . next ( ) ) ; } static int [ ] nextIntArray ( int n ) { return IntStream . range ( 0 , n ) . map ( i -> nextInt ( ) ) . toArray ( ) ; } static int max ( int ... ar ) { Arrays . sort ( ar ) ; return ar [ ar . length - 1 ] ; } static int min ( int ... ar ) { Arrays . sort ( ar ) ; return ar [ 0 ] ; } static int maxInt = Integer . MAX_VALUE ; static int minInt = Integer . MIN_VALUE ; public static void main ( String [ ] args ) { String s = sc . next ( ) ; int n = nextInt ( ) ; ArrayList < String > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { for ( int j = 0 ; j < s . length ( ) ; j ++ ) { StringBuilder temp = new StringBuilder ( ) ; temp . append ( s . charAt ( i ) ) ; temp . append ( s . charAt ( j ) ) ; list . add ( temp . toString ( ) ) ; } } Collections . sort ( list ) ; out . println ( list . get ( n - 1 ) ) ; } }


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; System . out . println ( Math . min ( Math . abs ( a - b ) , Math . min ( Math . abs ( a + 10 - b ) , Math . abs ( b + 10 - a ) ) ) ) ; } }

from statistics import mean , median , variance , stdev NEW_LINE import numpy as np NEW_LINE import sys NEW_LINE import math NEW_LINE import fractions NEW_LINE import itertools NEW_LINE import copy NEW_LINE import collections NEW_LINE from operator import itemgetter NEW_LINE def j ( q ) : NEW_LINE INDENT if q == 1 : print ( " Yay ! " ) NEW_LINE else : print ( " : ( " ) NEW_LINE exit ( 0 ) NEW_LINE DEDENT def ct ( x , y ) : NEW_LINE INDENT if ( x > y ) : print ( " + " ) NEW_LINE elif ( x < y ) : print ( " - " ) NEW_LINE else : print ( " ? " ) NEW_LINE DEDENT def ip ( ) : NEW_LINE INDENT return int ( input ( ) ) NEW_LINE DEDENT def printrow ( a ) : NEW_LINE INDENT for i in range ( len ( a ) ) : NEW_LINE INDENT print ( a [ i ] ) NEW_LINE DEDENT DEDENT def combinations ( n , r ) : NEW_LINE INDENT if n < r : return 0 NEW_LINE return math . factorial ( n ) // ( math . factorial ( n - r ) * math . factorial ( r ) ) NEW_LINE DEDENT def permutations ( n , r ) : NEW_LINE INDENT if n < r : return 0 NEW_LINE return math . factorial ( n ) // math . factorial ( n - r ) NEW_LINE DEDENT n = ip ( ) NEW_LINE a = ip ( ) NEW_LINE if abs ( a - n ) >= 6 : NEW_LINE INDENT print ( 10 - abs ( a - n ) ) NEW_LINE DEDENT else : print ( abs ( a - n ) ) NEW_LINE


a = int ( input ( ) ) NEW_LINE b = int ( input ( ) ) NEW_LINE x_min = min ( a , b ) NEW_LINE x_max = max ( a , b ) NEW_LINE print ( min ( x_max - x_min , x_min + 9 - x_max + 1 ) ) NEW_LINE


a , b = map ( int , open ( 0 ) ) ; print ( 5 - abs ( 5 - abs ( a - b ) ) ) NEW_LINE


a = int ( input ( ) ) NEW_LINE b = int ( input ( ) ) NEW_LINE up_count = 0 NEW_LINE down_count = 0 NEW_LINE a1 = a NEW_LINE a2 = a NEW_LINE while ( a1 != b ) : NEW_LINE INDENT if ( a1 == 9 ) : NEW_LINE INDENT a1 = 0 NEW_LINE up_count += 1 NEW_LINE DEDENT else : NEW_LINE INDENT a1 += 1 NEW_LINE up_count += 1 NEW_LINE DEDENT DEDENT while ( a2 != b ) : NEW_LINE INDENT if ( a2 == 0 ) : NEW_LINE INDENT a2 = 9 NEW_LINE down_count += 1 NEW_LINE DEDENT else : NEW_LINE INDENT a2 -= 1 NEW_LINE down_count += 1 NEW_LINE DEDENT DEDENT print ( min ( up_count , down_count ) ) NEW_LINE


a , b = int ( input ( ) ) , int ( input ( ) ) NEW_LINE print ( min ( abs ( a - b ) , abs ( ( 10 - max ( a , b ) ) + min ( a , b ) ) ) ) NEW_LINE


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


import java . 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 ( Math . abs ( b - a ) > 5 ) { out . println ( 10 - Math . abs ( b - a ) ) ; } else { out . println ( Math . abs ( b - a ) ) ; } } } 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 long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } public double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } } }


import java . util . * ; import java . awt . * ; import static java . lang . System . * ; import static java . lang . Math . * ; public class Main { public static void main ( String [ ] $ ) { Scanner sc = new Scanner ( in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; Queue < Integer > q = new ArrayDeque < > ( ) ; Queue < Integer > ans = new ArrayDeque < > ( ) ; q . add ( a ) ; ans . add ( 0 ) ; int answer = 10 ; while ( ! q . isEmpty ( ) ) { int p = q . poll ( ) ; int c = ans . poll ( ) ; if ( p == b ) { answer = c ; break ; } else { q . add ( ( p + 1 ) % 10 ) ; q . add ( ( p - 1 + 10 ) % 10 ) ; ans . add ( c + 1 ) ; ans . add ( c + 1 ) ; } } out . println ( answer ) ; } }


import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int a = Integer . parseInt ( scanner . nextLine ( ) ) ; int b = Integer . parseInt ( scanner . nextLine ( ) ) ; int c ; if ( a < b ) { c = b - 10 ; } else { c = b + 10 ; } System . out . println ( Math . min ( Math . abs ( b - a ) , Math . abs ( c - a ) ) ) ; } }


import java . util . * ; public class Main { private static int n ; private static ArrayList < Double > maxT = new ArrayList < > ( ) ; private static ArrayList < Double > minT = new ArrayList < > ( ) ; private static int count1 = 0 , count2 = 0 , count3 = 0 , count4 = 0 , count5 = 0 , count6 = 0 ; public static void input ( ) { Scanner scan = new Scanner ( System . in ) ; n = scan . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) { maxT . add ( scan . nextDouble ( ) ) ; minT . add ( scan . nextDouble ( ) ) ; } } public static void main ( String args [ ] ) { input ( ) ; for ( int i = 0 ; i < maxT . size ( ) ; i ++ ) { double max = maxT . get ( i ) ; if ( max >= 35 ) count1 ++ ; else if ( max >= 30 ) count2 ++ ; else if ( max >= 25 ) count3 ++ ; else if ( max < 0 ) count6 ++ ; double min = minT . get ( i ) ; if ( min >= 25 ) count4 ++ ; else if ( min < 0 && max >= 0 ) count5 ++ ; } System . out . println ( count1 + " ▁ " + count2 + " ▁ " + count3 + " ▁ " + count4 + " ▁ " + count5 + " ▁ " + count6 ) ; } }

n = int ( input ( ) ) NEW_LINE l = [ 0 for _ in range ( 6 ) ] NEW_LINE for _ in range ( n ) : NEW_LINE INDENT a , b = map ( float , input ( ) . split ( ) ) NEW_LINE if a >= 35 : NEW_LINE INDENT l [ 0 ] += 1 NEW_LINE DEDENT elif a >= 30 : NEW_LINE INDENT l [ 1 ] += 1 NEW_LINE DEDENT elif a >= 25 : NEW_LINE INDENT l [ 2 ] += 1 NEW_LINE DEDENT if b >= 25 : NEW_LINE INDENT l [ 3 ] += 1 NEW_LINE DEDENT if b < 0 <= a : NEW_LINE INDENT l [ 4 ] += 1 NEW_LINE DEDENT if a < 0 : NEW_LINE INDENT l [ 5 ] += 1 NEW_LINE DEDENT DEDENT print ( " ▁ " . join ( list ( map ( str , l ) ) ) ) NEW_LINE


def b_days ( N , Observations ) : NEW_LINE INDENT from collections import OrderedDict NEW_LINE weather_forecast = OrderedDict ( ) NEW_LINE weather_forecast [ ' mousho ' ] = 0 NEW_LINE weather_forecast [ ' manatsu ' ] = 0 NEW_LINE weather_forecast [ ' natsu ' ] = 0 NEW_LINE weather_forecast [ ' nettaiya ' ] = 0 NEW_LINE weather_forecast [ ' fuyu ' ] = 0 NEW_LINE weather_forecast [ ' mafuyu ' ] = 0 NEW_LINE for highest_temp , lowest_temp in Observations : NEW_LINE INDENT if ' . ' in highest_temp : NEW_LINE INDENT highest_temp = int ( highest_temp . replace ( ' . ' , ' ' ) ) NEW_LINE DEDENT else : NEW_LINE INDENT highest_temp = int ( highest_temp ) * 10 NEW_LINE DEDENT if ' . ' in lowest_temp : NEW_LINE INDENT lowest_temp = int ( lowest_temp . replace ( ' . ' , ' ' ) ) NEW_LINE DEDENT else : NEW_LINE INDENT lowest_temp = int ( lowest_temp ) * 10 NEW_LINE DEDENT if highest_temp >= 350 : NEW_LINE INDENT weather_forecast [ ' mousho ' ] += 1 NEW_LINE DEDENT elif 300 <= highest_temp < 350 : NEW_LINE INDENT weather_forecast [ ' manatsu ' ] += 1 NEW_LINE DEDENT elif 250 <= highest_temp < 300 : NEW_LINE INDENT weather_forecast [ ' natsu ' ] += 1 NEW_LINE DEDENT if lowest_temp >= 250 : NEW_LINE INDENT weather_forecast [ ' nettaiya ' ] += 1 NEW_LINE DEDENT if highest_temp >= 0 and lowest_temp < 0 : NEW_LINE INDENT weather_forecast [ ' fuyu ' ] += 1 NEW_LINE DEDENT if highest_temp < 0 : NEW_LINE INDENT weather_forecast [ ' mafuyu ' ] += 1 NEW_LINE DEDENT DEDENT ans = ' ▁ ' . join ( map ( str , weather_forecast . values ( ) ) ) NEW_LINE return ans NEW_LINE DEDENT N = int ( input ( ) ) NEW_LINE Observations = [ input ( ) . split ( ) for j in range ( N ) ] NEW_LINE print ( b_days ( N , Observations ) ) NEW_LINE


d1 = d2 = d3 = d4 = d5 = d6 = 0 NEW_LINE for _ in range ( int ( input ( ) ) ) : NEW_LINE INDENT ma , mi = map ( float , input ( ) . split ( ) ) NEW_LINE if ma < 0 : d6 += 1 NEW_LINE elif 35 <= ma : d1 += 1 NEW_LINE elif 30 <= ma < 35 : d2 += 1 NEW_LINE elif 25 <= ma < 30 : d3 += 1 NEW_LINE if 25 <= mi : d4 += 1 NEW_LINE if mi < 0 and 0 <= ma : d5 += 1 NEW_LINE DEDENT print ( d1 , d2 , d3 , d4 , d5 , d6 ) NEW_LINE


n = int ( input ( ) ) NEW_LINE a = [ 0 , 0 , 0 , 0 , 0 , 0 ] NEW_LINE for x in range ( n ) : NEW_LINE INDENT maxx , minn = map ( float , input ( ) . split ( ' ▁ ' ) ) NEW_LINE if ( maxx >= 35 ) : NEW_LINE INDENT a [ 0 ] = a [ 0 ] + 1 NEW_LINE DEDENT if ( maxx >= 30 and maxx < 35 ) : NEW_LINE INDENT a [ 1 ] = a [ 1 ] + 1 NEW_LINE DEDENT if ( maxx >= 25 and maxx < 30 ) : NEW_LINE INDENT a [ 2 ] = a [ 2 ] + 1 NEW_LINE DEDENT if ( minn >= 25 ) : NEW_LINE INDENT a [ 3 ] = a [ 3 ] + 1 NEW_LINE DEDENT if ( maxx >= 0 and minn < 0 ) : NEW_LINE INDENT a [ 4 ] = a [ 4 ] + 1 NEW_LINE DEDENT if ( maxx < 0 ) : NEW_LINE INDENT a [ 5 ] = a [ 5 ] + 1 NEW_LINE DEDENT DEDENT print ( " % d ▁ % d ▁ % d ▁ % d ▁ % d ▁ % d " % ( a [ 0 ] , a [ 1 ] , a [ 2 ] , a [ 3 ] , a [ 4 ] , a [ 5 ] ) ) NEW_LINE


def b_days ( N , Observations ) : NEW_LINE INDENT day_mousho , day_manatsu , day_natsu , day_nettai , day_fuyu , day_mafuyu = 0 , 0 , 0 , 0 , 0 , 0 NEW_LINE for highest_temp , lowest_temp in Observations : NEW_LINE INDENT if ' . ' in highest_temp : NEW_LINE INDENT highest_temp = int ( highest_temp . replace ( ' . ' , ' ' ) ) NEW_LINE DEDENT else : NEW_LINE INDENT highest_temp = int ( highest_temp ) * 10 NEW_LINE DEDENT if ' . ' in lowest_temp : NEW_LINE INDENT lowest_temp = int ( lowest_temp . replace ( ' . ' , ' ' ) ) NEW_LINE DEDENT else : NEW_LINE INDENT lowest_temp = int ( lowest_temp ) * 10 NEW_LINE DEDENT if highest_temp >= 350 : NEW_LINE INDENT day_mousho += 1 NEW_LINE DEDENT elif 300 <= highest_temp < 350 : NEW_LINE INDENT day_manatsu += 1 NEW_LINE DEDENT elif 250 <= highest_temp < 300 : NEW_LINE INDENT day_natsu += 1 NEW_LINE DEDENT if lowest_temp >= 250 : NEW_LINE INDENT day_nettai += 1 NEW_LINE DEDENT if lowest_temp < 0 and highest_temp >= 0 : NEW_LINE INDENT day_fuyu += 1 NEW_LINE DEDENT if highest_temp < 0 : NEW_LINE INDENT day_mafuyu += 1 NEW_LINE DEDENT DEDENT ans = ' ▁ ' . join ( map ( str , [ day_mousho , day_manatsu , day_natsu , day_nettai , day_fuyu , day_mafuyu ] ) ) NEW_LINE return ans NEW_LINE DEDENT N = int ( input ( ) ) NEW_LINE Observations = [ [ i for i in input ( ) . split ( ) ] for j in range ( N ) ] NEW_LINE print ( b_days ( N , Observations ) ) NEW_LINE


import java . util . Iterator ; import java . util . PrimitiveIterator ; import java . util . Scanner ; class Main { public static void main ( String [ ] $ ) { int a = 0 , b = 0 , c = 0 , d = 0 , e = 0 , f = 0 ; for ( int v : new Range ( gInt ( ) ) ) { double high = s . nextDouble ( ) , low = s . nextDouble ( ) ; if ( high >= 35 ) ++ a ; if ( 35 > high && high >= 30 ) ++ b ; if ( 30 > high && high >= 25 ) ++ c ; if ( low >= 25 ) ++ d ; if ( low < 0 && high >= 0 ) ++ e ; if ( high < 0 ) ++ f ; } System . out . println ( a + " ▁ " + b + " ▁ " + c + " ▁ " + d + " ▁ " + e + " ▁ " + f ) ; } static Scanner s = new Scanner ( System . in ) ; static int gInt ( ) { return Integer . parseInt ( s . next ( ) ) ; } static long gLong ( ) { return Long . parseLong ( s . next ( ) ) ; } static class Range implements Iterable < Integer > , PrimitiveIterator . OfInt { int from , to , c ; Range ( int from , int to ) { this . from = from ; this . to = to ; this . c = from ; } Range ( int n ) { this ( 0 , n - 1 ) ; } @ Override public Iterator < Integer > iterator ( ) { return this ; } @ Override public boolean hasNext ( ) { return c <= to ; } @ Override public int nextInt ( ) { return c ++ ; } } }


public class Main { public static void main ( String [ ] args ) { java . util . Scanner sc = new java . util . Scanner ( System . in ) ; int N = sc . nextInt ( ) ; double mLT1 [ ] = new double [ N ] ; double mST1 [ ] = new double [ N ] ; int c1 = 0 ; int c2 = 0 ; int c3 = 0 ; int c4 = 0 ; int c5 = 0 ; int c6 = 0 ; for ( int i = 0 ; i < N ; i ++ ) { mLT1 [ i ] = sc . nextDouble ( ) ; mST1 [ i ] = sc . nextDouble ( ) ; if ( 35 <= mLT1 [ i ] ) { c1 ++ ; } if ( 30 <= mLT1 [ i ] & mLT1 [ i ] < 35 ) { c2 ++ ; } if ( 25 <= mLT1 [ i ] & mLT1 [ i ] < 30 ) { c3 ++ ; } if ( 25 <= mST1 [ i ] ) { c4 ++ ; } if ( 0 <= mLT1 [ i ] & mST1 [ i ] < 0 ) { c5 ++ ; } if ( mLT1 [ i ] < 0 ) { c6 ++ ; } } System . out . println ( c1 + " ▁ " + c2 + " ▁ " + c3 + " ▁ " + c4 + " ▁ " + c5 + " ▁ " + c6 ) ; } }


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int ans [ ] = new int [ 6 ] ; int N = sc . nextInt ( ) ; for ( int i = 0 ; i < N ; i ++ ) { double high = sc . nextDouble ( ) ; double low = sc . nextDouble ( ) ; if ( high >= 35 ) { ans [ 0 ] ++ ; } else if ( high >= 30 && high < 35 ) { ans [ 1 ] ++ ; } else if ( high >= 25 && high < 30 ) { ans [ 2 ] ++ ; } if ( low >= 25 ) { ans [ 3 ] ++ ; } if ( low < 0 && high >= 0 ) { ans [ 4 ] ++ ; } if ( high < 0 ) { ans [ 5 ] ++ ; } } for ( int i = 0 ; i < 6 ; i ++ ) { if ( i > 0 ) { System . out . print ( " ▁ " ) ; } System . out . print ( ans [ i ] ) ; } System . out . println ( ) ; } }


import java . util . * ; public class Main { private static ArrayList < Double > maxT = new ArrayList < > ( ) ; private static ArrayList < Double > minT = new ArrayList < > ( ) ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int ans [ ] = new int [ 6 ] ; for ( int i = 0 ; i < N ; i ++ ) { double max = sc . nextDouble ( ) ; double min = sc . nextDouble ( ) ; maxT . add ( max ) ; minT . add ( min ) ; } for ( int i = 0 ; i < N ; i ++ ) { double max = maxT . get ( i ) ; if ( max >= 35 ) { ans [ 0 ] ++ ; } else if ( max >= 30 ) { ans [ 1 ] ++ ; } else if ( max >= 25 ) { ans [ 2 ] ++ ; } else if ( max < 0 ) { ans [ 5 ] ++ ; } double min = minT . get ( i ) ; if ( min >= 25 ) { ans [ 3 ] ++ ; } else if ( min < 0 && max >= 0 ) { ans [ 4 ] ++ ; } } System . out . println ( ans [ 0 ] + " ▁ " + ans [ 1 ] + " ▁ " + ans [ 2 ] + " ▁ " + ans [ 3 ] + " ▁ " + ans [ 4 ] + " ▁ " + ans [ 5 ] ) ; } }


import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; if ( x % 3 == 0 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } }

N = input ( ) NEW_LINE for i in range ( len ( N ) ) : NEW_LINE INDENT if N [ i ] == 3 : NEW_LINE INDENT ans = True NEW_LINE DEDENT elif int ( N ) % 3 == 0 : NEW_LINE INDENT ans = True NEW_LINE DEDENT else : ans = False NEW_LINE DEDENT if ans == True : NEW_LINE INDENT print ( " YES " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " NO " ) NEW_LINE DEDENT


print ( ' YES ' if input ( ) in '369' else ' NO ' ) NEW_LINE


class Calculator : NEW_LINE INDENT def __init__ ( self ) : NEW_LINE INDENT pass NEW_LINE DEDENT def set_num ( self , x ) : NEW_LINE INDENT self . x = x NEW_LINE DEDENT def get_judgement ( self ) : NEW_LINE INDENT self . judge = False NEW_LINE if "3" in str ( self . x ) or self . x % 3 == 0 : NEW_LINE INDENT self . judge = True NEW_LINE DEDENT return self . judge NEW_LINE DEDENT DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT n , = map ( int , input ( ) . split ( ) ) NEW_LINE c = Calculator ( ) NEW_LINE c . set_num ( n ) NEW_LINE if c . get_judgement ( ) : NEW_LINE INDENT print ( " YES " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " NO " ) NEW_LINE DEDENT DEDENT


N = input ( ) NEW_LINE f = False NEW_LINE for i in N : NEW_LINE INDENT if i == '3' : NEW_LINE INDENT f = True NEW_LINE DEDENT DEDENT if int ( N ) % 3 == 0 : NEW_LINE INDENT f = True NEW_LINE DEDENT if f : NEW_LINE INDENT print ( ' YES ' ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( ' NO ' ) NEW_LINE DEDENT


n = int ( input ( ) ) NEW_LINE print ( " YES " ) if n % 3 == 0 and n != 0 else print ( " NO " ) NEW_LINE


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


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


import java . util . * ; import java . util . List ; import java . util . ArrayList ; import java . math . * ; class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int N = scanner . nextInt ( ) ; String SplitN [ ] = Integer . toString ( N ) . split ( " " ) ; if ( Arrays . asList ( SplitN ) . contains ( "3" ) || N % 3 == 0 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } }


import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; scanner . close ( ) ; String msg = " NO " ; if ( n == 3 || n % 3 == 0 ) { msg = " YES " ; } System . out . println ( msg ) ; } }


import java . util . * ; public class Main { public void main ( Scanner sc ) { char a [ ] = sc . next ( ) . toCharArray ( ) ; int len = a . length ; Map < Character , TreeSet < Integer > > map = new HashMap < > ( ) ; for ( int i = 0 ; i < len ; i ++ ) { map . putIfAbsent ( a [ i ] , new TreeSet < > ( ) ) ; map . get ( a [ i ] ) . add ( i + 1 ) ; } int data [ ] = new int [ len + 1 ] ; BitSet bset = new BitSet ( ) ; data [ len ] = 0 ; for ( int i = len - 1 ; i >= 0 ; i -- ) { bset . set ( a [ i ] - ' a ' ) ; data [ i ] = data [ i + 1 ] ; if ( bset . cardinality ( ) == 26 ) { bset . clear ( ) ; data [ i ] ++ ; } } int p = 0 ; int ansLen = data [ 0 ] + 1 ; char ans [ ] = new char [ ansLen ] ; for ( int i = 0 ; i < ansLen ; i ++ ) { for ( char c = ' a ' ; c <= ' z ' ; c ++ ) { if ( ! map . containsKey ( c ) ) { ans [ i ] = c ; p = len + 1 ; break ; } else { Integer next = map . get ( c ) . higher ( p ) ; if ( next == null || ( data [ p ] - data [ next ] == 1 ) ) { ans [ i ] = c ; p = getOrDefault ( next , len + 1 ) ; break ; } } } } System . out . println ( new String ( ans ) ) ; } private int getOrDefault ( Integer n , int def ) { return n == null ? def : n ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; new Main ( ) . main ( sc ) ; sc . close ( ) ; } }

abc = " abcdefghijklmnopqrstuvwxyz " NEW_LINE A = str ( input ( ) ) NEW_LINE n = len ( A ) NEW_LINE word_pos = [ ] NEW_LINE ct = [ n ] * 26 NEW_LINE orda = ord ( " a " ) NEW_LINE for i in range ( n - 1 , - 1 , - 1 ) : NEW_LINE INDENT ct [ ord ( A [ i ] ) - orda ] = i NEW_LINE word_pos . append ( ct . copy ( ) ) NEW_LINE DEDENT word_pos . reverse ( ) NEW_LINE dp = [ 0 ] * n + [ 1 , 0 ] NEW_LINE j = n NEW_LINE sep = [ ] NEW_LINE for i in range ( n - 1 , - 1 , - 1 ) : NEW_LINE INDENT ct = word_pos [ i ] NEW_LINE if ( max ( ct ) < j ) : NEW_LINE INDENT sep . append ( i ) NEW_LINE j = min ( ct ) NEW_LINE DEDENT DEDENT if ( j == n ) : NEW_LINE INDENT for i in abc : NEW_LINE INDENT if ( i not in A ) : NEW_LINE INDENT print ( i + " \n " ) NEW_LINE break NEW_LINE DEDENT DEDENT DEDENT else : NEW_LINE INDENT sep . reverse ( ) NEW_LINE ans = " " NEW_LINE for i in abc : NEW_LINE INDENT if ( i not in A [ : sep [ 0 ] ] ) : NEW_LINE INDENT ans += i NEW_LINE break NEW_LINE DEDENT DEDENT for i in range ( 0 , len ( sep ) ) : NEW_LINE INDENT start = sep [ i ] NEW_LINE try : NEW_LINE INDENT end = sep [ i + 1 ] NEW_LINE DEDENT except : NEW_LINE INDENT end = n NEW_LINE DEDENT next = word_pos [ start ] [ ord ( ans [ - 1 ] ) - orda ] NEW_LINE for i in range ( 0 , 26 ) : NEW_LINE INDENT if ( word_pos [ next + 1 ] [ i ] > end - 1 ) : NEW_LINE INDENT ans += chr ( orda + i ) NEW_LINE break NEW_LINE DEDENT DEDENT DEDENT ans += " \n " NEW_LINE print ( ans ) NEW_LINE DEDENT


import math , string , itertools , fractions , heapq , collections , re , array , bisect , sys , random , time , copy , functools NEW_LINE sys . setrecursionlimit ( 10 ** 7 ) NEW_LINE inf = 10 ** 20 NEW_LINE gosa = 1.0 / 10 ** 10 NEW_LINE mod = 10 ** 9 + 7 NEW_LINE def LI ( ) : return [ int ( x ) for x in sys . stdin . readline ( ) . split ( ) ] NEW_LINE def LI_ ( ) : return [ int ( x ) - 1 for x in sys . stdin . readline ( ) . split ( ) ] NEW_LINE def LF ( ) : return [ float ( x ) for x in sys . stdin . readline ( ) . split ( ) ] NEW_LINE def LS ( ) : return sys . stdin . readline ( ) . split ( ) NEW_LINE def I ( ) : return int ( sys . stdin . readline ( ) ) NEW_LINE def F ( ) : return float ( sys . stdin . readline ( ) ) NEW_LINE def S ( ) : return input ( ) NEW_LINE def main ( ) : NEW_LINE INDENT a = S ( ) NEW_LINE l = len ( a ) NEW_LINE t = { } NEW_LINE for c in string . ascii_lowercase : NEW_LINE INDENT t [ c ] = l NEW_LINE DEDENT b = [ ( 1 , 0 , 0 ) for _ in range ( l ) ] NEW_LINE b . append ( ( 1 , ' a ' , l ) ) NEW_LINE b . append ( ( 0 , ' ' , l + 1 ) ) NEW_LINE for c , i in reversed ( list ( zip ( a , range ( l ) ) ) ) : NEW_LINE INDENT t [ c ] = i NEW_LINE b [ i ] = min ( [ ( b [ t [ d ] + 1 ] [ 0 ] + 1 , d , t [ d ] + 1 ) for d in string . ascii_lowercase ] ) NEW_LINE DEDENT r = ' ' NEW_LINE i = 0 NEW_LINE while i < l : NEW_LINE INDENT r += b [ i ] [ 1 ] NEW_LINE i = b [ i ] [ 2 ] NEW_LINE DEDENT return r NEW_LINE DEDENT print ( main ( ) ) NEW_LINE


ord_a = ord ( ' a ' ) NEW_LINE L = 26 NEW_LINE S = list ( map ( lambda c : ord ( c ) - ord_a , input ( ) ) ) NEW_LINE memo = [ ] NEW_LINE f = [ 0 ] * L NEW_LINE cnt = 0 NEW_LINE for i , s in zip ( reversed ( range ( len ( S ) ) ) , reversed ( S ) ) : NEW_LINE INDENT cnt += ( f [ s ] == 0 ) NEW_LINE f [ s ] += 1 NEW_LINE if cnt == L : NEW_LINE INDENT memo . append ( ( i , f ) ) NEW_LINE f = [ 0 ] * L NEW_LINE cnt = 0 NEW_LINE DEDENT DEDENT result = [ f . index ( 0 ) ] NEW_LINE for i , f in reversed ( memo ) : NEW_LINE INDENT c = result [ - 1 ] NEW_LINE for j in range ( i , len ( S ) ) : NEW_LINE INDENT s = S [ j ] NEW_LINE f [ s ] -= 1 NEW_LINE if s == c : NEW_LINE INDENT break NEW_LINE DEDENT DEDENT result . append ( f . index ( 0 ) ) NEW_LINE DEDENT print ( ' ' . join ( map ( lambda x : chr ( x + ord_a ) , result ) ) ) NEW_LINE


from bisect import bisect_left NEW_LINE CHARACTERs = ' abcdefghijklmnopqrstuvwxyz ' NEW_LINE As = input ( ) NEW_LINE lenA = len ( As ) NEW_LINE posChars = dict ( [ ( ch , [ lenA ] ) for ch in CHARACTERs ] ) NEW_LINE dp = [ 0 ] * lenA + [ 1 , 0 ] NEW_LINE for i in reversed ( range ( lenA ) ) : NEW_LINE INDENT posChars [ As [ i ] ] . append ( i ) NEW_LINE dp [ i ] = min ( [ dp [ posChars [ ch ] [ - 1 ] + 1 ] for ch in CHARACTERs ] ) + 1 NEW_LINE DEDENT for ch in CHARACTERs : NEW_LINE INDENT posChars [ ch ] = posChars [ ch ] [ : : - 1 ] NEW_LINE DEDENT ans = [ ] NEW_LINE i = 0 NEW_LINE for k in reversed ( range ( dp [ 0 ] ) ) : NEW_LINE INDENT for ch in CHARACTERs : NEW_LINE INDENT pos = posChars [ ch ] [ bisect_left ( posChars [ ch ] , i ) ] NEW_LINE if dp [ pos + 1 ] == k : NEW_LINE INDENT ans . append ( ch ) NEW_LINE i = pos + 1 NEW_LINE break NEW_LINE DEDENT DEDENT DEDENT print ( ' ' . join ( ans ) ) NEW_LINE


A = input ( ) NEW_LINE import string NEW_LINE p = { } NEW_LINE for x in string . ascii_lowercase : p [ x ] = len ( A ) NEW_LINE tb = [ ( 0 , 0 , 0 ) ] * len ( A ) NEW_LINE tb . append ( ( 1 , 0 , 0 ) ) NEW_LINE tb . append ( ( 0 , 0 , 0 ) ) NEW_LINE for i , x in reversed ( list ( enumerate ( A ) ) ) : NEW_LINE INDENT p [ x ] = i NEW_LINE tb [ i ] = min ( [ ( tb [ p [ c ] + 1 ] [ 0 ] + 1 , c , p [ c ] + 1 ) for c in string . ascii_lowercase ] ) NEW_LINE DEDENT i = 0 NEW_LINE ans = [ ] NEW_LINE while i < len ( A ) : NEW_LINE INDENT ans . append ( tb [ i ] [ 1 ] ) NEW_LINE i = tb [ i ] [ 2 ] NEW_LINE DEDENT print ( " " . join ( ans ) ) NEW_LINE


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; int n = s . length ( ) ; int [ ] [ ] table = new int [ n / 26 + 1 ] [ 26 ] ; int [ ] [ ] table2 = new int [ n / 26 + 1 ] [ 26 ] ; for ( int i = 0 ; i < table . length ; i ++ ) Arrays . fill ( table [ i ] , - 1 ) ; int res = 0 ; int index = n - 1 ; int count = 0 ; for ( ; index >= 0 ; index -- ) { int c = ( int ) ( s . charAt ( index ) - ' a ' ) ; table2 [ res ] [ c ] = index ; if ( table [ res ] [ c ] != - 1 ) continue ; table [ res ] [ c ] = index ; count ++ ; if ( count == 26 ) { res ++ ; count = 0 ; } } int [ ] str = new int [ res + 1 ] ; for ( int i = res ; i >= 0 ; i -- ) { int pre = 0 ; for ( int j = 0 ; j < 26 ; j ++ ) { if ( table [ i ] [ j ] != - 1 ) continue ; pre = j ; break ; } str [ res - i ] = pre ; if ( i > 0 ) { int min = table2 [ i - 1 ] [ pre ] ; for ( int j = 0 ; j < 26 ; j ++ ) { if ( table [ i - 1 ] [ j ] <= min ) table [ i - 1 ] [ j ] = - 1 ; } } } for ( int i = 0 ; i < res + 1 ; i ++ ) System . out . print ( ( char ) ( ' a ' + str [ i ] ) ) ; System . out . println ( ) ; } }


import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( input . readLine ( ) ) ; int [ ] problems = new int [ n ] ; int sum = 0 ; StringTokenizer tokenizer = new StringTokenizer ( input . readLine ( ) ) ; for ( int i = 0 ; i < n ; i ++ ) { problems [ i ] = Integer . parseInt ( tokenizer . nextToken ( ) ) ; sum += problems [ i ] ; } StringBuilder out = new StringBuilder ( ) ; int m = Integer . parseInt ( input . readLine ( ) ) ; for ( int i = 0 ; i < m ; i ++ ) { tokenizer = new StringTokenizer ( input . readLine ( ) ) ; out . append ( ( sum - problems [ Integer . parseInt ( tokenizer . nextToken ( ) ) - 1 ] ) + Integer . parseInt ( tokenizer . nextToken ( ) ) ) . append ( " \n " ) ; } System . out . print ( out ) ; } }

n = int ( input ( ) ) NEW_LINE T = [ int ( t ) for t in input ( ) . split ( ) ] NEW_LINE m = int ( input ( ) ) NEW_LINE drinks = [ ] NEW_LINE for i in range ( m ) : NEW_LINE INDENT p , x = map ( int , input ( ) . split ( ) ) NEW_LINE drinks . append ( [ p , x ] ) NEW_LINE DEDENT for drink in drinks : NEW_LINE INDENT diff = T [ drink [ 0 ] - 1 ] - drink [ 1 ] NEW_LINE print ( sum ( T ) - diff ) NEW_LINE DEDENT


import sys , re NEW_LINE from collections import deque , defaultdict , Counter NEW_LINE from math import ceil , sqrt , hypot , factorial , pi , sin , cos , radians NEW_LINE from itertools import permutations , combinations , product NEW_LINE from operator import itemgetter , mul NEW_LINE from copy import deepcopy NEW_LINE from string import ascii_lowercase , ascii_uppercase , digits NEW_LINE def input ( ) : return sys . stdin . readline ( ) . strip ( ) NEW_LINE def INT ( ) : return int ( input ( ) ) NEW_LINE def MAP ( ) : return map ( int , input ( ) . split ( ) ) NEW_LINE def LIST ( ) : return list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE sys . setrecursionlimit ( 10 ** 9 ) NEW_LINE INF = float ( ' inf ' ) NEW_LINE MOD = 10 ** 9 + 7 NEW_LINE N = INT ( ) NEW_LINE T = LIST ( ) NEW_LINE M = INT ( ) NEW_LINE PX = [ LIST ( ) for _ in range ( M ) ] NEW_LINE for p , x in PX : NEW_LINE INDENT tmp = T . copy ( ) NEW_LINE T [ p - 1 ] = x NEW_LINE print ( sum ( T ) ) NEW_LINE T = tmp NEW_LINE DEDENT


n = int ( input ( ) ) NEW_LINE t = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE m = int ( input ( ) ) NEW_LINE px = [ ] NEW_LINE for i in range ( m ) : NEW_LINE INDENT p , x = map ( int , input ( ) . split ( ) ) NEW_LINE px . append ( [ p , x ] ) NEW_LINE DEDENT for i in range ( m ) : NEW_LINE INDENT time = 0 NEW_LINE for j in range ( n ) : NEW_LINE INDENT if j + 1 == px [ i ] [ 0 ] : NEW_LINE INDENT time += px [ i ] [ 1 ] NEW_LINE DEDENT else : NEW_LINE INDENT time += t [ j ] NEW_LINE DEDENT DEDENT print ( time ) NEW_LINE DEDENT


I = lambda : map ( int , input ( ) . split ( ) ) NEW_LINE N = int ( input ( ) ) NEW_LINE T = list ( I ( ) ) NEW_LINE M = int ( input ( ) ) NEW_LINE ans = [ sum ( T ) ] * M NEW_LINE for i in range ( M ) : NEW_LINE INDENT p , x = I ( ) NEW_LINE ans [ i ] = ans [ i ] - T [ p - 1 ] + x NEW_LINE DEDENT print ( ' \n ' . join ( map ( str , ans ) ) ) NEW_LINE


n = int ( input ( ) ) NEW_LINE t = [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE s = sum ( t ) NEW_LINE m = int ( input ( ) ) NEW_LINE for i in range ( m ) : NEW_LINE INDENT a , b = map ( int , input ( ) . split ( ) ) NEW_LINE print ( s - t [ a - 1 ] + b ) NEW_LINE DEDENT


import java . io . InputStream ; import java . io . IOException ; class MyScanner { InputStream stream ; public MyScanner ( ) { stream = System . in ; } public int nextInt ( ) { int ret = 0 ; try { while ( true ) { char readed = ( char ) stream . read ( ) ; if ( readed < '0' || readed > '9' ) { break ; } ret = ret * 10 + ( readed - '0' ) ; } } catch ( IOException e ) { e . printStackTrace ( ) ; } finally { return ret ; } } } class Main { public static void main ( String args [ ] ) { MyScanner sc = new MyScanner ( ) ; int n = sc . nextInt ( ) ; int [ ] t = new int [ n ] ; int sum = 0 ; for ( int i = 0 ; i < n ; ++ i ) { t [ i ] = sc . nextInt ( ) ; sum += t [ i ] ; } int m = sc . nextInt ( ) ; for ( int i = 0 ; i < m ; ++ i ) { int p , x ; p = sc . nextInt ( ) - 1 ; x = sc . nextInt ( ) ; System . out . println ( sum - t [ p ] + x ) ; } } }


import java . util . Scanner ; import java . util . stream . IntStream ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String probCount = scanner . nextLine ( ) ; String [ ] timesList = scanner . nextLine ( ) . split ( " ▁ " ) ; Integer drinkCount = new Integer ( scanner . nextLine ( ) ) ; IntStream . range ( 0 , drinkCount ) . forEach ( i -> { String [ ] pair = scanner . nextLine ( ) . split ( " ▁ " ) ; Integer nProb = new Integer ( pair [ 0 ] ) ; String nTime = pair [ 1 ] ; String [ ] copiedList = new String [ timesList . length ] ; System . arraycopy ( timesList , 0 , copiedList , 0 , timesList . length ) ; copiedList [ nProb - 1 ] = nTime ; System . out . println ( addTimes ( copiedList ) ) ; } ) ; } private static Integer addTimes ( String [ ] timesList ) { Integer sum = 0 ; for ( int i = 0 ; i < timesList . length ; i ++ ) { sum = sum + new Integer ( timesList [ i ] ) ; } return sum ; } }


import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] T = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) T [ i ] = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int [ ] P = new int [ M ] ; int [ ] X = new int [ M ] ; for ( int i = 0 ; i < M ; i ++ ) { P [ i ] = sc . nextInt ( ) ; X [ i ] = sc . nextInt ( ) ; } int sumTime = 0 ; for ( int i = 0 ; i < N ; i ++ ) { sumTime += T [ i ] ; } for ( int i = 0 ; i < M ; i ++ ) { int ans = sumTime - ( T [ P [ i ] - 1 ] - X [ i ] ) ; System . out . println ( ans ) ; } } }


import java . util . Scanner ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; sc . nextLine ( ) ; String line = sc . nextLine ( ) ; int M = sc . nextInt ( ) ; String [ ] lineArray = line . split ( " ▁ " , 0 ) ; int [ ] T = new int [ N ] ; int [ ] P = new int [ M ] ; int [ ] X = new int [ M ] ; for ( int i = 0 ; i < N ; i ++ ) { T [ i ] = Integer . parseInt ( lineArray [ i ] ) ; } for ( int i = 0 ; i < M ; i ++ ) { P [ i ] = sc . nextInt ( ) ; X [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < M ; i ++ ) { int sum = 0 ; for ( int j = 0 ; j < N ; j ++ ) { if ( P [ i ] - 1 == j ) { sum += X [ i ] ; } else { sum += T [ j ] ; } } System . out . println ( sum ) ; } } }


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; System . out . println ( sc . nextInt ( ) < 1200 ? " ABC " : " ARC " ) ; } }

print ( ' ABC ' if int ( input ( ) ) < 1200 else ' ARC ' ) NEW_LINE


from functools import reduce NEW_LINE import math NEW_LINE def main ( ) : NEW_LINE INDENT a = int ( input ( ) . rstrip ( ) ) NEW_LINE if a >= 1200 : NEW_LINE INDENT print ( ' ARC ' ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( ' ABC ' ) NEW_LINE DEDENT DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT main ( ) NEW_LINE DEDENT


def abc_arc ( x : int ) -> str : NEW_LINE INDENT return ' ABC ' if x < 1200 else ' ARC ' NEW_LINE DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT x = int ( input ( ) ) NEW_LINE ans = abc_arc ( x ) NEW_LINE print ( ans ) NEW_LINE DEDENT


from sys import stdin NEW_LINE n = int ( stdin . readline ( ) . rstrip ( ) ) NEW_LINE if n < 1200 : NEW_LINE INDENT print ( ' ABC ' ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( ' ARC ' ) NEW_LINE DEDENT


x = int ( input ( ) ) NEW_LINE print ( " ABC " if x < 1200 else " ARC " ) 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 x = in . nextInt ( ) ; out . println ( x < 1200 ? " ABC " : " ARC " ) ; } } 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 . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . InputMismatchException ; import java . io . IOException ; import java . io . InputStream ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; FastScanner in = new FastScanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskA solver = new TaskA ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskA { public void solve ( int testNumber , FastScanner in , PrintWriter out ) { out . println ( in . nextInt ( ) < 1200 ? " ABC " : " ARC " ) ; } } static class FastScanner { private InputStream in ; private byte [ ] buffer = new byte [ 1024 ] ; private int bufPointer ; private int bufLength ; public FastScanner ( InputStream in ) { this . in = in ; } private int readByte ( ) { if ( bufPointer >= bufLength ) { if ( bufLength == - 1 ) throw new InputMismatchException ( ) ; bufPointer = 0 ; try { bufLength = in . read ( buffer ) ; } catch ( IOException e ) { throw new InputMismatchException ( ) ; } if ( bufLength <= 0 ) return - 1 ; } return buffer [ bufPointer ++ ] ; } private static boolean isSpaceChar ( int c ) { return c == ' ▁ ' || c == ' \n ' || c == ' \r ' || c == ' \t ' || c == - 1 ; } public long nextLong ( ) { long 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 ; } public int nextInt ( ) { long n = nextLong ( ) ; if ( n < Integer . MIN_VALUE || n > Integer . MAX_VALUE ) throw new NumberFormatException ( ) ; return ( int ) n ; } } }


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 ( ) ; boolean ans = false ; if ( 1200 <= n ) ans = true ; sc . close ( ) ; System . out . println ( ans ? " ARC " : " ABC " ) ; } }


import java . util . * ; class Main { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int n = sc . nextInt ( ) ; System . out . println ( n < 1200 ? " ABC " : " ARC " ) ; } }


import java . util . ArrayList ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; ArrayList < Integer > list = new ArrayList < Integer > ( ) ; int max = Math . max ( A , B ) ; for ( int i = 1 ; i <= max ; i ++ ) { if ( A % i == 0 && B % i == 0 ) { list . add ( new Integer ( i ) ) ; } } System . out . println ( list . get ( list . size ( ) - K ) ) ; } }

A , B , K = map ( int , input ( ) . split ( ) ) NEW_LINE List = [ x for x in range ( min ( A , B ) , 0 , - 1 ) if A % x == 0 and B % x == 0 ] NEW_LINE print ( List [ K - 1 ] ) NEW_LINE


m = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE a = m [ 0 ] NEW_LINE b = m [ 1 ] NEW_LINE k = m [ 2 ] NEW_LINE c = min ( a , b ) NEW_LINE d = 0 NEW_LINE e = 0 NEW_LINE for i in range ( c ) : NEW_LINE INDENT if ( a % ( c - i ) == 0 and b % ( c - i ) == 0 ) : NEW_LINE INDENT d += 1 NEW_LINE DEDENT if ( d == k ) : NEW_LINE INDENT e = c - i NEW_LINE break NEW_LINE DEDENT DEDENT print ( e ) NEW_LINE


a , b , k = [ int ( s ) for s in input ( ) . split ( ) ] NEW_LINE def f ( s , l , k ) : NEW_LINE INDENT numbers = [ ] NEW_LINE for i in range ( 1 , s + 1 ) : NEW_LINE INDENT if s % i == 0 and l % i == 0 : NEW_LINE INDENT numbers . append ( i ) NEW_LINE DEDENT DEDENT print ( numbers [ - k ] ) NEW_LINE DEDENT if a > b : NEW_LINE INDENT f ( b , a , k ) NEW_LINE DEDENT else : NEW_LINE INDENT f ( a , b , k ) NEW_LINE DEDENT


a , b , k = map ( int , input ( ) . split ( ) ) NEW_LINE c = min ( a , b ) NEW_LINE count = 0 NEW_LINE for i in reversed ( range ( 1 , c + 1 ) ) : NEW_LINE INDENT if a % i == 0 and b % i == 0 : NEW_LINE INDENT count += 1 NEW_LINE if k == count : NEW_LINE INDENT print ( i ) NEW_LINE DEDENT DEDENT DEDENT


import numpy as np NEW_LINE a , b , k = map ( int , input ( ) . split ( ) ) NEW_LINE c = np . array ( list ( range ( 1 , min ( a , b ) + 1 ) ) ) NEW_LINE e = [ f for f , g in enumerate ( zip ( a % c , b % c ) ) if g == ( 0 , 0 ) ] NEW_LINE print ( c [ e [ - k ] ] ) NEW_LINE


import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; BKThCommonDivisor solver = new BKThCommonDivisor ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class BKThCommonDivisor { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int A = in . nextInt ( ) ; int B = in . nextInt ( ) ; int K = in . nextInt ( ) ; int res = solve ( A , B , K ) ; out . println ( res ) ; } private int solve ( int a , int b , int K ) { int cur = 0 ; for ( int i = 101 ; i >= 1 ; i -- ) { if ( a % i == 0 && b % i == 0 ) { cur ++ ; if ( cur == K ) return i ; } } throw new RuntimeException ( " Impossible " ) ; } } }


import java . math . BigDecimal ; import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import java . util . Scanner ; import java . util . regex . Matcher ; import java . util . regex . Pattern ; public class Main { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { ArrayList < Integer > list = new ArrayList < Integer > ( ) ; int a = Integer . parseInt ( sc . next ( ) ) ; int b = Integer . parseInt ( sc . next ( ) ) ; int c = Integer . parseInt ( sc . next ( ) ) ; int count = 0 ; if ( a < b ) { for ( int i = 0 ; i < a ; i ++ ) { int d = i + 1 ; if ( a % d == 0 && b % d == 0 ) { list . add ( d ) ; } } } else { for ( int i = 0 ; i < b ; i ++ ) { int d = i + 1 ; if ( a % d == 0 && b % d == 0 ) { list . add ( d ) ; } } } System . out . println ( list . get ( list . size ( ) - c ) ) ; System . out . flush ( ) ; sc . close ( ) ; } }


import java . util . ArrayList ; import java . util . Collections ; import java . util . HashSet ; import java . util . List ; import java . util . Scanner ; import java . util . Set ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; Main abc120B = new Main ( ) ; System . out . println ( abc120B . solve ( A , B , K ) ) ; } public int solve ( int A , int B , int K ) { ABC120BSolve abc120BSolve = new ABC120BSolve ( A , B ) ; return abc120BSolve . solve ( K ) ; } class ABC120BSolve { List < Integer > D ; public ABC120BSolve ( int A , int B ) { Set < Integer > divB = divisors ( new HashSet ( ) , B ) ; List < Integer > divAList = new ArrayList ( divisors ( new HashSet ( ) , A ) ) ; Collections . sort ( divAList , Collections . reverseOrder ( ) ) ; D = new ArrayList ( ) ; for ( int a : divAList ) { if ( divB . contains ( a ) ) { D . add ( a ) ; } } } public int solve ( int k ) { if ( this . D . size ( ) >= k ) { return this . D . get ( k - 1 ) ; } else { return - 1 ; } } private Set < Integer > divisors ( Set < Integer > ans , int n ) { for ( int i = 1 ; i * i <= n ; i ++ ) { if ( n % i == 0 ) { ans . add ( i ) ; ans . add ( n / i ) ; } } return ans ; } } } Note : . / Main . java uses unchecked or unsafe operations . Note : Recompile with - Xlint : unchecked for details .


import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; String [ ] ABK = str . split ( " ▁ " ) ; int cont = 0 ; for ( int i = Math . min ( Integer . parseInt ( ABK [ 0 ] ) , Integer . parseInt ( ABK [ 1 ] ) ) ; i > 0 ; i -- ) { if ( Integer . parseInt ( ABK [ 0 ] ) % i == 0 && Integer . parseInt ( ABK [ 1 ] ) % i == 0 ) { cont ++ ; if ( cont == Integer . parseInt ( ABK [ 2 ] ) ) { System . out . println ( i ) ; return ; } } } } }


import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String s = scan . next ( ) ; if ( s . length ( ) == 1 ) { System . out . println ( 0 ) ; return ; } boolean flag = true ; int total = 0 ; int count = 0 ; for ( int i = 0 ; i < s . length ( ) / 2 ; i ++ ) { if ( s . charAt ( i ) != s . charAt ( s . length ( ) - i - 1 ) ) { count ++ ; flag = false ; } } if ( flag ) { if ( s . length ( ) % 2 == 1 ) { total = 25 * ( s . length ( ) - 1 ) ; } else { total = 25 * s . length ( ) ; } } else if ( count == 1 ) { total = 25 * s . length ( ) - 2 ; } else { total = 25 * s . length ( ) ; } System . out . println ( total ) ; } }

s = input ( ) NEW_LINE n = len ( s ) NEW_LINE l = [ True if s [ i ] == s [ - i - 1 ] else False for i in range ( n // 2 ) ] NEW_LINE print ( 25 * ( n - n % 2 ) if all ( l ) else 25 * n - 2 if n // 2 - sum ( l ) == 1 else 25 * n ) NEW_LINE


import numpy as np NEW_LINE def is_palindrome ( ) : NEW_LINE INDENT return A == A [ : : - 1 ] NEW_LINE DEDENT def main ( ) : NEW_LINE INDENT l = len ( A ) NEW_LINE if l == 1 : NEW_LINE INDENT print ( 0 ) NEW_LINE return NEW_LINE DEDENT if is_palindrome ( ) : NEW_LINE INDENT if l % 2 == 0 : NEW_LINE INDENT print ( l * 25 ) NEW_LINE return NEW_LINE DEDENT else : NEW_LINE INDENT print ( ( l - 1 ) * 25 ) NEW_LINE return NEW_LINE DEDENT DEDENT a_l = A [ : l // 2 ] NEW_LINE a_r = A [ l - l // 2 : ] [ : : - 1 ] NEW_LINE a_l2 = np . array ( list ( a_l ) ) NEW_LINE a_r2 = np . array ( list ( a_r ) ) NEW_LINE d_num = ( a_l2 != a_r2 ) . sum ( ) NEW_LINE if d_num == 1 : NEW_LINE INDENT print ( ( l - 2 ) * 25 + 2 * 24 ) NEW_LINE return NEW_LINE DEDENT print ( l * 25 ) NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT A = input ( ) NEW_LINE main ( ) NEW_LINE DEDENT


def count_diff_ch ( s ) : NEW_LINE INDENT count = 0 NEW_LINE length = len ( s ) NEW_LINE for i in range ( 0 , length // 2 ) : NEW_LINE INDENT if s [ i ] != s [ length - i - 1 ] : NEW_LINE INDENT count += 1 NEW_LINE DEDENT DEDENT return count NEW_LINE DEDENT s = input ( ) NEW_LINE c = count_diff_ch ( s ) NEW_LINE ans = len ( s ) * 25 NEW_LINE parity = len ( s ) % 2 NEW_LINE if c == 0 : NEW_LINE INDENT ans -= parity * 25 NEW_LINE DEDENT elif c == 1 : NEW_LINE INDENT ans -= 2 NEW_LINE DEDENT print ( ans ) NEW_LINE


a = list ( input ( ) ) NEW_LINE n = len ( a ) NEW_LINE if n == 1 : NEW_LINE INDENT print ( 0 ) NEW_LINE exit ( ) NEW_LINE DEDENT res = 0 NEW_LINE if n % 2 == 1 : NEW_LINE INDENT k = n // 2 NEW_LINE judge = True NEW_LINE for i in range ( k ) : NEW_LINE INDENT if a [ i ] != a [ n - 1 - i ] : NEW_LINE INDENT judge = False NEW_LINE break NEW_LINE DEDENT DEDENT if judge : NEW_LINE INDENT res = 0 NEW_LINE DEDENT else : NEW_LINE INDENT res = 25 NEW_LINE DEDENT a = a [ : k : ] + a [ k + 1 : : ] NEW_LINE n -= 1 NEW_LINE DEDENT d = 0 NEW_LINE k = n // 2 NEW_LINE for i in range ( k ) : NEW_LINE INDENT if a [ i ] != a [ n - 1 - i ] : NEW_LINE INDENT d += 1 NEW_LINE DEDENT DEDENT for i in range ( k ) : NEW_LINE INDENT if d >= 2 : NEW_LINE INDENT res += 50 NEW_LINE DEDENT elif d == 1 : NEW_LINE INDENT if a [ i ] == a [ n - 1 - i ] : NEW_LINE INDENT res += 50 NEW_LINE DEDENT else : NEW_LINE INDENT res += 48 NEW_LINE DEDENT DEDENT else : NEW_LINE INDENT res += 50 NEW_LINE DEDENT DEDENT print ( res ) NEW_LINE


A = input ( ) NEW_LINE lenA = len ( A ) NEW_LINE A1 = A [ : lenA // 2 ] NEW_LINE A2 = A [ lenA - lenA // 2 : ] [ : : - 1 ] NEW_LINE if A1 == A2 : NEW_LINE INDENT if lenA % 2 == 0 : NEW_LINE INDENT print ( 25 * lenA ) NEW_LINE exit ( ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( 25 * lenA - 25 ) NEW_LINE exit ( ) NEW_LINE DEDENT DEDENT count = 0 NEW_LINE for i , z in zip ( A1 , A2 ) : NEW_LINE INDENT if i != z : NEW_LINE INDENT count += 1 NEW_LINE DEDENT DEDENT if count == 1 : NEW_LINE INDENT print ( ( lenA - 2 ) * 25 + 24 * 2 ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( lenA * 25 ) NEW_LINE DEDENT


import java . util . * ; public class Main { private static String s ; public static void input ( ) { Scanner scan = new Scanner ( System . in ) ; s = scan . next ( ) ; } public static void main ( String args [ ] ) { input ( ) ; int N = s . length ( ) ; int count = 0 ; for ( int i = 0 ; i < N / 2 ; i ++ ) { if ( s . charAt ( i ) != s . charAt ( N - i - 1 ) ) count ++ ; } int ans = 0 ; if ( count == 0 ) { if ( N % 2 == 1 ) { ans = 25 * N - 25 ; } else { ans = 25 * N ; } } else if ( count == 1 ) { ans = 25 * N - 2 ; } else if ( count >= 2 ) { ans = 25 * N ; } System . out . println ( ans ) ; } }


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; int count = 0 ; for ( int i = 0 ; i < s . length ( ) / 2 ; i ++ ) { if ( s . charAt ( i ) != s . charAt ( s . length ( ) - 1 - i ) ) { count ++ ; } } int sum = 0 ; if ( count == 0 ) { if ( s . length ( ) == 1 ) { sum = 0 ; } else if ( s . length ( ) % 2 == 1 ) { sum = 25 * ( s . length ( ) - 1 ) ; } else { sum = 25 * s . length ( ) ; } } else if ( count == 1 ) { sum = 25 * s . length ( ) - 2 ; } else { sum = 25 * s . length ( ) ; } System . out . println ( sum ) ; } }


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String A = sc . next ( ) ; int N = A . length ( ) ; int count = 0 ; for ( int i = 0 ; i < N / 2 ; i ++ ) { if ( A . charAt ( i ) != A . charAt ( N - i - 1 ) ) count ++ ; } int ans = 0 ; if ( count == 0 ) { if ( N % 2 == 1 ) { ans = 25 * N - 25 ; } else { ans = 25 * N ; } } else if ( count == 1 ) { ans = 25 * N - 2 ; } else if ( count >= 2 ) { ans = 25 * N ; } System . out . println ( 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 k = sc . nextInt ( ) ; System . out . println ( k * ( int ) Math . pow ( k - 1 , n - 1 ) ) ; } }

N , K = map ( int , input ( ) . split ( ) ) NEW_LINE print ( K * ( K - 1 ) ** ( N - 1 ) ) NEW_LINE


def painting_balls_with_atcodeer ( N : int , K : int ) -> int : NEW_LINE INDENT return K * ( ( K - 1 ) ** ( N - 1 ) ) NEW_LINE DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT N , K = map ( int , input ( ) . split ( ) ) NEW_LINE ans = painting_balls_with_atcodeer ( N , K ) NEW_LINE print ( ans ) NEW_LINE DEDENT


N , K = map ( int , input ( ) . split ( ' ▁ ' ) ) NEW_LINE res = K NEW_LINE for i in range ( N - 1 ) : NEW_LINE INDENT res *= K - 1 NEW_LINE DEDENT print ( res ) NEW_LINE


a = [ int ( n ) for n in input ( ) . split ( ) ] NEW_LINE if a [ 0 ] == 1 : NEW_LINE INDENT print ( a [ 1 ] ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( a [ 1 ] * ( a [ 1 ] - 1 ) ** ( a [ 0 ] - 1 ) ) NEW_LINE DEDENT


N , K = map ( int , open ( 0 ) . read ( ) . split ( ) ) NEW_LINE a = K * ( ( K - 1 ) ** ( N - 1 ) ) NEW_LINE print ( a ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) { int n = 0 ; int k = 0 ; try ( BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { String [ ] tmp = br . readLine ( ) . split ( " \\ s " ) ; n = Integer . parseInt ( tmp [ 0 ] ) ; k = Integer . parseInt ( tmp [ 1 ] ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; System . exit ( 1 ) ; } long quotient = k ; quotient *= ( long ) Math . pow ( k - 1 , n - 1 ) ; System . out . print ( quotient ) ; } }


import java . util . * ; import java . util . stream . IntStream ; public class Main { public static boolean found = false ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; long ans = k ; for ( int i = 0 ; i < n - 1 ; i ++ ) { ans *= ( k - 1 ) ; } System . out . println ( ans ) ; } }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . math . BigInteger ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer tokenizer = new StringTokenizer ( input . readLine ( ) ) ; int n = Integer . parseInt ( tokenizer . nextToken ( ) ) ; int k = Integer . parseInt ( tokenizer . nextToken ( ) ) ; BigInteger bigDecimal = BigInteger . valueOf ( k ) ; for ( int i = 1 ; i < n ; i ++ ) { bigDecimal = bigDecimal . multiply ( BigInteger . valueOf ( k - 1 ) ) ; } System . out . println ( bigDecimal ) ; } }


import java . math . BigDecimal ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; System . out . println ( BigDecimal . valueOf ( K ) . multiply ( BigDecimal . valueOf ( K - 1 ) . pow ( N - 1 ) ) ) ; } }


import java . util . ArrayList ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; ArrayList < String > names = new ArrayList < String > ( ) ; ArrayList < String > votes = new ArrayList < String > ( ) ; for ( int i = 0 ; i <= n ; i ++ ) { String name = scanner . nextLine ( ) ; if ( ! names . contains ( name ) ) { names . add ( name ) ; } votes . add ( name ) ; } scanner . close ( ) ; String mostName = " " ; int mostNum = 0 ; for ( String name : names ) { int count = 0 ; for ( String vote : votes ) { if ( vote . equals ( name ) ) { count ++ ; } if ( count >= mostNum ) { mostName = name ; mostNum = count ; } } } System . out . println ( mostName ) ; } }

from collections import Counter NEW_LINE n = int ( input ( ) ) NEW_LINE s = [ input ( ) for _ in range ( n ) ] NEW_LINE c = Counter ( s ) NEW_LINE ans = ' ' NEW_LINE t = 0 NEW_LINE for x , y in c . items ( ) : NEW_LINE INDENT if y > t : NEW_LINE INDENT t = y NEW_LINE ans = x NEW_LINE DEDENT DEDENT print ( ans ) NEW_LINE


_ , * s = open ( 0 ) ; print ( max ( s , key = s . count ) [ : - 1 ] ) NEW_LINE


n = int ( input ( ) ) NEW_LINE dic = { } NEW_LINE for i in range ( n ) : NEW_LINE INDENT tmp = input ( ) NEW_LINE if tmp in dic . keys ( ) : NEW_LINE INDENT dic [ tmp ] += 1 NEW_LINE DEDENT else : NEW_LINE INDENT dic [ tmp ] = 1 NEW_LINE DEDENT DEDENT for name in dic . keys ( ) : NEW_LINE INDENT if dic [ name ] == max ( dic . values ( ) ) : NEW_LINE INDENT print ( name ) NEW_LINE break NEW_LINE DEDENT DEDENT


n = int ( input ( ) ) NEW_LINE s = [ input ( ) for i in range ( n ) ] NEW_LINE res = 0 NEW_LINE temp = 0 NEW_LINE for i in set ( s ) : NEW_LINE INDENT temp = 0 NEW_LINE for j in s : NEW_LINE INDENT if i == j : NEW_LINE INDENT temp += 1 NEW_LINE DEDENT DEDENT res = max ( res , temp ) NEW_LINE DEDENT for i in set ( s ) : NEW_LINE INDENT if s . count ( i ) == res : NEW_LINE INDENT print ( i ) NEW_LINE exit ( ) NEW_LINE DEDENT DEDENT


n = int ( input ( ) ) NEW_LINE hoge = [ ] NEW_LINE ans_name = " hoge " NEW_LINE ans_coun = 0 NEW_LINE for i in range ( n ) : NEW_LINE INDENT hoge . append ( input ( ) ) NEW_LINE DEDENT for i in range ( n ) : NEW_LINE INDENT if ( hoge . count ( hoge [ i ] ) >= ans_coun ) : NEW_LINE INDENT ans_name = hoge [ i ] NEW_LINE ans_coun = hoge . count ( hoge [ i ] ) NEW_LINE DEDENT DEDENT print ( ans_name ) 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 N = in . nextInt ( ) ; String [ ] S = new String [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { S [ i ] = in . next ( ) ; } int count ; int max = 0 ; String ans = " " ; for ( int i = 0 ; i < N ; i ++ ) { count = 0 ; for ( int j = 0 ; j < N ; j ++ ) { if ( S [ i ] . equals ( S [ j ] ) ) { count ++ ; } } if ( count > max ) { max = count ; ans = S [ i ] ; } } out . println ( ans ) ; } } 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 . HashMap ; import java . util . Map ; import java . util . Scanner ; public class Main { private static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int n = sc . nextInt ( ) ; Map < String , Integer > map = new HashMap < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { String s = sc . next ( ) ; if ( map . containsKey ( s ) ) { map . put ( s , map . get ( s ) + 1 ) ; } else { map . put ( s , 1 ) ; } } Pair ans = new Pair ( " " , 0 ) ; for ( Map . Entry < String , Integer > ele : map . entrySet ( ) ) { if ( ans . count < ele . getValue ( ) ) { ans = new Pair ( ele . getKey ( ) , ele . getValue ( ) ) ; } } System . out . println ( ans . name ) ; } static class Pair { String name ; int count ; public Pair ( String name , int count ) { this . name = name ; this . count = count ; } } }


import java . util . * ; import java . util . Map . Entry ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; String S [ ] = new String [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { S [ i ] = sc . next ( ) ; } Map < String , Integer > m = new HashMap < String , Integer > ( ) ; for ( String s : S ) { int v ; if ( m . containsKey ( s ) ) { v = m . get ( s ) + 1 ; } else { v = 1 ; } m . put ( s , v ) ; } List < Entry < String , Integer > > list_entries = new ArrayList < Entry < String , Integer > > ( m . entrySet ( ) ) ; Collections . sort ( list_entries , new Comparator < Entry < String , Integer > > ( ) { public int compare ( Entry < String , Integer > obj1 , Entry < String , Integer > obj2 ) { return obj2 . getValue ( ) . compareTo ( obj1 . getValue ( ) ) ; } } ) ; System . out . println ( list_entries . get ( 0 ) . getKey ( ) ) ; } }


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String [ ] bodies = new String [ sc . nextInt ( ) ] ; int [ ] voted = new int [ bodies . length ] ; String temp ; int lastElement = 0 ; flag : for ( int i = 0 ; i < bodies . length ; i ++ ) { temp = sc . next ( ) ; try { for ( int j = 0 ; j < bodies . length ; j ++ ) { if ( bodies [ j ] . equals ( temp ) ) { voted [ j ] ++ ; continue flag ; } } } catch ( NullPointerException e ) { bodies [ lastElement ] = temp ; voted [ lastElement ] ++ ; lastElement ++ ; } } int mostVoted = 0 ; int mostVotedBody = 0 ; for ( int i = 0 ; i < voted . length ; i ++ ) { if ( voted [ i ] > mostVoted ) { mostVoted = voted [ i ] ; mostVotedBody = i ; } } System . out . println ( bodies [ mostVotedBody ] ) ; } }


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int t = sc . nextInt ( ) ; int minCost = 1001 ; for ( int i = 0 ; i < n ; i ++ ) { int cost = sc . nextInt ( ) ; int time = sc . nextInt ( ) ; if ( t >= time ) { if ( minCost > cost ) minCost = cost ; } } if ( minCost == 1001 ) System . out . println ( " TLE " ) ; else System . out . println ( minCost ) ; } }

import sys NEW_LINE import copy NEW_LINE from bisect import bisect_left NEW_LINE def main ( ) : NEW_LINE INDENT N , T = map ( int , input ( ) . split ( " ▁ " ) ) NEW_LINE CT = [ ] NEW_LINE isOK = False NEW_LINE for _ in range ( N ) : NEW_LINE INDENT c , t = map ( int , input ( ) . split ( " ▁ " ) ) NEW_LINE if t <= T : NEW_LINE INDENT isOK = True NEW_LINE CT . append ( ( c , t ) ) NEW_LINE DEDENT DEDENT if isOK == False : NEW_LINE INDENT print ( " TLE " ) NEW_LINE sys . exit ( ) NEW_LINE DEDENT CT . sort ( ) NEW_LINE c , t = CT [ 0 ] NEW_LINE print ( c ) NEW_LINE DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT main ( ) NEW_LINE DEDENT


N , T = [ int ( elem ) for elem in input ( ) . split ( ) ] NEW_LINE min_cost = None NEW_LINE min_cost_time = None NEW_LINE for i in range ( 0 , N ) : NEW_LINE INDENT c , t = [ int ( elem ) for elem in input ( ) . split ( ) ] NEW_LINE if t <= T : NEW_LINE INDENT if min_cost is None : NEW_LINE INDENT min_cost = c NEW_LINE min_cost_time = t NEW_LINE DEDENT else : NEW_LINE INDENT if c < min_cost : NEW_LINE INDENT min_cost = c NEW_LINE min_cost_time = t NEW_LINE DEDENT DEDENT DEDENT DEDENT if min_cost is None : NEW_LINE INDENT print ( ' TLE ' ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( min_cost ) NEW_LINE DEDENT


N , T = map ( int , input ( ) . split ( ) ) NEW_LINE m = min ( [ c if t <= T else 9999 for c , t in [ map ( int , input ( ) . split ( ) ) for _ in range ( N ) ] ] ) NEW_LINE print ( " TLE " if m == 9999 else m ) NEW_LINE


import sys NEW_LINE def solve ( N : int , T : int , c : " List [ int ] " , t : " List [ int ] " ) : NEW_LINE INDENT ret = float ( ' inf ' ) NEW_LINE for i in range ( N ) : NEW_LINE INDENT if t [ i ] <= T : NEW_LINE INDENT ret = min ( ret , c [ i ] ) NEW_LINE DEDENT DEDENT if ret == float ( ' inf ' ) : NEW_LINE INDENT print ( ' TLE ' ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( ret ) NEW_LINE DEDENT return NEW_LINE DEDENT def main ( ) : NEW_LINE INDENT def iterate_tokens ( ) : NEW_LINE INDENT for line in sys . stdin : NEW_LINE INDENT for word in line . split ( ) : NEW_LINE INDENT yield word NEW_LINE DEDENT DEDENT DEDENT tokens = iterate_tokens ( ) NEW_LINE N = int ( next ( tokens ) ) NEW_LINE T = int ( next ( tokens ) ) NEW_LINE c = [ int ( ) ] * ( N ) NEW_LINE t = [ int ( ) ] * ( N ) NEW_LINE for i in range ( N ) : NEW_LINE INDENT c [ i ] = int ( next ( tokens ) ) NEW_LINE t [ i ] = int ( next ( tokens ) ) NEW_LINE DEDENT solve ( N , T , c , t ) NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT main ( ) NEW_LINE DEDENT


import sys NEW_LINE ans = sys . maxsize NEW_LINE N , T = map ( int , input ( ) . split ( ) ) NEW_LINE for i in range ( 0 , N ) : NEW_LINE INDENT c , t = map ( int , input ( ) . split ( ) ) NEW_LINE if t <= T : NEW_LINE INDENT ans = min ( ans , c ) NEW_LINE DEDENT DEDENT if ans == sys . maxsize : NEW_LINE INDENT print ( " TLE " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( ans ) NEW_LINE DEDENT