import java . io . FileNotFoundException ; import java . math . BigInteger ; import java . util . Arrays ; import java . util . Scanner ; class Main { public void run ( ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; int s = 0 ; for ( int i = 0 ; i < n ; ++ i ) { a [ i ] = sc . nextInt ( ) ; s += a [ i ] ; } BigInteger can = BigInteger . ONE ; for ( int i = 0 ; i < n ; ++ i ) { can = can . shiftLeft ( a [ i ] ) . or ( can ) ; } for ( int i = ( s + 1 ) / 2 ; i <= s ; ++ i ) { if ( can . testBit ( i ) ) { System . out . println ( i ) ; return ; } } } void tr ( Object ... objects ) { System . out . println ( Arrays . deepToString ( objects ) ) ; } public static void main ( String [ ] args ) throws FileNotFoundException { new Main ( ) . run ( ) ; } }


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 eps = 1.0 / 10 ** 15 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 pf ( s ) : return print ( s , flush = True ) NEW_LINE def main ( ) : NEW_LINE INDENT n = I ( ) NEW_LINE a = LI ( ) NEW_LINE s = sum ( a ) NEW_LINE t = 1 NEW_LINE m = 2 ** ( s // 2 + 1 ) - 1 NEW_LINE for c in a : NEW_LINE INDENT t |= t << c NEW_LINE DEDENT t &= m NEW_LINE return s - ( t . bit_length ( ) - 1 ) NEW_LINE DEDENT print ( main ( ) ) NEW_LINE


import math NEW_LINE N = int ( input ( ) ) NEW_LINE A = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE sumA = sum ( A ) NEW_LINE halfA = math . ceil ( sumA / 2 ) NEW_LINE bitset = 1 NEW_LINE for a in A : bitset |= bitset << a NEW_LINE bitset >>= halfA NEW_LINE i = 0 NEW_LINE while 1 : NEW_LINE INDENT if bitset & 1 : NEW_LINE INDENT print ( i + halfA ) NEW_LINE exit ( ) NEW_LINE DEDENT bitset >>= 1 NEW_LINE i += 1 NEW_LINE DEDENT


import numpy NEW_LINE n = int ( input ( ) ) NEW_LINE a = [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE dp = 1 NEW_LINE for i in range ( 0 , len ( a ) ) : NEW_LINE INDENT dp = ( dp | ( dp << a [ i ] ) ) NEW_LINE DEDENT asum = 0 NEW_LINE for i in range ( 0 , len ( a ) ) : NEW_LINE INDENT asum += a [ i ] NEW_LINE DEDENT for i in range ( int ( ( asum + 1 ) / 2 ) , asum + 1 ) : NEW_LINE INDENT if ( dp >> i ) & 1 : NEW_LINE INDENT print ( i ) NEW_LINE break NEW_LINE DEDENT DEDENT


input ( ) NEW_LINE a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE dp = 1 NEW_LINE for x in a : NEW_LINE INDENT dp |= dp << x NEW_LINE DEDENT s = sum ( a ) NEW_LINE dp >>= ( s + 1 ) // 2 NEW_LINE dp <<= ( s + 1 ) // 2 NEW_LINE dp = bin ( dp ) NEW_LINE print ( len ( dp ) - len ( dp . rstrip ( '0' ) ) ) NEW_LINE


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = Integer . parseInt ( sc . next ( ) ) ; sum += a [ i ] ; } int len = 4000001 ; BitSet bs = new BitSet ( len ) ; bs . set ( len ) ; for ( int i = 0 ; i < n ; i ++ ) { BitSet shift = bs . get ( a [ i ] , len + 1 ) ; bs . or ( shift ) ; } for ( int i = len - ( sum + 1 ) / 2 ; i > 0 ; i -- ) { if ( bs . get ( i ) ) { System . out . println ( len - i ) ; break ; } } } }

from collections import defaultdict , deque NEW_LINE import sys , heapq , bisect , math , itertools , string , queue , datetime NEW_LINE sys . setrecursionlimit ( 10 ** 8 ) NEW_LINE INF = float ( ' inf ' ) NEW_LINE mod = 10 ** 9 + 7 NEW_LINE eps = 10 ** - 7 NEW_LINE def inpl ( ) : return list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE def inpl_s ( ) : return list ( input ( ) . split ( ) ) NEW_LINE N = int ( input ( ) ) NEW_LINE aa = inpl ( ) NEW_LINE b = 1 NEW_LINE for a in aa : NEW_LINE INDENT b |= b << a NEW_LINE DEDENT S = sum ( aa ) NEW_LINE half = ( S + 1 ) // 2 NEW_LINE b >>= half NEW_LINE print ( ( b & - b ) . bit_length ( ) + half - 1 ) NEW_LINE


import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; import java . io . IOException ; import java . util . BitSet ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; MedianSum solver = new MedianSum ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class MedianSum { public void solve ( int testNumber , InputReader in , PrintWriter out ) { int N = in . nextInt ( ) ; int [ ] A = new int [ N ] ; int sum = 0 ; for ( int i = 0 ; i < N ; i ++ ) { A [ i ] = in . nextInt ( ) ; sum += A [ i ] ; } BitSet bitSet = new BitSet ( sum ) ; bitSet . set ( sum ) ; for ( int i = 0 ; i < N ; i ++ ) { bitSet . or ( bitSet . get ( A [ i ] , sum + 1 ) ) ; } out . println ( bitSet . nextSetBit ( ( sum + 1 ) / 2 ) ) ; } } static class InputReader { public BufferedReader reader ; public StringTokenizer tokenizer ; public InputReader ( InputStream stream ) { reader = new BufferedReader ( new InputStreamReader ( stream ) , 32768 ) ; tokenizer = null ; } public String next ( ) { while ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } } }


import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; sum += a [ i ] ; } BitSet bs = new BitSet ( sum + 1 ) ; bs . set ( sum ) ; for ( int i = 0 ; i < n ; i ++ ) { BitSet cur = bs . get ( a [ i ] , sum + 1 ) ; bs . or ( cur ) ; } int ini = sum % 2 == 0 ? sum / 2 : ( sum + 1 ) / 2 ; for ( int i = ini ; i <= sum ; i ++ ) { if ( bs . get ( i ) ) { System . out . println ( i ) ; break ; } } } }


import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double A = ( double ) ( sc . nextInt ( ) ) ; double B = ( double ) ( sc . nextInt ( ) ) ; double C = ( double ) ( sc . nextInt ( ) ) ; double PI = 3.1415926535897932384626d ; double min = 0d ; double max = 100d ; while ( Math . abs ( A * min + B * Math . sin ( C * PI * min ) - 100d ) > 0.0000001 ) { double middle = ( min + max ) / 2 ; if ( A * middle + B * Math . sin ( C * PI * middle ) - 100d < 0 ) { min = middle ; } else { max = middle ; } } System . out . println ( min ) ; } }

import sys NEW_LINE stdin = sys . stdin NEW_LINE sys . setrecursionlimit ( 10 ** 5 ) NEW_LINE def li ( ) : return map ( int , stdin . readline ( ) . split ( ) ) NEW_LINE def li_ ( ) : return map ( lambda x : int ( x ) - 1 , stdin . readline ( ) . split ( ) ) NEW_LINE def lf ( ) : return map ( float , stdin . readline ( ) . split ( ) ) NEW_LINE def ls ( ) : return stdin . readline ( ) . split ( ) NEW_LINE def ns ( ) : return stdin . readline ( ) . rstrip ( ) NEW_LINE def lc ( ) : return list ( ns ( ) ) NEW_LINE def ni ( ) : return int ( stdin . readline ( ) ) NEW_LINE def nf ( ) : return float ( stdin . readline ( ) ) NEW_LINE from math import sin , pi NEW_LINE def ev ( a , b , c , t ) : NEW_LINE INDENT return a * t + b * sin ( pi * c * t ) NEW_LINE DEDENT a , b , c = li ( ) NEW_LINE prev = 0 NEW_LINE while prev + ( 1 / 2 * c ) < ( 100 - b ) / a : NEW_LINE INDENT prev += 1 / ( 2 * c ) NEW_LINE DEDENT cur = prev + 1 / ( 2 * c ) NEW_LINE while ( 100 - ev ( a , b , c , prev ) ) * ( 100 - ev ( a , b , c , cur ) ) > 0 : NEW_LINE INDENT prev += 1 / ( 2 * c ) NEW_LINE cur += 1 / ( 2 * c ) NEW_LINE DEDENT left = prev NEW_LINE right = cur NEW_LINE pl = True NEW_LINE if ev ( a , b , c , left ) < ev ( a , b , c , right ) : NEW_LINE INDENT pl = True NEW_LINE DEDENT else : NEW_LINE INDENT pl = False NEW_LINE DEDENT eps = 1 / ( 10 ** 10 ) NEW_LINE while right - left > eps : NEW_LINE INDENT mid = ( right + left ) / 2 NEW_LINE if ev ( a , b , c , mid ) > 100 : NEW_LINE INDENT if pl : NEW_LINE INDENT right = mid NEW_LINE DEDENT else : NEW_LINE INDENT left = mid NEW_LINE DEDENT DEDENT else : NEW_LINE INDENT if pl : NEW_LINE INDENT left = mid NEW_LINE DEDENT else : NEW_LINE INDENT right = mid NEW_LINE DEDENT DEDENT DEDENT print ( mid ) NEW_LINE


from scipy import optimize NEW_LINE import numpy as np NEW_LINE np . set_printoptions ( precision = 15 ) NEW_LINE a , b , c = map ( int , input ( ) . split ( ) ) NEW_LINE def f ( x ) : NEW_LINE INDENT return a * x + b * np . sin ( c * np . pi * x ) - 100 NEW_LINE DEDENT ans = optimize . newton ( f , 0 ) NEW_LINE print ( ans ) NEW_LINE


import sys NEW_LINE input = sys . stdin . readline NEW_LINE import math NEW_LINE a , b , c = map ( int , input ( ) . split ( ) ) NEW_LINE def f ( t ) : NEW_LINE INDENT return a * t + b * math . sin ( c * t * math . pi ) NEW_LINE DEDENT left = 0 NEW_LINE right = 10000 NEW_LINE while abs ( f ( right ) - 100 ) > 10 ** ( - 6 ) : NEW_LINE INDENT mid = ( left + right ) / 2 NEW_LINE f_mid = f ( mid ) NEW_LINE if f_mid >= 100 : NEW_LINE INDENT right = mid NEW_LINE DEDENT else : NEW_LINE INDENT left = mid NEW_LINE DEDENT DEDENT print ( right ) NEW_LINE


import math NEW_LINE def takahashi_ball1 ( A : int , B : int , C : int ) -> float : NEW_LINE INDENT E = 10 ** ( - 6 ) NEW_LINE def f ( t : float ) -> float : NEW_LINE INDENT return A * t + B * math . sin ( C * t * math . pi ) NEW_LINE DEDENT def newton ( ta : float , tb : float , g ) -> float : NEW_LINE INDENT if g ( tb ) < 0 : NEW_LINE INDENT ta , tb = tb , ta NEW_LINE DEDENT while True : NEW_LINE INDENT m = ( ta + tb ) / 2 NEW_LINE if abs ( g ( m ) ) < E : NEW_LINE INDENT return m NEW_LINE DEDENT if g ( m ) < 0 : NEW_LINE INDENT ta = m NEW_LINE DEDENT else : NEW_LINE INDENT tb = m NEW_LINE DEDENT DEDENT DEDENT ta = 0 NEW_LINE k = 0 NEW_LINE while True : NEW_LINE INDENT tb = ta NEW_LINE ta = ( 2 * k + 1 ) // ( 2 * C ) NEW_LINE if ( f ( tb ) - 100 ) * ( f ( ta ) - 100 ) < 0 : NEW_LINE INDENT return newton ( ta , tb , lambda x : f ( x ) - 100 ) NEW_LINE DEDENT elif ( f ( tb ) - 100 ) * ( f ( ta ) - 100 ) <= E * E : NEW_LINE INDENT if abs ( f ( tb ) - 100 ) <= E : NEW_LINE INDENT return tb NEW_LINE DEDENT if abs ( f ( ta ) - 100 ) <= E : NEW_LINE INDENT return ta NEW_LINE DEDENT DEDENT else : NEW_LINE INDENT k += 1 NEW_LINE DEDENT DEDENT DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT A , B , C = map ( int , input ( ) . split ( ) ) NEW_LINE ans = takahashi_ball1 ( A , B , C ) NEW_LINE print ( ans ) NEW_LINE DEDENT


from math import pi NEW_LINE from math import sin NEW_LINE import sys NEW_LINE sys . setrecursionlimit ( 10 ** 9 ) NEW_LINE input = sys . stdin . readline NEW_LINE A , B , C = map ( int , input ( ) . split ( ) ) NEW_LINE def f ( t ) : NEW_LINE INDENT return A * t + B * sin ( C * t * pi ) - 100 NEW_LINE DEDENT e = 10 ** ( - 7 ) NEW_LINE def check ( y ) : NEW_LINE INDENT if abs ( y ) <= e : NEW_LINE INDENT return True NEW_LINE DEDENT else : NEW_LINE INDENT False NEW_LINE DEDENT DEDENT lower = 0 NEW_LINE upper = 100 NEW_LINE mid = ( lower + upper ) / 2 NEW_LINE for _ in range ( 10 ** 4 ) : NEW_LINE INDENT mid = ( upper + lower ) / 2 NEW_LINE yl = f ( lower ) NEW_LINE ym = f ( mid ) NEW_LINE yu = f ( upper ) NEW_LINE if yl * ym >= 0 : NEW_LINE INDENT lower = mid NEW_LINE DEDENT else : NEW_LINE INDENT upper = mid NEW_LINE DEDENT DEDENT print ( mid ) NEW_LINE


import java . util . Scanner ; public class Main { private static double eps = 1e-9 ; private static double f ( int a , int b , int c , double x ) { return a * x + b * Math . sin ( c * x * Math . PI ) ; } public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int a = Integer . parseInt ( sc . next ( ) ) ; int b = Integer . parseInt ( sc . next ( ) ) ; int c = Integer . parseInt ( sc . next ( ) ) ; double left = 0.0 , right = 1000.0 ; for ( int i = 0 ; i < 100 ; i ++ ) { double mid = ( left + right ) / 2 ; if ( f ( a , b , c , mid ) - 100 > eps ) { right = mid ; } else { left = mid ; } } System . out . println ( left ) ; } }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class Main { int a , b , c ; public static void main ( String args [ ] ) { new Main ( ) . run ( ) ; } void run ( ) { FastReader sc = new FastReader ( ) ; a = sc . nextInt ( ) ; b = sc . nextInt ( ) ; c = sc . nextInt ( ) ; solve ( ) ; } void solve ( ) { double low = 0 ; double high = 100 ; int count = 0 ; while ( count < 10000 ) { double mid = ( low + high ) / 2 ; double value = f ( mid ) ; if ( value >= 100 ) { high = mid ; } else { low = mid ; } count ++ ; } System . out . println ( low ) ; } double f ( double t ) { return a * t + b * Math . sin ( c * t * Math . PI ) ; } static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } }


import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; import java . util . function . DoubleUnaryOperator ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; D1 solver = new D1 ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class D1 { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int a = in . nextInt ( ) , b = in . nextInt ( ) , c = in . nextInt ( ) ; DoubleUnaryOperator calc = t -> a * t + b * Math . sin ( c * t * Math . PI ) ; double min = 0.0 , max = 128.0 ; while ( max - min > 1e-12 ) { double mid = ( min + max ) / 2.0 ; if ( calc . applyAsDouble ( mid ) > 100 ) { max = mid ; } else { min = mid ; } } out . println ( max ) ; } } }


import java . util . Scanner ; import java . util . stream . IntStream ; public class Main { static Scanner s = new Scanner ( System . in ) ; static int getInt ( ) { return Integer . parseInt ( s . next ( ) ) ; } static IntStream REPS ( int v ) { return IntStream . range ( 0 , v ) ; } static IntStream REPS ( int l , int r ) { return IntStream . rangeClosed ( l , r ) ; } static IntStream INS ( int n ) { return REPS ( n ) . map ( i -> getInt ( ) ) ; } static class Pair < T , U > { T l ; U r ; Pair ( T L , U R ) { l = L ; r = R ; } T getL ( ) { return l ; } U getR ( ) { return r ; } } static final int a = getInt ( ) , b = getInt ( ) , c = getInt ( ) ; public static void main ( String [ ] $ ) { double d = 1 , t = 0 ; while ( true ) { if ( f ( d + t ) < 100 ) t += d ; else d /= 10 ; if ( Math . abs ( f ( t ) - 100 ) <= 0.000001 ) break ; } System . out . println ( t ) ; } static double f ( double t ) { return t * a + Math . sin ( t * c * Math . PI ) * b ; } }


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 ( ) ; int m = sc . nextInt ( ) ; int ans = 1 ; for ( int i = 0 ; i < n ; i ++ ) { if ( ans < m ) ans *= 2 ; else ans += m ; } System . out . println ( ans ) ; } }

N = int ( input ( ) ) NEW_LINE K = int ( input ( ) ) NEW_LINE ans = 1 NEW_LINE for i in range ( N ) : NEW_LINE INDENT a = 2 * ans NEW_LINE b = ans + K NEW_LINE ans = min ( a , b ) NEW_LINE DEDENT print ( ans ) NEW_LINE


n , k = map ( int , open ( 0 ) ) ; r = 1 ; exec ( ' r + = min ( r , k ) ; ' * n ) ; print ( r ) NEW_LINE


import sys NEW_LINE sys . setrecursionlimit ( 10 ** 7 ) NEW_LINE INF = 10 ** 18 NEW_LINE MOD = 10 ** 9 + 7 NEW_LINE def POW ( x , y ) : NEW_LINE INDENT if y == 0 : NEW_LINE INDENT return 1 NEW_LINE DEDENT elif y == 1 : NEW_LINE INDENT return x NEW_LINE DEDENT elif y % 2 == 0 : NEW_LINE INDENT return POW ( x , y // 2 ) ** 2 % MOD NEW_LINE DEDENT else : NEW_LINE INDENT return POW ( x , y // 2 ) ** 2 * x % MOD NEW_LINE DEDENT DEDENT def mod_factorial ( x , y ) : return x * POW ( y , MOD - 2 ) % MOD 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 II ( ) : return int ( sys . stdin . readline ( ) ) NEW_LINE def SI ( ) : return input ( ) NEW_LINE from functools import reduce NEW_LINE def main ( ) : NEW_LINE INDENT N = II ( ) NEW_LINE K = II ( ) NEW_LINE ans = 1 NEW_LINE for _ in range ( N ) : NEW_LINE INDENT if ans < K : NEW_LINE INDENT ans *= 2 NEW_LINE DEDENT else : NEW_LINE INDENT ans += K NEW_LINE DEDENT DEDENT return ans NEW_LINE DEDENT print ( main ( ) ) NEW_LINE


n = int ( input ( ) ) NEW_LINE k = int ( input ( ) ) NEW_LINE dp = [ [ 0 , 0 ] for i in range ( n + 1 ) ] NEW_LINE dp [ 0 ] [ 0 ] = 1 NEW_LINE dp [ 0 ] [ 1 ] = 1 NEW_LINE for i in range ( 1 , n + 1 ) : NEW_LINE INDENT dp [ i ] [ 0 ] = min ( dp [ i - 1 ] [ 0 ] , dp [ i - 1 ] [ 1 ] ) * 2 NEW_LINE dp [ i ] [ 1 ] = min ( dp [ i - 1 ] [ 0 ] , dp [ i - 1 ] [ 1 ] ) + k NEW_LINE DEDENT print ( min ( dp [ n ] [ 0 ] , dp [ n ] [ 1 ] ) ) NEW_LINE


num = 1 NEW_LINE n = int ( input ( ) ) NEW_LINE k = int ( input ( ) ) NEW_LINE while num <= k and n : NEW_LINE INDENT num *= 2 NEW_LINE n -= 1 NEW_LINE DEDENT while n : NEW_LINE INDENT num += k NEW_LINE n -= 1 NEW_LINE DEDENT print ( num ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( input . readLine ( ) ) ; int k = Integer . parseInt ( input . readLine ( ) ) ; System . out . println ( calc ( n , 1 , k , 1 ) ) ; } public static int calc ( int k , int count , int incrementValue , int sum ) { if ( count > k ) { return sum ; } return Math . min ( calc ( k , count + 1 , incrementValue , sum * 2 ) , calc ( k , count + 1 , incrementValue , sum + incrementValue ) ) ; } }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . OutputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; Task solver = new Task ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class Task { public void solve ( int testNumber , InputReader in , PrintWriter out ) { int N = in . nextInt ( ) ; int K = in . nextInt ( ) ; int ans = 1 ; for ( int i = 0 ; i < N ; i ++ ) { ans = Math . min ( ans * 2 , ans + K ) ; } 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 . * ; class Main { static Scanner sc = new Scanner ( System . in ) ; static int mod = 1000000007 ; public static void main ( String [ ] args ) { int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int ans = 1 ; for ( int i = 0 ; i < n ; i ++ ) { ans = Math . min ( ans + k , 2 * ans ) ; } System . out . println ( ans ) ; } }


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 K = sc . nextInt ( ) ; int ans = 1 ; while ( N > 0 ) { ans += Math . min ( ans , K ) ; N -- ; } System . out . println ( ans ) ; } }


import java . util . Scanner ; public class Main { private static int findSumOfDigit ( int n ) { int sum = 0 ; while ( n > 0 ) { sum += n % 10 ; n /= 10 ; } return sum ; } public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = Integer . parseInt ( scan . next ( ) ) ; int sumOfDigit = findSumOfDigit ( n ) ; System . out . println ( n % sumOfDigit == 0 ? " Yes " : " No " ) ; } }

n = input ( ) NEW_LINE print ( " Yes " if int ( n ) % sum ( map ( int , n ) ) == 0 else " No " ) NEW_LINE


def n ( num ) : NEW_LINE INDENT ret = 0 NEW_LINE for i in range ( 10 ) : NEW_LINE INDENT ret += int ( ( num % ( 10 ** ( i + 1 ) ) ) / ( 10 ** i ) ) NEW_LINE DEDENT return ret NEW_LINE DEDENT a = int ( input ( ) ) NEW_LINE if a % n ( a ) == 0 : NEW_LINE INDENT print ( ' Yes ' ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( ' No ' ) NEW_LINE DEDENT


N = int ( input ( ) ) NEW_LINE n = N NEW_LINE tmp = 0 NEW_LINE while 1 : NEW_LINE INDENT tmp += n % 10 NEW_LINE n = int ( n / 10 ) NEW_LINE if n == 0 : NEW_LINE INDENT break NEW_LINE DEDENT DEDENT print ( ' Yes ' if N % tmp == 0 else ' No ' ) NEW_LINE


n = input ( ) . rstrip ( ) NEW_LINE keta_sum = sum ( [ int ( item ) for item in n ] ) NEW_LINE if int ( n ) % keta_sum == 0 : NEW_LINE INDENT print ( " Yes " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " No " ) NEW_LINE DEDENT


N = int ( input ( ) ) NEW_LINE result = [ ] NEW_LINE memo = N NEW_LINE while memo > 0 : NEW_LINE INDENT result . append ( memo % 10 ) NEW_LINE memo //= 10 NEW_LINE DEDENT if N % sum ( result ) == 0 : NEW_LINE INDENT print ( " Yes " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " No " ) NEW_LINE DEDENT


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 % getSum ( n ) == 0 ? " Yes " : " No " ) ; } public static int getSum ( int n ) { int sum = 0 ; while ( n > 9 ) { sum += n % 10 ; n /= 10 ; } if ( n > 0 ) sum += n ; return sum ; } }


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int n = a ; int [ ] array = new int [ 8 ] ; int b = 10 ; int sum = 0 ; for ( int i = 0 ; i < 8 ; i ++ ) { array [ i ] = a % b ; a -= array [ i ] ; sum += array [ i ] / ( b / 10 ) ; b *= 10 ; } if ( n % sum == 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } }


import java . util . ArrayList ; import java . util . Collections ; import java . util . Comparator ; import java . util . HashSet ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int initialN = n ; int x = 0 ; while ( n % 10 != 0 ) { x += n % 10 ; n /= 10 ; } if ( initialN % x == 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } }


import java . util . * ; class Main { public static int findSumOfDigits ( int n ) { int sum = 0 ; while ( n > 0 ) { sum += n % 10 ; n = n / 10 ; } return sum ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . next ( ) ) ; int sum = findSumOfDigits ( N ) ; if ( N % sum == 0 ) { System . out . print ( " Yes " ) ; } else { System . out . print ( " No " ) ; } } }


import java . util . Scanner ; public class Main { static int N , A , B , C ; static int [ ] l ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; N = sc . nextInt ( ) ; A = sc . nextInt ( ) ; B = sc . nextInt ( ) ; C = sc . nextInt ( ) ; l = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { l [ i ] = sc . nextInt ( ) ; } System . out . println ( cost ( 0 , 0 , 0 , 0 ) ) ; sc . close ( ) ; } static int cost ( int depth , int a , int b , int c ) { int INF = ( int ) 10e8 ; int pattern0 , pattern1 , pattern2 , pattern3 ; if ( depth == N ) { if ( a > 0 && b > 0 && c > 0 ) { return Math . abs ( a - A ) + Math . abs ( b - B ) + Math . abs ( c - C ) - 30 ; } else { return INF ; } } pattern0 = cost ( depth + 1 , a , b , c ) ; pattern1 = cost ( depth + 1 , a + l [ depth ] , b , c ) + 10 ; pattern2 = cost ( depth + 1 , a , b + l [ depth ] , c ) + 10 ; pattern3 = cost ( depth + 1 , a , b , c + l [ depth ] ) + 10 ; return Math . min ( Math . min ( pattern0 , pattern1 ) , Math . min ( pattern2 , pattern3 ) ) ; } Main ( ) { } }

N , A , B , C = [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE L = [ int ( input ( ) ) for i in range ( N ) ] NEW_LINE def dfs ( idx , a , b , c ) : NEW_LINE INDENT if idx == N : NEW_LINE INDENT if a == 0 or b == 0 or c == 0 : NEW_LINE INDENT return 1e9 NEW_LINE DEDENT return abs ( A - a ) + abs ( B - b ) + abs ( C - c ) NEW_LINE DEDENT x = dfs ( idx + 1 , a , b , c ) NEW_LINE y = dfs ( idx + 1 , a + L [ idx ] , b , c ) + 10 * ( a != 0 ) NEW_LINE z = dfs ( idx + 1 , a , b + L [ idx ] , c ) + 10 * ( b != 0 ) NEW_LINE w = dfs ( idx + 1 , a , b , c + L [ idx ] ) + 10 * ( c != 0 ) NEW_LINE return min ( x , y , z , w ) ; NEW_LINE DEDENT ans = dfs ( 0 , 0 , 0 , 0 ) ; NEW_LINE print ( ans ) NEW_LINE


import sys NEW_LINE def solve ( N : int , A : int , B : int , C : int , l : " List [ int ] " ) : NEW_LINE INDENT result = 10000000000 NEW_LINE for i in range ( 2 ** ( N * 2 ) - 1 ) : NEW_LINE INDENT bitBase = i | 2 ** ( N * 2 ) NEW_LINE debug = False NEW_LINE mergeCost = 0 NEW_LINE a = 0 NEW_LINE b = 0 NEW_LINE c = 0 NEW_LINE invalid = False NEW_LINE debugStr = " " NEW_LINE for j in range ( N ) : NEW_LINE INDENT flag = ( ( 3 << ( j * 2 ) ) & bitBase ) >> ( j * 2 ) NEW_LINE if flag == 1 : NEW_LINE INDENT if a != 0 : NEW_LINE INDENT mergeCost += 10 NEW_LINE DEDENT if debug : NEW_LINE INDENT debugStr += " A " NEW_LINE DEDENT a += l [ j ] NEW_LINE DEDENT elif flag == 2 : NEW_LINE INDENT if b != 0 : NEW_LINE INDENT mergeCost += 10 NEW_LINE DEDENT if debug : NEW_LINE INDENT debugStr += " B " NEW_LINE DEDENT b += l [ j ] NEW_LINE DEDENT elif flag == 3 : NEW_LINE INDENT if c != 0 : NEW_LINE INDENT mergeCost += 10 NEW_LINE DEDENT if debug : NEW_LINE INDENT debugStr += " C " NEW_LINE DEDENT c += l [ j ] NEW_LINE DEDENT else : NEW_LINE INDENT if debug : NEW_LINE INDENT debugStr += " X " NEW_LINE DEDENT DEDENT DEDENT if a == 0 or b == 0 or c == 0 : NEW_LINE INDENT continue NEW_LINE DEDENT cost = mergeCost + abs ( A - a ) + abs ( B - b ) + abs ( C - c ) NEW_LINE if debug : NEW_LINE INDENT print ( debugStr ) NEW_LINE DEDENT result = min ( cost , result ) NEW_LINE DEDENT print ( result ) NEW_LINE 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 A = int ( next ( tokens ) ) NEW_LINE B = int ( next ( tokens ) ) NEW_LINE C = int ( next ( tokens ) ) NEW_LINE l = [ int ( next ( tokens ) ) for _ in range ( N ) ] NEW_LINE solve ( N , A , B , C , l ) NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT main ( ) NEW_LINE DEDENT


def Base_10_to_n ( X , n ) : NEW_LINE INDENT if ( int ( X / n ) ) : NEW_LINE INDENT return Base_10_to_n ( int ( X / n ) , n ) + str ( X % n ) NEW_LINE DEDENT return str ( X % n ) NEW_LINE DEDENT def scorecalc ( a , target ) : NEW_LINE INDENT if len ( a ) == 0 : NEW_LINE INDENT ans = 10 ** 9 NEW_LINE DEDENT else : NEW_LINE INDENT ans = 10 * ( len ( a ) - 1 ) NEW_LINE ans += abs ( sum ( a ) - target ) NEW_LINE DEDENT return ans NEW_LINE DEDENT n , a , b , c = map ( int , input ( ) . split ( ) ) NEW_LINE l = [ ] NEW_LINE for i in range ( n ) : NEW_LINE INDENT temp = int ( input ( ) ) NEW_LINE l . append ( temp ) NEW_LINE DEDENT mnm = 10 ** 9 NEW_LINE for i in range ( 1 , 4 ** n + 1 ) : NEW_LINE INDENT test = Base_10_to_n ( i , 4 ) NEW_LINE test = list ( test ) NEW_LINE for k in range ( n - len ( test ) ) : NEW_LINE INDENT test . insert ( 0 , "0" ) NEW_LINE DEDENT fora = [ ] NEW_LINE forb = [ ] NEW_LINE forc = [ ] NEW_LINE for k in range ( n ) : NEW_LINE INDENT if test [ k ] == "0" : NEW_LINE INDENT fora . append ( l [ k ] ) NEW_LINE DEDENT elif test [ k ] == "1" : NEW_LINE INDENT forb . append ( l [ k ] ) NEW_LINE DEDENT elif test [ k ] == "2" : NEW_LINE INDENT forc . append ( l [ k ] ) NEW_LINE DEDENT DEDENT temp = scorecalc ( fora , a ) + scorecalc ( forb , b ) + scorecalc ( forc , c ) NEW_LINE if temp < mnm : NEW_LINE INDENT mnm = temp NEW_LINE DEDENT DEDENT print ( mnm ) NEW_LINE


N , A , B , C = map ( int , input ( ) . split ( ) ) NEW_LINE bamboos = [ ] NEW_LINE for _ in range ( N ) : NEW_LINE INDENT l = int ( input ( ) ) NEW_LINE bamboos . append ( l ) NEW_LINE DEDENT import copy NEW_LINE def dfs ( i , bs ) : NEW_LINE INDENT if i == len ( bamboos ) : NEW_LINE INDENT if not bs [ ' A ' ] or not bs [ ' B ' ] or not bs [ ' C ' ] : NEW_LINE INDENT return [ ] NEW_LINE DEDENT return [ bs ] NEW_LINE DEDENT ret = [ ] NEW_LINE tmp = copy . deepcopy ( bs ) NEW_LINE tmp [ ' A ' ] . append ( bamboos [ i ] ) NEW_LINE ret . extend ( dfs ( i + 1 , tmp ) ) NEW_LINE tmp = copy . deepcopy ( bs ) NEW_LINE tmp [ ' B ' ] . append ( bamboos [ i ] ) NEW_LINE ret . extend ( dfs ( i + 1 , tmp ) ) NEW_LINE tmp = copy . deepcopy ( bs ) NEW_LINE tmp [ ' C ' ] . append ( bamboos [ i ] ) NEW_LINE ret . extend ( dfs ( i + 1 , tmp ) ) NEW_LINE tmp = copy . deepcopy ( bs ) NEW_LINE tmp [ ' D ' ] . append ( bamboos [ i ] ) NEW_LINE ret . extend ( dfs ( i + 1 , tmp ) ) NEW_LINE return ret NEW_LINE DEDENT ABC = { ' A ' : A , ' B ' : B , ' C ' : C } NEW_LINE bs_comb = dfs ( 0 , { ' A ' : [ ] , ' B ' : [ ] , ' C ' : [ ] , ' D ' : [ ] } ) NEW_LINE import sys NEW_LINE ans = sys . maxsize NEW_LINE for bs in bs_comb : NEW_LINE INDENT cost = 0 NEW_LINE for abc in [ ' A ' , ' B ' , ' C ' ] : NEW_LINE INDENT cost += ( len ( bs [ abc ] ) - 1 ) * 10 NEW_LINE cost += abs ( sum ( bs [ abc ] ) - ABC [ abc ] ) NEW_LINE DEDENT ans = min ( ans , cost ) NEW_LINE DEDENT print ( ans ) NEW_LINE


from itertools import product NEW_LINE n , a , b , c = map ( int , input ( ) . split ( ) ) NEW_LINE l = [ int ( input ( ) ) for i in range ( n ) ] NEW_LINE x = list ( product ( [ 0 , 1 , 2 , 3 ] , repeat = n ) ) NEW_LINE ans = 10 ** 10 NEW_LINE for i in range ( len ( x ) ) : NEW_LINE INDENT if x [ i ] . count ( 1 ) == 0 or x [ i ] . count ( 2 ) == 0 or x [ i ] . count ( 3 ) == 0 : NEW_LINE INDENT continue NEW_LINE DEDENT tmpa = 0 NEW_LINE tmpb = 0 NEW_LINE tmpc = 0 NEW_LINE for j in range ( n ) : NEW_LINE INDENT if x [ i ] [ j ] == 1 : NEW_LINE INDENT tmpa += l [ j ] NEW_LINE DEDENT if x [ i ] [ j ] == 2 : NEW_LINE INDENT tmpb += l [ j ] NEW_LINE DEDENT if x [ i ] [ j ] == 3 : NEW_LINE INDENT tmpc += l [ j ] NEW_LINE DEDENT DEDENT tmpans = abs ( a - tmpa ) + abs ( b - tmpb ) + abs ( c - tmpc ) NEW_LINE tmpans += ( x [ i ] . count ( 1 ) - 1 ) * 10 + ( x [ i ] . count ( 2 ) - 1 ) * 10 + ( x [ i ] . count ( 3 ) - 1 ) * 10 NEW_LINE ans = min ( ans , tmpans ) NEW_LINE DEDENT print ( ans ) NEW_LINE


import java . util . * ; import static java . lang . System . * ; public class Main { public static int A ; public static int B ; public static int C ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; A = sc . nextInt ( ) ; B = sc . nextInt ( ) ; C = sc . nextInt ( ) ; int [ ] l = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { l [ i ] = sc . nextInt ( ) ; } out . println ( calMin ( 0 , 0 , 0 , l , 0 , 0 ) ) ; } public static int calMin ( int a , int b , int c , int [ ] l , int i , int cost ) { if ( i == l . length ) { if ( a == 0 || b == 0 || c == 0 ) { return Integer . MAX_VALUE ; } else { return cost + Math . abs ( A - a ) + Math . abs ( B - b ) + Math . abs ( C - c ) - 30 ; } } return Math . min ( Math . min ( calMin ( a + l [ i ] , b , c , l , i + 1 , cost + 10 ) , calMin ( a , b + l [ i ] , c , l , i + 1 , cost + 10 ) ) , Math . min ( calMin ( a , b , c + l [ i ] , l , i + 1 , cost + 10 ) , calMin ( a , b , c , l , i + 1 , cost ) ) ) ; } }


import java . util . stream . IntStream ; public class Main { private static java . util . Scanner scanner = new java . util . Scanner ( System . in ) ; private static int n , a , b , c , l [ ] ; public static void main ( String [ ] args ) { n = scanner . nextInt ( ) ; a = scanner . nextInt ( ) ; b = scanner . nextInt ( ) ; c = scanner . nextInt ( ) ; l = IntStream . range ( 0 , n ) . map ( i -> scanner . nextInt ( ) ) . toArray ( ) ; System . out . println ( dfs ( 0 , 0 , 0 , 0 ) ) ; } private static int dfs ( int cur , int a0 , int b0 , int c0 ) { if ( cur == n ) return ( Math . min ( Math . min ( a0 , b0 ) , c0 ) > 0 ? Math . abs ( a0 - a ) + Math . abs ( b0 - b ) + Math . abs ( c0 - c ) - 30 : 1000000000 ) ; int ret0 = dfs ( cur + 1 , a0 , b0 , c0 ) ; int ret1 = dfs ( cur + 1 , a0 + l [ cur ] , b0 , c0 ) + 10 ; int ret2 = dfs ( cur + 1 , a0 , b0 + l [ cur ] , c0 ) + 10 ; int ret3 = dfs ( cur + 1 , a0 , b0 , c0 + l [ cur ] ) + 10 ; return Math . min ( Math . min ( Math . min ( ret0 , ret1 ) , ret2 ) , ret3 ) ; } }


import java . util . Scanner ; public class Main { int N ; int A ; int B ; int C ; int imihu ; int [ ] list ; public static void main ( String [ ] args ) { Main main = new Main ( ) ; main . solve ( ) ; } private void solve ( ) { Scanner sc = new Scanner ( System . in ) ; N = sc . nextInt ( ) ; A = sc . nextInt ( ) ; B = sc . nextInt ( ) ; C = sc . nextInt ( ) ; list = new int [ N ] ; for ( int index = 0 ; index < N ; index ++ ) { list [ index ] = sc . nextInt ( ) ; } imihu = ( int ) Math . pow ( 10 , 9 ) ; int answer = calculate ( 0 , 0 , 0 , 0 ) ; System . out . println ( answer ) ; } private int calculate ( int nowTake , int aTake , int bTake , int cTake ) { if ( nowTake == N ) { int min = aTake ; if ( min > bTake ) { min = bTake ; } if ( min > cTake ) { min = cTake ; } if ( min > 0 ) { return Math . abs ( A - aTake ) + Math . abs ( B - bTake ) + Math . abs ( C - cTake ) - 30 ; } else { return imihu ; } } int first = calculate ( nowTake + 1 , aTake , bTake , cTake ) ; int second = calculate ( nowTake + 1 , aTake + list [ nowTake ] , bTake , cTake ) + 10 ; int third = calculate ( nowTake + 1 , aTake , bTake + list [ nowTake ] , cTake ) + 10 ; int fourth = calculate ( nowTake + 1 , aTake , bTake , cTake + list [ nowTake ] ) + 10 ; int min = first ; if ( min > second ) { min = second ; } if ( min > third ) { min = third ; } if ( min > fourth ) { min = fourth ; } return min ; } }


import java . util . * ; import static java . lang . Math . * ; public class Main { static int A , B , C , N ; static int [ ] L ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; N = sc . nextInt ( ) ; L = new int [ N ] ; A = sc . nextInt ( ) ; B = sc . nextInt ( ) ; C = sc . nextInt ( ) ; int i ; for ( i = 0 ; i < N ; i ++ ) { L [ i ] = sc . nextInt ( ) ; } sc . close ( ) ; sc = null ; System . out . println ( calmp ( 0 , 0 , 0 , 0 ) ) ; } static int calmp ( int n , int a , int b , int c ) { if ( n == N ) { return ( min ( min ( a , b ) , c ) > 0 ) ? ( abs ( A - a ) + abs ( B - b ) + abs ( C - c ) - 30 ) : 3000 ; } int mp0 = calmp ( n + 1 , a , b , c ) ; int mp1 = calmp ( n + 1 , a + L [ n ] , b , c ) + 10 ; int mp2 = calmp ( n + 1 , a , b + L [ n ] , c ) + 10 ; int mp3 = calmp ( n + 1 , a , b , c + L [ n ] ) + 10 ; return min ( min ( mp0 , mp1 ) , min ( mp2 , mp3 ) ) ; } }


import java . util . * ; public class Main { static long mod = 1000000000 + 7 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( ( sc . next ( ) ) ) ; int [ ] [ ] box = new int [ n ] [ ] ; for ( int i = 0 ; i < n ; i ++ ) { int w = Integer . parseInt ( ( sc . next ( ) ) ) ; int h = Integer . parseInt ( ( sc . next ( ) ) ) ; box [ i ] = new int [ ] { w , h } ; } Arrays . sort ( box , new myComparator ( ) ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = box [ i ] [ 1 ] ; int ans = LIS ( a ) ; System . out . println ( ans ) ; } static int LIS ( int [ ] a ) { int n = a . length ; int [ ] max = new int [ n + 1 ] ; Arrays . fill ( max , Integer . MAX_VALUE / 2 ) ; for ( int i = 0 ; i < n ; i ++ ) { int idx = Arrays . binarySearch ( max , a [ i ] ) ; if ( idx >= 0 ) continue ; idx = - ( idx + 1 ) ; max [ idx ] = Math . min ( a [ i ] , max [ idx ] ) ; } for ( int i = n ; i >= 0 ; i -- ) { if ( max [ i ] < Integer . MAX_VALUE / 2 ) return i + 1 ; } return 1 ; } static class myComparator implements Comparator < int [ ] > { public int compare ( int [ ] a , int [ ] b ) { if ( a [ 0 ] == b [ 0 ] ) return b [ 1 ] - a [ 1 ] ; else return a [ 0 ] - b [ 0 ] ; } } }

N = int ( input ( ) ) NEW_LINE S = [ ] NEW_LINE for _ in range ( N ) : NEW_LINE INDENT w , h = map ( int , input ( ) . split ( ) ) NEW_LINE S . append ( ( w , h ) ) NEW_LINE DEDENT S . sort ( key = lambda x : x [ 0 ] , reverse = True ) NEW_LINE S . sort ( key = lambda x : x [ 1 ] ) NEW_LINE import bisect NEW_LINE DP = [ ] NEW_LINE for i in range ( N ) : NEW_LINE INDENT wi , hi = S [ i ] NEW_LINE idx = bisect . bisect_left ( DP , wi ) NEW_LINE if len ( DP ) == idx : NEW_LINE INDENT DP . append ( wi ) NEW_LINE DEDENT else : NEW_LINE INDENT DP [ idx ] = wi NEW_LINE DEDENT DEDENT print ( len ( DP ) ) NEW_LINE


import bisect NEW_LINE class BITree : NEW_LINE INDENT def __init__ ( self , n ) : NEW_LINE INDENT self . size = n NEW_LINE self . tree = [ 0 ] * ( n + 1 ) NEW_LINE DEDENT def query ( self , i ) : NEW_LINE INDENT s = 0 NEW_LINE while i > 0 : NEW_LINE INDENT s = max ( self . tree [ i ] , s ) NEW_LINE i -= i & - i NEW_LINE DEDENT return s NEW_LINE DEDENT def update ( self , i , x ) : NEW_LINE INDENT while i <= self . size : NEW_LINE INDENT self . tree [ i ] = max ( self . tree [ i ] , x ) NEW_LINE i += i & - i NEW_LINE DEDENT DEDENT DEDENT N = int ( input ( ) ) NEW_LINE X = [ ] NEW_LINE for i in range ( N ) : NEW_LINE INDENT h , w = map ( int , input ( ) . split ( ) ) NEW_LINE X . append ( ( h , - w ) ) NEW_LINE DEDENT X . sort ( ) NEW_LINE h0 = [ i [ 0 ] for i in X ] NEW_LINE w0 = [ - i [ 1 ] for i in X ] NEW_LINE h1 = sorted ( list ( set ( h0 ) ) ) NEW_LINE w1 = sorted ( list ( set ( w0 ) ) ) NEW_LINE h = [ bisect . bisect_left ( h1 , t ) + 1 for t in h0 ] NEW_LINE w = [ bisect . bisect_left ( w1 , t ) + 1 for t in w0 ] NEW_LINE dp = [ 0 for i in range ( N ) ] NEW_LINE bit = BITree ( N ) NEW_LINE for i in range ( N ) : NEW_LINE INDENT dp [ i ] = bit . query ( w [ i ] - 1 ) + 1 NEW_LINE bit . update ( w [ i ] , dp [ i ] ) NEW_LINE DEDENT print ( max ( dp ) ) NEW_LINE


import sys NEW_LINE input = sys . stdin . readline NEW_LINE N = int ( input ( ) ) NEW_LINE L = [ ] NEW_LINE for i in range ( N ) : NEW_LINE INDENT w , h = ( int ( i ) for i in input ( ) . split ( ) ) NEW_LINE L . append ( ( w , - h ) ) NEW_LINE DEDENT L . sort ( ) NEW_LINE import bisect NEW_LINE LIS = [ - L [ 0 ] [ 1 ] ] NEW_LINE for i in range ( 1 , N ) : NEW_LINE INDENT h = - L [ i ] [ 1 ] NEW_LINE if LIS [ - 1 ] < h : NEW_LINE INDENT LIS . append ( h ) NEW_LINE DEDENT else : NEW_LINE INDENT LIS [ bisect . bisect_left ( LIS , h ) ] = h NEW_LINE DEDENT DEDENT print ( len ( LIS ) ) NEW_LINE


import bisect NEW_LINE def present ( N : int , boxes : list ) -> int : NEW_LINE INDENT sorted_boxes = sorted ( sorted ( boxes , key = lambda x : - x [ 1 ] ) , key = lambda x : x [ 0 ] ) NEW_LINE _ , w = sorted_boxes [ 0 ] NEW_LINE wrapping = [ w ] NEW_LINE for _ , w in sorted_boxes : NEW_LINE INDENT if wrapping [ - 1 ] < w : NEW_LINE INDENT wrapping . append ( w ) NEW_LINE DEDENT else : NEW_LINE INDENT wrapping [ bisect . bisect_left ( wrapping , w ) ] = w NEW_LINE DEDENT DEDENT return len ( wrapping ) NEW_LINE DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT N = int ( input ( ) ) NEW_LINE boxes = [ tuple ( int ( s ) for s in input ( ) . split ( ) ) for _ in range ( N ) ] NEW_LINE ans = present ( N , boxes ) NEW_LINE print ( ans ) NEW_LINE DEDENT


N = int ( input ( ) ) NEW_LINE WH = [ list ( map ( int , input ( ) . split ( ) ) ) for i in range ( N ) ] NEW_LINE WH = sorted ( WH , key = lambda x : ( x [ 0 ] , - x [ 1 ] ) ) NEW_LINE class FenwickTree : NEW_LINE INDENT def __init__ ( self , n ) : NEW_LINE INDENT self . size = n NEW_LINE self . tree = [ 0 ] * self . size NEW_LINE DEDENT def update ( self , index , value ) : NEW_LINE INDENT x = index NEW_LINE while x < self . size : NEW_LINE INDENT if self . tree [ x ] < value : NEW_LINE INDENT self . tree [ x ] = value NEW_LINE DEDENT else : NEW_LINE INDENT return NEW_LINE DEDENT x |= x + 1 NEW_LINE DEDENT DEDENT def maximum ( self , index ) : NEW_LINE INDENT ret = 0 NEW_LINE x = index - 1 NEW_LINE while x >= 0 : NEW_LINE INDENT ret = max ( ret , self . tree [ x ] ) NEW_LINE x = ( x & ( x + 1 ) ) - 1 NEW_LINE DEDENT return ret NEW_LINE DEDENT DEDENT ft = FenwickTree ( 10 ** 5 + 1 ) NEW_LINE for p in WH : NEW_LINE INDENT ftv = ft . maximum ( p [ 1 ] ) + 1 NEW_LINE ft . update ( p [ 1 ] , ftv ) NEW_LINE DEDENT print ( ft . maximum ( 10 ** 5 + 1 ) ) NEW_LINE


import java . util . Arrays ; import java . util . Comparator ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int N = scan . nextInt ( ) ; int [ ] [ ] box = new int [ N ] [ 2 ] ; for ( int i = 0 ; i < N ; i ++ ) { box [ i ] [ 0 ] = scan . nextInt ( ) ; box [ i ] [ 1 ] = scan . nextInt ( ) ; } Arrays . sort ( box , new ArraySort ( ) ) ; final int INF = 1000000000 ; int dp [ ] = new int [ N + 1 ] ; int dpw [ ] = new int [ N + 1 ] ; for ( int i = 0 ; i < N + 1 ; i ++ ) { dp [ i ] = INF ; dpw [ i ] = INF ; } for ( int i = 0 ; i < N ; i ++ ) { int result = Arrays . binarySearch ( dp , box [ i ] [ 1 ] ) ; int insertionPoint = ( result >= 0 ) ? result : ~ result ; dp [ insertionPoint ] = box [ i ] [ 1 ] ; dpw [ insertionPoint ] = box [ i ] [ 0 ] ; } for ( int i = 0 ; i < N ; i ++ ) { if ( dp [ i + 1 ] == INF ) { System . out . println ( i + 1 ) ; break ; } } } } class ArraySort implements Comparator < int [ ] > { public int compare ( int [ ] num1 , int [ ] num2 ) { if ( num1 [ 0 ] == num2 [ 0 ] ) { return num2 [ 1 ] - num1 [ 1 ] ; } return num1 [ 0 ] - num2 [ 0 ] ; } }


import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int N = scanner . nextInt ( ) ; Box [ ] boxes = new Box [ N ] ; for ( int i = 0 ; i < N ; i ++ ) boxes [ i ] = new Box ( scanner . nextInt ( ) , scanner . nextInt ( ) ) ; Arrays . sort ( boxes , ( b1 , b2 ) -> { if ( b1 . w != b2 . w ) return b1 . w - b2 . w ; return b2 . h - b1 . h ; } ) ; int [ ] dp = new int [ N ] ; int INF = 1_000_000 ; for ( int i = 0 ; i < N ; i ++ ) dp [ i ] = INF ; for ( int i = 0 ; i < N ; i ++ ) dp [ upperBound ( dp , boxes [ i ] . h ) + 1 ] = boxes [ i ] . h ; System . out . println ( upperBound ( dp , INF ) + 1 ) ; } private static int upperBound ( int [ ] a , int k ) { int left = - 1 ; int right = a . length ; while ( right - left > 1 ) { int mid = ( left + right ) / 2 ; if ( a [ mid ] < k ) { left = mid ; } else { right = mid ; } } return left ; } private static class Box { public final int w ; public final int h ; private Box ( int w , int h ) { this . w = w ; this . h = h ; } } }


import java . util . Scanner ; import java . util . Arrays ; import java . util . Comparator ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; Point [ ] p = new Point [ n ] ; int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int w = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; p [ i ] = new Point ( w , h ) ; } Arrays . sort ( p , new Comparator < Point > ( ) { public int compare ( Point p1 , Point p2 ) { if ( p1 . x == p2 . x ) { return - ( p1 . y - p2 . y ) ; } else { return p1 . x - p2 . x ; } } } ) ; int [ ] max = new int [ n + 1 ] ; Arrays . fill ( max , Integer . MAX_VALUE ) ; max [ 0 ] = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int idx = Arrays . binarySearch ( max , p [ i ] . y ) ; if ( idx < 0 ) { idx = - idx - 1 ; max [ idx ] = Math . min ( max [ idx ] , p [ i ] . y ) ; } } for ( int i = n ; i >= 0 ; i -- ) { if ( max [ i ] < Integer . MAX_VALUE ) { System . out . println ( i ) ; return ; } } } static class Point { int x ; int y ; public Point ( int x , int y ) { this . x = x ; this . y = y ; } } }


import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int N = scanner . nextInt ( ) ; Box [ ] boxes = new Box [ N ] ; for ( int i = 0 ; i < N ; i ++ ) boxes [ i ] = new Box ( scanner . nextInt ( ) , scanner . nextInt ( ) ) ; Arrays . sort ( boxes , ( b1 , b2 ) -> { if ( b1 . w != b2 . w ) return b1 . w - b2 . w ; return b2 . h - b1 . h ; } ) ; int [ ] dp = new int [ N ] ; int INF = 1_000_000 ; for ( int i = 0 ; i < N ; i ++ ) dp [ i ] = INF ; for ( int i = 0 ; i < N ; i ++ ) { int j = lowerBound ( dp , boxes [ i ] . h ) ; if ( j == 0 || dp [ j - 1 ] < boxes [ i ] . h ) dp [ j ] = boxes [ i ] . h ; } int max = 0 ; for ( int i = 0 ; i < N ; i ++ ) if ( dp [ i ] < INF ) max = Math . max ( max , i + 1 ) ; System . out . println ( max ) ; } private static int lowerBound ( int [ ] a , int k ) { int left = - 1 ; int right = a . length ; while ( right - left > 1 ) { int mid = ( left + right ) / 2 ; if ( k < a [ mid ] ) { right = mid ; } else { left = mid ; } } return right ; } private static class Box { public final int w ; public final int h ; private Box ( int w , int h ) { this . w = w ; this . h = h ; } } }


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

n = int ( input ( ) ) NEW_LINE if n == 12 : NEW_LINE INDENT print ( 1 ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( n + 1 ) NEW_LINE DEDENT


print ( int ( input ( ) ) % 12 + 1 ) NEW_LINE


N = int ( input ( ) ) NEW_LINE if 1 <= N <= 11 : NEW_LINE INDENT print ( N + 1 ) NEW_LINE DEDENT elif N == 12 : NEW_LINE INDENT print ( 1 ) NEW_LINE DEDENT


n = int ( input ( ) ) + 1 NEW_LINE print ( 1 if n == 13 else n ) NEW_LINE


n = int ( input ( ) ) NEW_LINE m = n + 1 NEW_LINE if m > 12 : NEW_LINE INDENT print ( m - 12 ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( m ) NEW_LINE DEDENT


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


import java . io . 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 ( ) ; if ( N == 12 ) { out . println ( 1 ) ; } else { out . println ( 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 ( ) ; int a = sc . nextInt ( ) ; System . out . println ( a == 12 ? "1" : 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 n = nextInt ( ) ; out . println ( n == 12 ? 1 : n + 1 ) ; } }


import java . util . * ; import java . util . stream . Stream ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long xMin = 1L << 30 ; long xMax = 0 ; long yMin = 1L << 30 ; long yMax = 0 ; long [ ] [ ] bg = new long [ n ] [ 2 ] ; for ( int i = 0 ; i < n ; i ++ ) { int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; if ( x > y ) { int tmp = x ; x = y ; y = tmp ; } bg [ i ] [ 0 ] = x ; bg [ i ] [ 1 ] = y ; xMin = Math . min ( xMin , x ) ; xMax = Math . max ( xMax , x ) ; yMin = Math . min ( yMin , y ) ; yMax = Math . max ( yMax , y ) ; } long ans = ( xMax - xMin ) * ( yMax - yMin ) ; Arrays . sort ( bg , new Comparator < long [ ] > ( ) { public int compare ( long [ ] p1 , long [ ] p2 ) { if ( p1 [ 0 ] < p2 [ 0 ] ) return - 1 ; if ( p1 [ 0 ] > p2 [ 0 ] ) return 1 ; return 0 ; } } ) ; long yUsedMax = 0 ; long yUsedMin = 1L << 30 ; for ( int i = 0 ; i < n - 1 ; i ++ ) { yUsedMin = Math . min ( yUsedMin , bg [ i ] [ 1 ] ) ; yUsedMax = Math . max ( yUsedMax , bg [ i ] [ 1 ] ) ; long bMin = Math . min ( yUsedMin , bg [ i + 1 ] [ 0 ] ) ; long bMax = Math . max ( yUsedMax , bg [ n - 1 ] [ 0 ] ) ; ans = Math . min ( ans , ( yMax - xMin ) * ( bMax - bMin ) ) ; } System . out . println ( ans ) ; } }

import heapq NEW_LINE N = int ( input ( ) ) NEW_LINE Rmax = 0 NEW_LINE Rmin = 1000000001 NEW_LINE Bmax = 0 NEW_LINE Bmin = 1000000001 NEW_LINE data = sorted ( [ sorted ( list ( map ( int , input ( ) . split ( ) ) ) ) for i in range ( N ) ] , key = lambda x : x [ 0 ] ) NEW_LINE tempBlues = sorted ( [ d [ 1 ] for d in data ] ) NEW_LINE tempReds = [ d [ 0 ] for d in data ] NEW_LINE heapq . heapify ( tempReds ) NEW_LINE Rmin = data [ 0 ] [ 0 ] NEW_LINE Rmax = data [ N - 1 ] [ 0 ] NEW_LINE Bmax = max ( tempBlues ) NEW_LINE Bmin = min ( tempBlues ) NEW_LINE minValue = ( Rmax - Rmin ) * ( Bmax - Bmin ) NEW_LINE Bmin = Rmin NEW_LINE for i in range ( N ) : NEW_LINE INDENT heapMin = heapq . heappop ( tempReds ) NEW_LINE if heapMin == data [ i ] [ 0 ] : NEW_LINE INDENT heapq . heappush ( tempReds , data [ i ] [ 1 ] ) NEW_LINE if data [ i ] [ 1 ] > Rmax : NEW_LINE INDENT Rmax = data [ i ] [ 1 ] NEW_LINE DEDENT if ( Rmax - tempReds [ 0 ] ) * ( Bmax - Bmin ) < minValue : NEW_LINE INDENT minValue = ( Rmax - tempReds [ 0 ] ) * ( Bmax - Bmin ) NEW_LINE DEDENT DEDENT else : NEW_LINE INDENT break NEW_LINE DEDENT DEDENT print ( minValue ) NEW_LINE


def inpl ( ) : return [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE N = int ( input ( ) ) NEW_LINE C = [ ( ) ] * N NEW_LINE X = [ 0 ] * N NEW_LINE Y = [ 0 ] * N NEW_LINE for i in range ( N ) : NEW_LINE INDENT x , y = inpl ( ) NEW_LINE if x > y : NEW_LINE INDENT x , y = y , x NEW_LINE DEDENT X [ i ] = x NEW_LINE Y [ i ] = y NEW_LINE C [ i ] = ( x , y ) NEW_LINE DEDENT minx , maxx , miny , maxy = min ( X ) , max ( X ) , min ( Y ) , max ( Y ) NEW_LINE ans = ( maxy - miny ) * ( maxx - minx ) NEW_LINE ix = X . index ( minx ) NEW_LINE iy = Y . index ( maxy ) NEW_LINE l , r = X [ iy ] , Y [ ix ] NEW_LINE if r < l : NEW_LINE INDENT l , r = r , l NEW_LINE DEDENT H = [ ] NEW_LINE for x , y in C : NEW_LINE INDENT if y <= l : NEW_LINE INDENT l = y NEW_LINE continue NEW_LINE DEDENT if x >= r : NEW_LINE INDENT r = x NEW_LINE continue NEW_LINE DEDENT H . append ( ( x , y ) ) NEW_LINE DEDENT Candi = [ ] NEW_LINE for x , y in H : NEW_LINE INDENT if l <= x <= r or l <= y <= r : NEW_LINE INDENT continue NEW_LINE DEDENT Candi . append ( ( x , y ) ) NEW_LINE DEDENT Candi . sort ( ) NEW_LINE for x , y in Candi : NEW_LINE INDENT ans = min ( ans , ( maxy - minx ) * ( r - x ) ) NEW_LINE r = max ( r , y ) NEW_LINE DEDENT ans = min ( ans , ( maxy - minx ) * ( r - l ) ) NEW_LINE print ( ans ) NEW_LINE


import sys NEW_LINE from operator import itemgetter NEW_LINE inf = 1 << 30 NEW_LINE def solve ( ) : NEW_LINE INDENT n = int ( sys . stdin . readline ( ) ) NEW_LINE r_max = b_max = 0 NEW_LINE r_min = b_min = inf NEW_LINE p = [ ] NEW_LINE for i in range ( n ) : NEW_LINE INDENT xi , yi = map ( int , sys . stdin . readline ( ) . split ( ) ) NEW_LINE if xi > yi : NEW_LINE INDENT xi , yi = yi , xi NEW_LINE DEDENT p . append ( ( xi , yi ) ) NEW_LINE r_max = max ( r_max , yi ) NEW_LINE r_min = min ( r_min , yi ) NEW_LINE b_max = max ( b_max , xi ) NEW_LINE b_min = min ( b_min , xi ) NEW_LINE DEDENT ans1 = ( r_max - r_min ) * ( b_max - b_min ) NEW_LINE ans2 = ( r_max - b_min ) NEW_LINE p . sort ( key = itemgetter ( 0 ) ) NEW_LINE b_min = p [ 0 ] [ 0 ] NEW_LINE b_max = p [ - 1 ] [ 0 ] NEW_LINE y_min = inf NEW_LINE dif_b = b_max - b_min NEW_LINE for i in range ( n - 1 ) : NEW_LINE INDENT y_min = min ( y_min , p [ i ] [ 1 ] ) NEW_LINE b_min = min ( p [ i + 1 ] [ 0 ] , y_min ) NEW_LINE b_max = max ( b_max , p [ i ] [ 1 ] ) NEW_LINE dif_b = min ( dif_b , b_max - b_min ) NEW_LINE DEDENT ans2 *= dif_b NEW_LINE ans = min ( ans1 , ans2 ) NEW_LINE print ( ans ) NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT solve ( ) NEW_LINE DEDENT


N = int ( input ( ) ) NEW_LINE balls = sorted ( tuple ( sorted ( map ( int , input ( ) . split ( ) ) ) ) for i in range ( N ) ) NEW_LINE maxmin = balls [ - 1 ] [ 0 ] NEW_LINE minmin = balls [ 0 ] [ 0 ] NEW_LINE maxmax = max ( b [ 1 ] for b in balls ) NEW_LINE minmax = min ( b [ 1 ] for b in balls ) NEW_LINE v1 = ( maxmin - minmin ) * ( maxmax - minmax ) NEW_LINE best = float ( ' inf ' ) NEW_LINE cur_max = maxmin NEW_LINE for b in balls : NEW_LINE INDENT if b [ 0 ] > minmax : NEW_LINE INDENT best = min ( best , cur_max - minmax ) NEW_LINE break NEW_LINE DEDENT best = min ( best , cur_max - b [ 0 ] ) NEW_LINE cur_max = max ( cur_max , b [ 1 ] ) NEW_LINE DEDENT v2 = ( maxmax - minmin ) * best NEW_LINE print ( min ( v1 , v2 ) ) NEW_LINE


N = int ( input ( ) ) NEW_LINE Ball = [ ] NEW_LINE for i in range ( N ) : NEW_LINE INDENT x , y = map ( int , input ( ) . split ( ) ) NEW_LINE x , y = min ( x , y ) , max ( x , y ) NEW_LINE Ball . append ( ( x , y ) ) NEW_LINE DEDENT Ball . sort ( ) NEW_LINE X = [ x for x , y in Ball ] NEW_LINE Y = [ y for x , y in Ball ] NEW_LINE MIN = X [ 0 ] NEW_LINE MAX = max ( Y ) NEW_LINE ans = ( max ( X ) - MIN ) * ( MAX - min ( Y ) ) NEW_LINE MIN_index , MAX_index = X . index ( MIN ) , Y . index ( MAX ) NEW_LINE MIN_O = X [ MAX_index ] NEW_LINE MAX_O = Y [ MIN_index ] NEW_LINE MIN_O , MAX_O = min ( MIN_O , MAX_O ) , max ( MIN_O , MAX_O ) NEW_LINE Ball = [ Ball [ i ] for i in range ( N ) if i not in ( MIN_index , MAX_index ) ] NEW_LINE X = [ x for x , y in Ball ] NEW_LINE Y = [ y for x , y in Ball ] NEW_LINE B = [ x for x in X ] + [ MAX_O , MIN_O ] NEW_LINE B_max = max ( B ) NEW_LINE for i in range ( len ( Ball ) ) : NEW_LINE INDENT x , y = X [ i ] , Y [ i ] NEW_LINE if B_max - x > B_max - y >= 0 : NEW_LINE INDENT B [ i ] = y NEW_LINE DEDENT else : NEW_LINE INDENT break NEW_LINE DEDENT DEDENT ans = min ( ans , ( MAX - MIN ) * ( max ( B ) - min ( B ) ) ) NEW_LINE print ( ans ) NEW_LINE


import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int year = sc . nextInt ( ) ; boolean isUruYear = false ; if ( year % 4 == 0 ) { isUruYear = true ; } if ( year % 100 == 0 ) { isUruYear = false ; } if ( year % 400 == 0 ) { isUruYear = true ; } System . out . println ( isUruYear ? " YES " : " NO " ) ; } }

Y = int ( input ( ) ) NEW_LINE if Y % 400 == 0 : NEW_LINE INDENT print ( ' YES ' ) NEW_LINE DEDENT elif Y % 100 == 0 : NEW_LINE INDENT print ( ' NO ' ) NEW_LINE DEDENT elif Y % 4 == 0 : NEW_LINE INDENT print ( ' YES ' ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( ' NO ' ) NEW_LINE DEDENT


def main ( ) : NEW_LINE INDENT y = int ( input ( ) ) NEW_LINE if y % 400 == 0 : NEW_LINE INDENT print ( " YES " ) NEW_LINE DEDENT elif y % 100 == 0 : NEW_LINE INDENT print ( " NO " ) NEW_LINE DEDENT elif y % 4 == 0 : NEW_LINE INDENT print ( " YES " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " NO " ) NEW_LINE DEDENT DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT main ( ) NEW_LINE DEDENT


y = int ( input ( ) ) NEW_LINE print ( " YES " if y % 4 == 0 and y % 100 != 0 or y % 400 == 0 else " NO " ) NEW_LINE


s = int ( input ( ) ) NEW_LINE if s % 4 != 0 : NEW_LINE INDENT print ( " NO " ) NEW_LINE DEDENT else : NEW_LINE INDENT if s % 400 == 0 : NEW_LINE INDENT print ( " YES " ) NEW_LINE DEDENT elif s % 100 == 0 : NEW_LINE INDENT print ( " NO " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " YES " ) NEW_LINE DEDENT DEDENT


y = int ( input ( ) ) NEW_LINE ans = 0 NEW_LINE if y % 4 == 0 : NEW_LINE INDENT ans += 1 NEW_LINE DEDENT if y % 100 == 0 : NEW_LINE INDENT ans -= 1 NEW_LINE DEDENT if y % 400 == 0 : NEW_LINE INDENT ans += 1 NEW_LINE DEDENT if ans == 1 : NEW_LINE INDENT print ( " YES " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " NO " ) 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 . 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 Y = in . nextInt ( ) ; String ans = " NO " ; if ( Y % 400 == 0 || ( Y % 4 == 0 && Y % 100 != 0 ) ) { ans = " YES " ; } 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 . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . InputMismatchException ; import java . io . IOException ; import java . io . InputStream ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; FastScanner in = new FastScanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskA solver = new TaskA ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskA { public void solve ( int testNumber , FastScanner in , PrintWriter out ) { int y = in . nextInt ( ) ; if ( ( y % 4 == 0 && y % 100 != 0 ) || y % 400 == 0 ) 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 ; 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 . util . * ; import java . awt . * ; import java . awt . geom . * ; import static java . lang . System . * ; import static java . lang . Math . * ; public class Main { public static void main ( String [ ] $ ) { Scanner sc = new Scanner ( in ) ; int y = sc . nextInt ( ) ; if ( y % 4 != 0 ) { out . println ( " NO " ) ; } else { if ( y % 16 == 0 ) { out . println ( " YES " ) ; } else if ( y % 25 == 0 ) { out . println ( " NO " ) ; } else { out . println ( " YES " ) ; } } } }


import java . util . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int y = sc . nextInt ( ) ; boolean uruu = false ; if ( y % 400 == 0 ) { uruu = true ; } else if ( y % 100 != 0 && y % 4 == 0 ) { uruu = true ; } if ( uruu ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } }


import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int score = 0 ; int n = sc . nextInt ( ) ; if ( n == 1 ) { System . out . println ( " BOWWOW " ) ; System . exit ( 0 ) ; } for ( int i = 0 ; i <= n ; i ++ ) { score += i ; } for ( int i = 2 ; i < Math . sqrt ( score ) ; i ++ ) { if ( score % i == 0 ) { System . out . println ( " BOWWOW " ) ; System . exit ( 0 ) ; } } System . out . println ( " WANWAN " ) ; } }

n = int ( input ( ) ) NEW_LINE def is_prime ( n ) : NEW_LINE INDENT for i in range ( 2 , n + 1 ) : NEW_LINE INDENT if i * i > n : NEW_LINE INDENT break NEW_LINE DEDENT if n % i == 0 : NEW_LINE INDENT return False NEW_LINE DEDENT DEDENT return n != 1 NEW_LINE DEDENT res = 0 NEW_LINE for i in range ( n + 1 ) : NEW_LINE INDENT res += i NEW_LINE DEDENT if is_prime ( res ) : NEW_LINE INDENT print ( ' WANWAN ' ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( ' BOWWOW ' ) NEW_LINE DEDENT


print ( " BOWWOW " if int ( input ( ) ) != 2 else " WANWAN " ) NEW_LINE


def a_holidog ( N ) : NEW_LINE INDENT if N == 1 : NEW_LINE INDENT return ' BOWWOW ' NEW_LINE DEDENT total = N * ( N + 1 ) // 2 NEW_LINE ans = ' BOWWOW ' NEW_LINE for k in range ( 2 , int ( total ** 0.5 ) + 1 ) : NEW_LINE INDENT if total % k == 0 : NEW_LINE INDENT break NEW_LINE DEDENT DEDENT else : NEW_LINE INDENT ans = ' WANWAN ' NEW_LINE DEDENT return ans NEW_LINE DEDENT N = int ( input ( ) ) NEW_LINE print ( a_holidog ( N ) ) NEW_LINE


import sys NEW_LINE sys . setrecursionlimit ( 10 ** 9 ) NEW_LINE input = sys . stdin . readline NEW_LINE N = int ( input ( ) ) NEW_LINE s = sum ( range ( 1 , N + 1 ) ) NEW_LINE def isPrime ( N ) : NEW_LINE INDENT if N <= 1 : NEW_LINE INDENT return False NEW_LINE DEDENT i = 2 NEW_LINE while i * i <= N : NEW_LINE INDENT if N % i == 0 : NEW_LINE INDENT return False NEW_LINE DEDENT i += 1 NEW_LINE DEDENT return True NEW_LINE DEDENT if not isPrime ( s ) : NEW_LINE INDENT print ( " BOWWOW " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " WANWAN " ) NEW_LINE DEDENT


n = int ( input ( ) ) NEW_LINE temp = 0 NEW_LINE for i in range ( 1 , n + 1 ) : NEW_LINE INDENT temp += i NEW_LINE DEDENT flag = 0 NEW_LINE if n == 1 : NEW_LINE INDENT print ( " BOWWOW " ) NEW_LINE DEDENT else : NEW_LINE INDENT for i in range ( 2 , temp + 1 ) : NEW_LINE INDENT if temp % i == 0 and i != temp : NEW_LINE INDENT print ( " BOWWOW " ) NEW_LINE flag = 1 NEW_LINE break NEW_LINE DEDENT DEDENT if flag == 0 : NEW_LINE INDENT print ( " WANWAN " ) NEW_LINE DEDENT DEDENT


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . UncheckedIOException ; import java . util . StringTokenizer ; class Main { public static void main ( String [ ] args ) { SC sc = new SC ( System . in ) ; int a = sc . nextInt ( ) ; int sum = a * ( a + 1 ) / 2 ; if ( isPrime ( sum ) ) { pl ( " WANWAN " ) ; } else { pl ( " BOWWOW " ) ; } } static class SC { private BufferedReader reader = null ; private StringTokenizer tokenizer = null ; public SC ( InputStream in ) { reader = new BufferedReader ( new InputStreamReader ( in ) ) ; } public String next ( ) { if ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new UncheckedIOException ( e ) ; } } return tokenizer . nextToken ( ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } public long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } public double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } public String nextLine ( ) { try { return reader . readLine ( ) ; } catch ( IOException e ) { throw new UncheckedIOException ( e ) ; } } } public static void pl ( Object o ) { System . out . println ( o ) ; } public static void p ( Object o ) { System . out . print ( o ) ; } public static boolean isPrime ( int a ) { if ( a < 4 ) { if ( a == 2 || a == 3 ) { return true ; } else { return false ; } } else { for ( int j = 2 ; j * j <= a ; j ++ ) { if ( a % j == 0 ) { return false ; } if ( a % j != 0 && ( j + 1 ) * ( j + 1 ) > a ) { return true ; } } return true ; } } }


import java . util . * ; import static java . lang . System . * ; import static java . lang . Math . * ; public class Main { public static void main ( String [ ] $ ) { Scanner sc = new Scanner ( in ) ; int n = sc . nextInt ( ) ; n = n * ( n + 1 ) / 2 ; int t = ( int ) sqrt ( n ) + 1 ; for ( int i = 2 ; i <= t ; i ++ ) { if ( n % i == 0 ) { out . println ( " BOWWOW " ) ; exit ( 0 ) ; } } if ( n != 1 ) out . println ( " WANWAN " ) ; else out . println ( " BOWWOW " ) ; } }


import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int upper = 1000000 ; int a [ ] = new int [ upper + 1 ] ; for ( int i = 2 ; i <= upper ; i ++ ) { a [ i ] = i ; } for ( int i = 2 ; i <= Math . sqrt ( upper ) ; i ++ ) { for ( int j = i + i ; j <= upper ; j += i ) { a [ j ] = 0 ; } } int sum = 0 ; for ( int i = 1 ; i <= n ; i ++ ) sum += i ; if ( a [ sum ] == 0 ) System . out . println ( " BOWWOW " ) ; else System . out . println ( " WANWAN " ) ; } }


import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner scanner = new Scanner ( System . in ) ; int N = scanner . nextInt ( ) ; int sum = 0 ; for ( int i = 1 ; i <= N ; i ++ ) { sum += i ; } boolean flag = true ; if ( N == 1 ) { flag = false ; } else if ( N == 2 ) { flag = true ; } else if ( N > 2 ) { for ( int i = 2 ; i <= Math . sqrt ( sum ) ; i ++ ) { if ( sum % i == 0 ) { flag = false ; break ; } } } if ( flag ) { System . out . println ( " WANWAN " ) ; } else { System . out . println ( " BOWWOW " ) ; } } }


import java . util . Scanner ; class Main { static final long MOD = 1000000007 ; static int H , W , K ; static long [ ] [ ] dp = new long [ 110 ] [ 10 ] ; static int ans = 0 ; static long n = 0 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int H = sc . nextInt ( ) ; int W = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; long MOD = 1000000007 ; int [ ] [ ] dp = new int [ H + 1 ] [ W ] ; dp [ 0 ] [ 0 ] = 1 ; for ( int h = 1 ; h <= H ; h ++ ) { for ( int w = 0 ; w < W ; w ++ ) { for ( int i = 0 ; i < ( 1 << W - 1 ) ; i ++ ) { int mask = 3 ; boolean flag = true ; while ( true ) { if ( ( mask & i ) == mask ) { flag = false ; } if ( mask == 3 << W - 1 ) { break ; } mask = mask << 1 ; } if ( flag ) { if ( w > 0 && ( i & ( 1 << w - 1 ) ) > 0 ) { dp [ h ] [ w ] += dp [ h - 1 ] [ w - 1 ] ; } else if ( w < W - 1 && ( i & ( 1 << w ) ) > 0 ) { dp [ h ] [ w ] += dp [ h - 1 ] [ w + 1 ] ; } else { dp [ h ] [ w ] += dp [ h - 1 ] [ w ] ; } dp [ h ] [ w ] %= MOD ; } } } } System . out . println ( dp [ H ] [ K - 1 ] ) ; } } class Pair implements Comparable { int from ; int end ; int num ; int bango ; @ Override public int compareTo ( Object other ) { Pair otherpair = ( Pair ) other ; return end - otherpair . end ; } }

H , W , K = map ( int , input ( ) . split ( ) ) NEW_LINE dp = [ [ 0 for _ in range ( W ) ] for _ in range ( H + 1 ) ] NEW_LINE dp [ 0 ] [ 0 ] = 1 NEW_LINE P = 10 ** 9 + 7 NEW_LINE def check ( l ) : NEW_LINE INDENT for i in range ( len ( l ) - 1 ) : NEW_LINE INDENT if l [ i + 1 ] + l [ i ] == 2 : NEW_LINE INDENT return False NEW_LINE DEDENT DEDENT return True NEW_LINE DEDENT for i in range ( 1 , H + 1 ) : NEW_LINE INDENT for w in range ( W ) : NEW_LINE INDENT X , Y , Z = 0 , 0 , 0 NEW_LINE for j in range ( 2 ** ( W - 1 ) ) : NEW_LINE INDENT tmp = [ ] NEW_LINE for k in range ( W - 1 ) : NEW_LINE INDENT tmp . append ( j >> k & 1 ) NEW_LINE DEDENT if check ( tmp ) : NEW_LINE INDENT if w - 1 >= 0 and ( j >> ( w - 1 ) ) & 1 == 1 : NEW_LINE INDENT X += 1 NEW_LINE DEDENT elif w <= W - 2 and j >> w & 1 == 1 : NEW_LINE INDENT Z += 1 NEW_LINE DEDENT else : NEW_LINE INDENT Y += 1 NEW_LINE DEDENT DEDENT else : NEW_LINE INDENT continue NEW_LINE DEDENT DEDENT if w - 1 >= 0 : dp [ i ] [ w - 1 ] = ( dp [ i ] [ w - 1 ] + dp [ i - 1 ] [ w ] * X ) % P NEW_LINE dp [ i ] [ w ] = ( dp [ i ] [ w ] + dp [ i - 1 ] [ w ] * Y ) % P NEW_LINE if w + 1 <= W - 1 : dp [ i ] [ w + 1 ] = ( dp [ i ] [ w + 1 ] + dp [ i - 1 ] [ w ] * Z ) % P NEW_LINE DEDENT DEDENT print ( dp [ H ] [ K - 1 ] ) NEW_LINE


import itertools NEW_LINE height , width , k = map ( int , input ( ) . split ( ) ) NEW_LINE k -= 1 NEW_LINE MOD = 1000000007 NEW_LINE patterns = [ ] NEW_LINE for r in range ( width - 1 ) : NEW_LINE INDENT for pattern in itertools . combinations ( range ( width - 1 ) , r ) : NEW_LINE INDENT if all ( abs ( a - b ) != 1 for a , b in zip ( pattern [ : - 1 ] , pattern [ 1 : ] ) ) : NEW_LINE INDENT patterns . append ( pattern ) NEW_LINE DEDENT DEDENT DEDENT counts = [ [ 0 for _ in range ( width ) ] for _ in range ( width ) ] NEW_LINE for pattern in patterns : NEW_LINE INDENT for w in range ( width ) : NEW_LINE INDENT if w in pattern : NEW_LINE INDENT counts [ w ] [ w + 1 ] += 1 NEW_LINE DEDENT elif w - 1 in pattern : NEW_LINE INDENT counts [ w ] [ w - 1 ] += 1 NEW_LINE DEDENT else : NEW_LINE INDENT counts [ w ] [ w ] += 1 NEW_LINE DEDENT DEDENT DEDENT dp = [ [ 0 for _ in range ( width ) ] for _ in range ( height ) ] NEW_LINE dp [ 0 ] = counts [ 0 ] . copy ( ) NEW_LINE for h in range ( height - 1 ) : NEW_LINE INDENT for w in range ( width ) : NEW_LINE INDENT dp [ h + 1 ] [ w ] = sum ( [ dp [ h ] [ v ] * counts [ v ] [ w ] for v in range ( width ) ] ) % MOD NEW_LINE DEDENT DEDENT if width == 1 : NEW_LINE INDENT print ( 1 ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( dp [ - 1 ] [ k ] ) NEW_LINE DEDENT


def way ( h , w , k ) : NEW_LINE INDENT if w == 1 : NEW_LINE INDENT return 1 NEW_LINE DEDENT if [ h , k ] == [ 1 , 1 ] or [ h , k ] == [ 1 , 2 ] : NEW_LINE INDENT return fibo [ w - k ] NEW_LINE DEDENT if h == 1 : NEW_LINE INDENT return 0 NEW_LINE DEDENT if memo [ h ] [ k ] != - 1 : NEW_LINE INDENT return memo [ h ] [ k ] NEW_LINE DEDENT re = way ( h - 1 , w , k ) * fibo [ k - 1 ] * fibo [ w - k ] NEW_LINE if k != 1 : NEW_LINE INDENT re += way ( h - 1 , w , k - 1 ) * fibo [ max ( k - 2 , 0 ) ] * fibo [ w - k ] NEW_LINE DEDENT if k != w : NEW_LINE INDENT re += way ( h - 1 , w , k + 1 ) * fibo [ k - 1 ] * fibo [ max ( w - k - 1 , 0 ) ] NEW_LINE DEDENT memo [ h ] [ k ] = re NEW_LINE return re NEW_LINE DEDENT h , w , k = map ( int , input ( ) . split ( ) ) NEW_LINE fibo = [ 1 , 1 ] NEW_LINE for i in range ( 2 , w ) : NEW_LINE INDENT fibo += [ fibo [ i - 1 ] + fibo [ i - 2 ] ] NEW_LINE DEDENT memo = [ [ - 1 ] * ( w + 1 ) for _ in range ( h + 1 ) ] NEW_LINE print ( way ( h , w , k ) % 1000000007 ) NEW_LINE


import sys NEW_LINE import functools NEW_LINE INF = float ( " inf " ) NEW_LINE MOD = 1000000007 NEW_LINE @ functools . lru_cache ( maxsize = None ) NEW_LINE def f ( x ) : NEW_LINE INDENT if x <= 0 : NEW_LINE INDENT return 1 NEW_LINE DEDENT elif x == 1 : NEW_LINE INDENT return 2 NEW_LINE DEDENT else : NEW_LINE INDENT return f ( x - 1 ) + f ( x - 2 ) NEW_LINE DEDENT DEDENT def solve ( H : int , W : int , K : int ) : NEW_LINE INDENT dp = [ 0 ] * ( W + 2 ) NEW_LINE dp [ 1 ] = 1 NEW_LINE for h in range ( H ) : NEW_LINE INDENT buf = [ 0 ] * ( W + 2 ) NEW_LINE for i in range ( 1 , W + 1 ) : NEW_LINE INDENT buf [ i ] += dp [ i - 1 ] * f ( i - 3 ) * f ( W - i - 1 ) NEW_LINE buf [ i ] %= MOD NEW_LINE buf [ i ] += dp [ i ] * f ( i - 2 ) * f ( W - i - 1 ) NEW_LINE buf [ i ] %= MOD NEW_LINE buf [ i ] += dp [ i + 1 ] * f ( i - 2 ) * f ( W - i - 2 ) NEW_LINE buf [ i ] %= MOD NEW_LINE DEDENT for i in range ( 1 , W + 1 ) : NEW_LINE INDENT dp [ i ] = buf [ i ] NEW_LINE DEDENT DEDENT print ( dp [ K ] ) NEW_LINE 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 H = int ( next ( tokens ) ) NEW_LINE W = int ( next ( tokens ) ) NEW_LINE K = int ( next ( tokens ) ) NEW_LINE solve ( H , W , K ) NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT main ( ) NEW_LINE DEDENT


from itertools import product NEW_LINE H , W , K = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE mod = int ( 1e9 + 7 ) NEW_LINE memo = [ [ 0 ] * W for _ in range ( H + 1 ) ] NEW_LINE memo [ 0 ] [ 0 ] = 1 NEW_LINE from itertools import product NEW_LINE def one_row ( W ) : NEW_LINE INDENT one_row_amida = { i : { i : 0 for i in range ( W ) } for i in range ( W ) } NEW_LINE for p in product ( [ 0 , 1 ] , repeat = W - 1 ) : NEW_LINE INDENT if any ( [ p [ i ] == 1 and p [ i + 1 ] == 1 for i in range ( W - 2 ) ] ) : NEW_LINE INDENT continue NEW_LINE DEDENT after = [ i for i in range ( W ) ] NEW_LINE for i in range ( W - 1 ) : NEW_LINE INDENT if p [ i ] : NEW_LINE INDENT after [ i ] , after [ i + 1 ] = after [ i + 1 ] , after [ i ] NEW_LINE DEDENT DEDENT for i , a in enumerate ( after ) : NEW_LINE INDENT one_row_amida [ i ] [ a ] += 1 NEW_LINE DEDENT DEDENT return one_row_amida NEW_LINE DEDENT one_row_amida = one_row ( W ) NEW_LINE for h in range ( H ) : NEW_LINE INDENT for w in range ( W ) : NEW_LINE INDENT for j in range ( W ) : NEW_LINE INDENT memo [ h + 1 ] [ j ] += memo [ h ] [ w ] * one_row_amida [ w ] [ j ] NEW_LINE DEDENT DEDENT memo [ h + 1 ] = [ x % mod for x in memo [ h + 1 ] ] NEW_LINE DEDENT answer = memo [ H ] [ K - 1 ] NEW_LINE print ( answer ) NEW_LINE


import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . IOException ; public class Main { public static void main ( String [ ] args ) throws IOException { final long mod = 1_000_000_007L ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] p = br . readLine ( ) . split ( " ▁ " ) ; int h = Integer . parseInt ( p [ 0 ] ) ; int w = Integer . parseInt ( p [ 1 ] ) ; int k = Integer . parseInt ( p [ 2 ] ) ; br . close ( ) ; long [ ] [ ] a = new long [ h + 1 ] [ w + 2 ] ; long [ ] f = new long [ w + 2 ] ; a [ 0 ] [ 1 ] = 1 ; f [ 0 ] = 0 ; f [ 1 ] = f [ 2 ] = 1 ; for ( int i = 3 ; i < w + 2 ; i ++ ) f [ i ] = f [ i - 1 ] + f [ i - 2 ] ; for ( int i = 1 ; i < h + 1 ; i ++ ) for ( int j = 1 ; j < w + 1 ; j ++ ) a [ i ] [ j ] = ( f [ j - 1 ] * f [ w - j + 1 ] * a [ i - 1 ] [ j - 1 ] % mod + f [ j ] * f [ w - j + 1 ] * a [ i - 1 ] [ j ] % mod + f [ j ] * f [ w - j ] * a [ i - 1 ] [ j + 1 ] % mod ) % mod ; System . out . println ( a [ h ] [ k ] ) ; } }


import java . util . * ; import java . lang . * ; public class Main { static long mod = 1000000007 ; static int h ; static int w ; static int k ; static long [ ] [ ] dp ; static int i ; static int j ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; h = sc . nextInt ( ) ; w = sc . nextInt ( ) ; k = sc . nextInt ( ) ; dp = new long [ h + 1 ] [ w + 2 ] ; dp [ 0 ] [ 1 ] = 1 ; for ( i = 1 ; i <= h ; i ++ ) { for ( j = 1 ; j <= w ; j ++ ) { dfs ( 1 , false , false , false ) ; } } System . out . println ( dp [ h ] [ k ] ) ; } static void dfs ( int now , boolean te , boolean mae , boolean ato ) { if ( now == w ) { if ( mae ) { dp [ i ] [ j ] += dp [ i - 1 ] [ j - 1 ] ; dp [ i ] [ j ] %= mod ; } else if ( ato ) { dp [ i ] [ j ] += dp [ i - 1 ] [ j + 1 ] ; dp [ i ] [ j ] %= mod ; } else { dp [ i ] [ j ] += dp [ i - 1 ] [ j ] ; dp [ i ] [ j ] %= mod ; } return ; } if ( te ) { dfs ( now + 1 , false , mae , ato ) ; } else if ( now == j - 1 ) { dfs ( now + 1 , true , true , false ) ; dfs ( now + 1 , false , mae , ato ) ; } else if ( now == j ) { dfs ( now + 1 , true , mae , true ) ; dfs ( now + 1 , false , mae , ato ) ; } else { dfs ( now + 1 , true , mae , ato ) ; dfs ( now + 1 , false , mae , ato ) ; } } }


import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int h = sc . nextInt ( ) ; int w = sc . nextInt ( ) ; int k1 = sc . nextInt ( ) ; long [ ] [ ] dp = new long [ h + 1 ] [ w ] ; long mod = 1000000007 ; dp [ 0 ] [ 0 ] = 1 ; for ( int i = 1 ; i <= h ; i ++ ) { for ( int j = w - 1 ; j >= 0 ; j -- ) { for ( int k = 0 ; k < Math . pow ( 2 , w - 1 ) ; k ++ ) { boolean a = false ; boolean b = false ; boolean jud = false ; int count = 0 ; int y = k ; while ( y > 0 ) { if ( ( y & 1 ) == 1 ) { if ( jud ) { break ; } if ( w - 1 - count == j ) { a = true ; } else if ( w - 1 - count == j + 1 ) { b = true ; } jud = true ; } else { jud = false ; } count ++ ; y >>= 1 ; if ( y <= 0 ) { jud = false ; } } if ( jud ) { continue ; } if ( j > 0 && a ) { dp [ i ] [ j ] += dp [ i - 1 ] [ j - 1 ] ; } else if ( j < w - 1 && b ) { dp [ i ] [ j ] += dp [ i - 1 ] [ j + 1 ] ; } else { dp [ i ] [ j ] += dp [ i - 1 ] [ j ] ; } dp [ i ] [ j ] %= mod ; } } } System . out . println ( dp [ h ] [ k1 - 1 ] ) ; } }


import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . PrintWriter ; @ SuppressWarnings ( " unchecked " ) public class Main { static final int INF = 1000000007 ; public static void main ( String [ ] args ) throws IOException { final String s ; try ( BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { s = reader . readLine ( ) ; } PrintWriter out = new PrintWriter ( System . out ) ; final String [ ] sl = s . split ( " ▁ " ) ; int H = Integer . parseInt ( sl [ 0 ] ) ; int W = Integer . parseInt ( sl [ 1 ] ) ; int K = Integer . parseInt ( sl [ 2 ] ) ; int [ ] [ ] dp = new int [ H + 1 ] [ W ] ; dp [ 0 ] [ 0 ] = 1 ; for ( int y = 0 ; y < H ; y ++ ) { for ( int x = 0 ; x < W ; x ++ ) { for ( int k = 0 ; k < 1 << ( W - 1 ) ; k ++ ) { boolean ok = true ; for ( int l = 0 ; l < W - 2 ; l ++ ) if ( ( k >> l & 1 ) == 1 && ( k >> l + 1 & 1 ) == 1 ) ok = false ; if ( ok ) { if ( x >= 1 && ( k >> x - 1 & 1 ) == 1 ) { dp [ y + 1 ] [ x - 1 ] += dp [ y ] [ x ] ; dp [ y + 1 ] [ x - 1 ] %= INF ; } else if ( x <= W - 2 && ( k >> x & 1 ) == 1 ) { dp [ y + 1 ] [ x + 1 ] += dp [ y ] [ x ] ; dp [ y + 1 ] [ x + 1 ] %= INF ; } else { dp [ y + 1 ] [ x ] += dp [ y ] [ x ] ; dp [ y + 1 ] [ x ] %= INF ; } } } } } out . println ( dp [ H ] [ K - 1 ] ) ; out . flush ( ) ; } }


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

print ( 48 - int ( input ( ) ) ) NEW_LINE


M = input ( ) NEW_LINE M = int ( M ) NEW_LINE print ( 48 - M ) NEW_LINE


def main ( ) : NEW_LINE INDENT print ( 24 * 2 - int ( input ( ) ) ) NEW_LINE DEDENT main ( ) NEW_LINE


a = int ( input ( ) ) NEW_LINE print ( ( 24 - a ) + 24 ) NEW_LINE


import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . PriorityQueue ; import java . util . Scanner ; import java . util . TreeSet ; import org . omg . Messaging . SyncScopeHelper ; public class Main { Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { new Main ( ) ; } public Main ( ) { new Test_100 ( ) . doIt ( ) ; } class Test_100 { void doIt ( ) { int M = sc . nextInt ( ) ; int ans = 48 - M ; System . out . println ( ans ) ; } } }


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


import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int m ; m = Integer . parseInt ( sc . next ( ) ) ; int x = 48 - m ; System . out . println ( x ) ; sc . close ( ) ; } }


import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = Integer . parseInt ( sc . next ( ) ) ; System . out . println ( 48 - a ) ; } }


import java . util . * ; public class Main { static final String [ ] KEY = new String [ ] { " WBWBWWBWBWBW " , " WBWWBWBWBWWB " , " WWBWBWBWWBWB " , " WBWBWBWWBWBW " , " WBWBWWBWBWWB " , " WBWWBWBWWBWB " , " WWBWBWWBWBWB " } ; static final String [ ] VALUE = new String [ ] { " Do " , " Re " , " Mi " , " Fa " , " So " , " La " , " Si " } ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; for ( int i = 0 ; i < KEY . length ; i ++ ) { if ( s . startsWith ( KEY [ i ] ) ) { System . out . println ( VALUE [ i ] ) ; return ; } } } }

s = list ( input ( ) ) NEW_LINE a = 0 NEW_LINE b = 0 NEW_LINE n = len ( s ) NEW_LINE for i in range ( 1 , n ) : NEW_LINE INDENT if s [ i ] == s [ i - 1 ] : NEW_LINE INDENT a = i NEW_LINE break NEW_LINE DEDENT DEDENT for i in range ( a + 1 , n ) : NEW_LINE INDENT if s [ i ] == s [ i - 1 ] : NEW_LINE INDENT b = i NEW_LINE break NEW_LINE DEDENT DEDENT ans_a = [ ' ' , ' Mi ' , ' ' , ' Re ' , ' ' , ' Do ' ] NEW_LINE ans_b = [ ' ' , ' Si ' , ' ' , ' La ' , ' ' , ' So ' , ' ' , ' Fa ' ] NEW_LINE if b - a == 7 : NEW_LINE INDENT print ( ans_a [ a ] ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( ans_b [ a ] ) NEW_LINE DEDENT


s = input ( ) NEW_LINE moji = [ " Mi " , " Fa " , " " , " So " , " " , " La " , " " , " Si " , " Do " , " " , " Re " , " " , " Mi " , " Fa " , " " , " So " , " " , " La " , " " , " Si " , " Do " , " " , " Re " , " " , " Mi " ] [ : : - 1 ] NEW_LINE moji2 = [ " Mi " , " Fa " , " " , " So " , " " , " La " , " " , " Si " , " Do " , " " , " Re " , " " , " Mi " , " Fa " , " " , " So " , " " , " La " , " " , " Si " ] [ : : - 1 ] NEW_LINE for i in range ( 11 ) : NEW_LINE INDENT if s [ i ] == " W " and s [ i + 1 ] == " W " and s [ i + 7 ] == " W " and s [ i + 8 ] == " W " : NEW_LINE INDENT print ( moji [ i ] ) NEW_LINE exit ( ) NEW_LINE DEDENT DEDENT for i in range ( 13 ) : NEW_LINE INDENT if s [ i ] == " W " and s [ i + 1 ] == " W " and s [ i + 5 ] == " W " and s [ i + 6 ] == " W " : NEW_LINE INDENT print ( moji2 [ i ] ) NEW_LINE exit ( ) NEW_LINE DEDENT DEDENT


def pianist_takahashi ( S : str ) -> int : NEW_LINE INDENT scales = [ ' Do ' , ' Do # ' , ' Re ' , ' Re # ' , ' Mi ' , ' Fa ' , ' Fa # ' , ' So ' , ' So # ' , ' La ' , ' La # ' , ' Si ' ] NEW_LINE keyboard = ' WBWBWWBWBWBW ' NEW_LINE for i , scale in enumerate ( scales ) : NEW_LINE INDENT if ( S ) . startswith ( keyboard [ i : ] + keyboard [ : i ] ) : NEW_LINE INDENT return scale NEW_LINE DEDENT DEDENT return ' Unknown ' NEW_LINE DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT S = input ( ) NEW_LINE ans = pianist_takahashi ( S ) NEW_LINE print ( ans ) NEW_LINE DEDENT


def solve ( s ) : NEW_LINE INDENT pattern = ( " WBWBWWBWBWBW " * 10 ) NEW_LINE oto = [ " Do " , " Do " , " Re " , " Re " , " Mi " , " Fa " , " Fa " , " So " , " So " , " La " , " La " , ] i = pattern . find ( s ) NEW_LINE return oto [ i ] NEW_LINE DEDENT def main ( ) : NEW_LINE INDENT print ( solve ( input ( ) ) ) NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT main ( ) NEW_LINE DEDENT


S = input ( ) NEW_LINE dic_scale = { " WBWBWWBWBWBWWBWBWWBW " : " Do " , " WBWWBWBWBWWBWBWWBWBW " : " Re " , " WWBWBWBWWBWBWWBWBWBW " : " Mi " , " WBWBWBWWBWBWWBWBWBWW " : " Fa " , " WBWBWWBWBWWBWBWBWWBW " : " So " , " WBWWBWBWWBWBWBWWBWBW " : " La " , " WWBWBWWBWBWBWWBWBWWB " : " Si " } NEW_LINE ans = dic_scale [ S ] NEW_LINE print ( ans ) NEW_LINE


import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . InputMismatchException ; import java . io . IOException ; import java . io . InputStream ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; FastScanner in = new FastScanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskC solver = new TaskC ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskC { public void solve ( int testNumber , FastScanner in , PrintWriter out ) { String keyboard = " WBWBWWBWBWBWWBWBWWBWBWBWWBWBWWBWBWBW " ; String [ ] ans = { " Do " , " Do " , " Re " , " Re " , " Mi " , " Fa " , " Fa " , " So " , " So " , " La " , " La " , " Si " } ; String s = in . next ( ) . substring ( 0 , 12 ) ; for ( int i = 0 ; i < keyboard . length ( ) - 12 ; i ++ ) { if ( s . equals ( keyboard . substring ( i , i + 12 ) ) ) { out . println ( ans [ i % 12 ] ) ; return ; } } } } static class FastScanner { private InputStream in ; private byte [ ] buffer = new byte [ 1024 ] ; private int bufPointer ; private int bufLength ; public FastScanner ( InputStream in ) { this . in = in ; } private int readByte ( ) { if ( bufPointer >= bufLength ) { if ( bufLength == - 1 ) throw new InputMismatchException ( ) ; bufPointer = 0 ; try { bufLength = in . read ( buffer ) ; } catch ( IOException e ) { throw new InputMismatchException ( ) ; } if ( bufLength <= 0 ) return - 1 ; } return buffer [ bufPointer ++ ] ; } private static boolean isPrintableChar ( int c ) { return c >= 33 && c <= 126 ; } public String next ( ) { StringBuilder sb = new StringBuilder ( ) ; int b = readByte ( ) ; while ( ! isPrintableChar ( b ) ) b = readByte ( ) ; while ( isPrintableChar ( b ) ) { sb . appendCodePoint ( b ) ; b = readByte ( ) ; } return sb . toString ( ) ; } } }


import java . util . Scanner ; class Main { static int n ; static long ans = 1000000000 ; static int [ ] memo ; static int [ ] dp ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String k = sc . next ( ) ; int num = 0 ; for ( int i = 0 ; i < k . length ( ) - 4 ; i ++ ) { if ( k . charAt ( i ) == ' B ' && k . charAt ( i + 2 ) == ' B ' && k . charAt ( i + 4 ) == ' B ' ) { num = i ; break ; } } if ( num == 6 ) { System . out . println ( " Do " ) ; return ; } else if ( num == 4 ) { System . out . println ( " Re " ) ; } else if ( num == 2 ) { System . out . println ( " Mi " ) ; } else if ( num == 1 ) { System . out . println ( " Fa " ) ; } else if ( num == 11 ) { System . out . println ( " So " ) ; } else if ( num == 9 ) { System . out . println ( " La " ) ; } else if ( num == 7 ) { System . out . println ( " Si " ) ; } } } class Pair implements Comparable { int from ; int end ; @ Override public int compareTo ( Object other ) { Pair otherpair = ( Pair ) other ; return end - otherpair . end ; } }


public class Main { private static java . util . Scanner scanner = new java . util . Scanner ( System . in ) ; public static void main ( String [ ] args ) { switch ( scanner . next ( ) ) { case " WBWBWWBWBWBWWBWBWWBW " : case " BWBWWBWBWBWWBWBWWBWB " : System . out . println ( " Do " ) ; return ; case " WBWWBWBWBWWBWBWWBWBW " : case " BWWBWBWBWWBWBWWBWBWB " : System . out . println ( " Re " ) ; return ; case " WWBWBWBWWBWBWWBWBWBW " : System . out . println ( " Mi " ) ; return ; case " WBWBWBWWBWBWWBWBWBWW " : case " BWBWBWWBWBWWBWBWBWWB " : System . out . println ( " Fa " ) ; return ; case " WBWBWWBWBWWBWBWBWWBW " : case " BWBWWBWBWWBWBWBWWBWB " : System . out . println ( " So " ) ; return ; case " WBWWBWBWWBWBWBWWBWBW " : case " BWWBWBWWBWBWBWWBWBWW " : System . out . println ( " La " ) ; return ; case " WWBWBWWBWBWBWWBWBWWB " : System . out . println ( " Si " ) ; } } }


import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . PrintWriter ; @ SuppressWarnings ( " unchecked " ) public class Main { static final String [ ] scales = { " Do " , " Re " , " Mi " , " Fa " , " So " , " La " , " Si " } ; static final char [ ] keys = { ' W ' , ' B ' , ' W ' , ' B ' , ' W ' , ' W ' , ' B ' , ' W ' , ' B ' , ' W ' , ' B ' , ' W ' } ; public static void main ( String [ ] args ) throws IOException { final String S ; try ( BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { S = reader . readLine ( ) ; } PrintWriter out = new PrintWriter ( System . out ) ; for ( int i = 0 ; i < scales . length ; i ++ ) { int idx = 0 ; int cnt = 0 ; for ( char c : keys ) { if ( c == S . charAt ( 0 ) ) cnt ++ ; if ( i < cnt ) break ; idx ++ ; } boolean flg = true ; for ( int j = 0 ; j < S . length ( ) ; j ++ ) { char c = S . charAt ( j ) ; if ( keys . length <= idx ) idx -= keys . length ; if ( c != keys [ idx ] ) { flg = false ; break ; } idx ++ ; } if ( flg ) { out . println ( scales [ i ] ) ; break ; } } out . flush ( ) ; } }


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] P = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { P [ i ] = sc . nextInt ( ) ; } int [ ] Q = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { Q [ P [ i ] - 1 ] = i ; } int cnt = 1 ; int ret = 1 ; int prev = Q [ 0 ] ; for ( int i = 1 ; i < N ; i ++ ) { if ( Q [ i ] > prev ) { cnt ++ ; } else { ret = Math . max ( ret , cnt ) ; cnt = 1 ; } prev = Q [ i ] ; } ret = Math . max ( ret , cnt ) ; System . out . println ( N - ret ) ; } }

import sys NEW_LINE INF = float ( ' inf ' ) NEW_LINE MOD = 10 ** 9 + 7 NEW_LINE def LI ( ) : return [ int ( x ) for x in sys . stdin . readline ( ) . split ( ) ] NEW_LINE def LI_ ( ) : return [ int ( x ) - 1 for x in sys . stdin . readline ( ) . split ( ) ] NEW_LINE def LS ( ) : return sys . stdin . readline ( ) . split ( ) NEW_LINE def II ( ) : return int ( sys . stdin . readline ( ) ) NEW_LINE def SI ( ) : return input ( ) NEW_LINE def main ( ) : NEW_LINE INDENT n = II ( ) NEW_LINE P = [ II ( ) for _ in range ( n ) ] NEW_LINE dp = [ 0 ] * ( n + 1 ) NEW_LINE for p in P : NEW_LINE INDENT dp [ p ] += dp [ p - 1 ] + 1 NEW_LINE DEDENT return n - max ( dp ) NEW_LINE DEDENT print ( main ( ) ) NEW_LINE


from functools import reduce NEW_LINE N = int ( input ( ) ) NEW_LINE P = [ int ( input ( ) ) for _ in range ( N ) ] NEW_LINE INF = 10 ** 15 NEW_LINE Q = { p : i for i , p in enumerate ( P , 1 ) } NEW_LINE ans = reduce ( lambda acc , j : ( min ( acc [ 0 ] , acc [ 1 ] + N - j + 1 ) , acc [ 1 ] if j > N or Q [ j - 1 ] < Q [ j ] else j - 1 ) , range ( 2 , N + 2 ) , ( INF , 0 ) ) [ 0 ] if N >= 2 else 0 NEW_LINE print ( ans ) NEW_LINE


import numpy as np NEW_LINE import os NEW_LINE import sys NEW_LINE sys . setrecursionlimit ( 1000000 ) NEW_LINE test_data1 = ''' \ STRNEWLINE 8 STRNEWLINE 6 STRNEWLINE 3 STRNEWLINE 1 STRNEWLINE 2 STRNEWLINE 7 STRNEWLINE 4 STRNEWLINE 8 STRNEWLINE 5 STRNEWLINE ''' NEW_LINE test_data2 = ''' \ STRNEWLINE 6 STRNEWLINE 3 STRNEWLINE 2 STRNEWLINE 5 STRNEWLINE 1 STRNEWLINE 4 STRNEWLINE 6 STRNEWLINE ''' NEW_LINE test_data3 = ''' \ STRNEWLINE 4 STRNEWLINE 1 STRNEWLINE 3 STRNEWLINE 2 STRNEWLINE 4 STRNEWLINE ''' NEW_LINE td_num = 3 NEW_LINE def GetTestData ( index ) : NEW_LINE INDENT if index == 1 : NEW_LINE INDENT return test_data1 NEW_LINE DEDENT if index == 2 : NEW_LINE INDENT return test_data2 NEW_LINE DEDENT if index == 3 : NEW_LINE INDENT return test_data3 NEW_LINE DEDENT DEDENT if False : NEW_LINE INDENT with open ( " . . / test . txt " , mode = ' w ' ) as f : NEW_LINE INDENT f . write ( GetTestData ( td_num ) ) NEW_LINE DEDENT with open ( " . . / test . txt " ) as f : NEW_LINE INDENT n = int ( f . readline ( ) ) NEW_LINE p = [ 0 ] * n NEW_LINE for i in range ( n ) : NEW_LINE INDENT p [ i ] = int ( f . readline ( ) ) NEW_LINE DEDENT DEDENT DEDENT else : NEW_LINE INDENT n = int ( input ( ) ) NEW_LINE p = [ 0 ] * n NEW_LINE for i in range ( n ) : NEW_LINE INDENT p [ i ] = int ( input ( ) ) NEW_LINE DEDENT DEDENT a = [ 0 ] * n NEW_LINE cnt = 1 NEW_LINE ans = 0 NEW_LINE for i in range ( n ) : NEW_LINE INDENT a [ p [ i ] - 1 ] = i NEW_LINE DEDENT for i in range ( n ) : NEW_LINE INDENT if i == 0 : NEW_LINE INDENT pre = a [ 0 ] NEW_LINE DEDENT else : NEW_LINE INDENT if a [ i ] > pre : NEW_LINE INDENT cnt += 1 NEW_LINE DEDENT else : NEW_LINE INDENT ans = max ( ans , cnt ) NEW_LINE cnt = 1 NEW_LINE DEDENT DEDENT ans = max ( ans , cnt ) NEW_LINE pre = a [ i ] NEW_LINE DEDENT print ( n - ans ) NEW_LINE


N = int ( input ( ) ) NEW_LINE P = [ int ( input ( ) ) for i in range ( N ) ] NEW_LINE T = [ 0 ] * ( N + 1 ) NEW_LINE for i in P : NEW_LINE INDENT if T [ i - 1 ] == 0 : NEW_LINE INDENT T [ i ] = - 1 NEW_LINE DEDENT elif T [ i - 1 ] < 0 : NEW_LINE INDENT T [ i - 1 ] -= 1 NEW_LINE T [ i ] = i - 1 NEW_LINE DEDENT else : NEW_LINE INDENT T [ T [ i - 1 ] ] -= 1 NEW_LINE T [ i ] = T [ i - 1 ] NEW_LINE DEDENT DEDENT print ( N + min ( T ) ) NEW_LINE


import sys NEW_LINE input = sys . stdin . readline NEW_LINE N = int ( input ( ) ) NEW_LINE A = [ int ( input ( ) ) - 1 for i in range ( N ) ] NEW_LINE Q = [ 0 ] * N NEW_LINE for i in range ( N ) : NEW_LINE INDENT Q [ A [ i ] ] = i NEW_LINE DEDENT num = 0 NEW_LINE s = 1 NEW_LINE t = Q [ 0 ] NEW_LINE for i in range ( 1 , N ) : NEW_LINE INDENT if t > Q [ i ] : NEW_LINE INDENT num = max ( s , num ) NEW_LINE s = 0 NEW_LINE DEDENT s += 1 NEW_LINE t = Q [ i ] NEW_LINE DEDENT num = max ( s , num ) NEW_LINE print ( N - num ) NEW_LINE