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

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 ( ) ; long [ ] L = new long [ 87 ] ; L [ 0 ] = 2 ; L [ 1 ] = 1 ; for ( int i = 2 ; i < L . length ; i ++ ) { L [ i ] = L [ i - 1 ] + L [ i - 2 ] ; } out . println ( L [ N ] ) ; } } 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 . ArrayList ; 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 ( ) ; List < Long > lucas = new ArrayList < > ( ) ; lucas . add ( 2L ) ; lucas . add ( 1L ) ; for ( int i = 2 ; i <= n ; i ++ ) { lucas . add ( lucas . get ( i - 1 ) + lucas . get ( i - 2 ) ) ; } System . out . println ( lucas . get ( n ) ) ; } }

import java . util . * ; public class Main { public static void main ( String [ ] args ) { B ( ) ; } public static void A ( ) { Scanner sc = new Scanner ( System . in ) ; Integer n = sc . nextInt ( ) ; sc . close ( ) ; String num = n . toString ( ) ; if ( num . charAt ( 1 ) != num . charAt ( 2 ) ) { System . out . println ( " No " ) ; return ; } char mid = num . charAt ( 1 ) ; if ( mid == num . charAt ( 0 ) || mid == num . charAt ( 3 ) ) { System . out . println ( " Yes " ) ; } else System . out . println ( " No " ) ; } public static void B ( ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; if ( N == 1 ) { System . out . println ( 1 ) ; return ; } sc . close ( ) ; long Li = 2 ; long Lj = 1 ; long temp ; for ( int i = 2 ; i < N + 1 ; i ++ ) { temp = Lj ; Lj = Li + Lj ; Li = temp ; } System . out . println ( Lj ) ; } }

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 ( ) ) ; long [ ] nValues = new long [ n + 1 ] ; nValues [ 0 ] = 2 ; nValues [ 1 ] = 1 ; for ( int i = 2 ; i <= n ; i ++ ) { nValues [ i ] = nValues [ i - 1 ] + nValues [ i - 2 ] ; } System . out . println ( nValues [ n ] ) ; } }

n = int ( input ( ) ) NEW_LINE l_i = 0 NEW_LINE l_i_1 = 1 NEW_LINE l_i_2 = 2 NEW_LINE if n == 1 : NEW_LINE INDENT print ( "1" ) NEW_LINE DEDENT else : NEW_LINE INDENT for i in range ( n - 1 ) : NEW_LINE INDENT l_i = 0 NEW_LINE l_i = l_i_1 + l_i_2 NEW_LINE l_i_2 = l_i_1 NEW_LINE l_i_1 = l_i NEW_LINE DEDENT print ( l_i ) NEW_LINE DEDENT

from functools import lru_cache NEW_LINE @ lru_cache ( maxsize = 1000 ) NEW_LINE def lucas ( i ) : NEW_LINE INDENT if i == 0 : NEW_LINE INDENT return 2 NEW_LINE DEDENT if i == 1 : NEW_LINE INDENT return 1 NEW_LINE DEDENT return lucas ( i - 1 ) + lucas ( i - 2 ) NEW_LINE DEDENT print ( lucas ( int ( input ( ) ) ) ) NEW_LINE

N = int ( input ( ) ) NEW_LINE ryukasu = [ 2 , 1 ] NEW_LINE for i in range ( 2 , N + 1 ) : NEW_LINE INDENT ryukasu . append ( ryukasu [ i - 1 ] + ryukasu [ i - 2 ] ) NEW_LINE DEDENT print ( ryukasu [ - 1 ] ) NEW_LINE

N = int ( input ( ) ) NEW_LINE L0 = 2 NEW_LINE L1 = 1 NEW_LINE i = N NEW_LINE while i - 1 > 0 : NEW_LINE INDENT Ln = L0 + L1 NEW_LINE i -= 1 NEW_LINE L0 = L1 NEW_LINE L1 = Ln NEW_LINE DEDENT if N == 0 : NEW_LINE INDENT print ( 2 ) NEW_LINE DEDENT elif N == 1 : NEW_LINE INDENT print ( 1 ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( Ln ) NEW_LINE DEDENT

N = int ( input ( ) ) NEW_LINE luca = [ 2 , 1 ] NEW_LINE while len ( luca ) <= N : NEW_LINE INDENT luca . append ( luca [ - 2 ] + luca [ - 1 ] ) NEW_LINE DEDENT print ( luca [ N ] ) 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 x = sc . nextInt ( ) ; int [ ] nums = new int [ n ] ; int output = 0 ; for ( int i = 0 ; i < n ; i ++ ) { nums [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < n ; i ++ ) { if ( x % Math . pow ( 2 , i + 1 ) - x % Math . pow ( 2 , i ) != 0 ) { output += nums [ i ] ; } } System . out . println ( output ) ; } }

import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String nx = scanner . nextLine ( ) ; String price = scanner . nextLine ( ) ; scanner . close ( ) ; int n = Integer . parseInt ( nx . split ( " ▁ " ) [ 0 ] ) ; int x = Integer . parseInt ( nx . split ( " ▁ " ) [ 1 ] ) ; String [ ] prices = price . split ( " ▁ " ) ; String bitX = Integer . toBinaryString ( x ) ; int toAddZero = n - bitX . length ( ) ; for ( int i = 0 ; i < toAddZero ; i ++ ) { bitX = "0" + bitX ; } boolean [ ] shouldAdd = new boolean [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { String bit = bitX . substring ( bitX . length ( ) - 1 - i , bitX . length ( ) - i ) ; shouldAdd [ i ] = bit . equals ( "1" ) ; } int sumPrice = 0 ; for ( int i = 0 ; i < shouldAdd . length ; i ++ ) { if ( shouldAdd [ i ] ) { sumPrice += Integer . parseInt ( prices [ i ] ) ; } } System . out . println ( sumPrice ) ; } }

import java . util . ArrayList ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { ArrayList < Long > mo = new ArrayList < Long > ( ) ; long answer = 0 ; Scanner sc = new Scanner ( System . in ) ; int num = sc . nextInt ( ) ; int du = sc . nextInt ( ) ; String d = Integer . toBinaryString ( du ) ; for ( int i = 0 ; i != d . length ( ) ; i ++ ) { int c = sc . nextInt ( ) ; if ( d . charAt ( d . length ( ) - 1 - i ) == '1' ) { answer += c ; } } System . out . println ( + answer ) ; } }

import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long x = sc . nextLong ( ) ; char [ ] _list = Long . toBinaryString ( x ) . toCharArray ( ) ; char [ ] list = new char [ n ] ; for ( int i = 0 ; i < _list . length ; i ++ ) { list [ i ] = _list [ _list . length - i - 1 ] ; } int totalPrice = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int price = sc . nextInt ( ) ; if ( list [ i ] == '1' ) { totalPrice += price ; } } System . out . println ( totalPrice ) ; } }

import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String [ ] line = scanner . nextLine ( ) . split ( " ▁ " , 2 ) ; int n = Integer . parseInt ( line [ 0 ] ) ; int x = Integer . parseInt ( line [ 1 ] ) ; int result = 0 ; line = scanner . nextLine ( ) . split ( " ▁ " , n ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( ( x & ( 1 << i ) ) != 0 ) { result += Integer . parseInt ( line [ i ] ) ; } } System . out . println ( result ) ; } }

n , x = map ( int , input ( ) . split ( ) ) NEW_LINE a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE y = format ( x , " b " ) NEW_LINE y = list ( y ) [ : : - 1 ] NEW_LINE res = 0 NEW_LINE for i in range ( len ( y ) ) : NEW_LINE INDENT if y [ i ] == "1" : NEW_LINE INDENT res += a [ i ] NEW_LINE DEDENT DEDENT print ( res ) NEW_LINE

N , K = [ int ( _ ) for _ in input ( ) . split ( ) ] NEW_LINE A = [ int ( _ ) for _ in input ( ) . split ( ) ] NEW_LINE res = 0 NEW_LINE for i in range ( N ) : NEW_LINE INDENT if ( K >> i ) & 1 == 1 : NEW_LINE INDENT res += A [ i ] NEW_LINE DEDENT DEDENT print ( res ) NEW_LINE

n , X = map ( int , input ( ) . split ( ) ) NEW_LINE price = [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE X_bin = format ( X , '0' + str ( n ) + ' b ' ) NEW_LINE ans = 0 NEW_LINE for i in range ( n ) : NEW_LINE INDENT if X_bin [ i ] == '1' : NEW_LINE INDENT ans += price [ n - 1 - i ] NEW_LINE DEDENT DEDENT print ( ans ) NEW_LINE

list = input ( ) . split ( " ▁ " ) NEW_LINE a = input ( ) . split ( " ▁ " ) NEW_LINE b = int ( list [ 1 ] ) NEW_LINE sum = 0 NEW_LINE for i in range ( int ( list [ 0 ] ) ) : NEW_LINE INDENT if b % 2 == 1 : NEW_LINE INDENT sum += int ( a [ i ] ) NEW_LINE DEDENT b = b // 2 NEW_LINE DEDENT print ( sum ) NEW_LINE

n , X = map ( int , input ( ) . split ( ) ) NEW_LINE a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE bX = bin ( X ) [ 2 : ] NEW_LINE bX = '0' * ( n - len ( bX ) ) + bX NEW_LINE print ( sum ( [ e for e , _ in zip ( reversed ( a ) , list ( bX ) ) if _ == '1' ] ) ) NEW_LINE


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long n = sc . nextLong ( ) , k = sc . nextLong ( ) ; long [ ] divs = divs ( n ) ; int nd = divs . length ; long mod = 1000000007 ; HashMap < Long , Long > map = new HashMap < > ( ) ; long res = 0 ; for ( int i = 0 ; i < nd ; i ++ ) { long div = divs [ i ] ; long [ ] dd = divs ( div ) ; long nama = modPow ( k , ( div + 1 ) / 2 , mod ) ; for ( int j = 0 ; j < dd . length - 1 ; j ++ ) { nama = ( nama - map . get ( dd [ j ] ) + mod ) % mod ; } map . put ( div , nama ) ; long coef = ( div % 2 == 1 ? div : div / 2 ) ; res = ( res + nama * coef % mod ) % mod ; } System . out . println ( res ) ; } static long modPow ( long a , long b , long mod ) { long res = 1 ; long c = a ; while ( b > 0 ) { if ( b % 2 == 1 ) res = res * c % mod ; c = c * c % mod ; b /= 2 ; } return res ; } static long [ ] divs ( long x ) { long [ ] res = new long [ ( int ) ( Math . sqrt ( x ) + 2 ) * 2 ] ; int size = 0 ; long i = 1 ; for ( ; i * i < x ; i ++ ) { if ( x % i > 0 ) continue ; res [ size ++ ] = i ; } if ( i * i == x ) res [ size ++ ] = i ; i -- ; for ( ; i > 0 ; i -- ) { if ( x % i > 0 ) continue ; res [ size ++ ] = x / i ; } return Arrays . copyOf ( res , size ) ; } }

import java . util . * ; public class Main { final static long MODULO = 1_000_000_000 + 7 ; static ArrayList < Integer > divs ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; long K = sc . nextLong ( ) ; divs = new ArrayList < > ( ) ; for ( int i = 1 ; i * i <= N ; ++ i ) { if ( N % i == 0 ) { divs . add ( i ) ; if ( i * i != N ) { divs . add ( N / i ) ; } } } Collections . sort ( divs ) ; HashMap < Integer , Long > dp = new HashMap < > ( ) ; for ( int d : divs ) { dp . put ( d , pow ( K , ( d + 1 ) / 2 ) ) ; for ( int i = 0 ; divs . get ( i ) < d ; ++ i ) { if ( d % divs . get ( i ) == 0 ) dp . put ( d , ( dp . get ( d ) - dp . get ( divs . get ( i ) ) + MODULO ) % MODULO ) ; } } long ans = 0 ; for ( int d : divs ) { ans = ( ans + dp . get ( d ) * ( d % 2 == 0 ? d / 2 : d ) ) % MODULO ; } System . out . println ( ans ) ; } static class Div { int div ; int num ; public Div ( int div , int num ) { this . div = div ; this . num = num ; } } static long pow ( long a , long n ) { long ret = 1 ; for ( ; n > 0 ; n >>= 1 , a = ( a * a ) % MODULO ) { if ( n % 2 == 1 ) { ret = ( ret * a ) % MODULO ; } } return ret ; } }

import java . util . ArrayList ; import java . util . Collections ; import java . util . HashMap ; import java . util . Scanner ; public class Main { static Scanner sc = new Scanner ( System . in ) ; static final long MOD = 1_000_000_007 ; public static void main ( String [ ] args ) { long N = sc . nextInt ( ) ; long K = sc . nextInt ( ) ; if ( N == 1 ) { System . out . println ( K ) ; return ; } ArrayList < Long > divisor = new ArrayList < > ( ) ; for ( long i = 2 ; i * i <= N ; i ++ ) { if ( N % i != 0 ) continue ; divisor . add ( i ) ; if ( i * i != N ) { divisor . add ( N / i ) ; } } divisor . add ( N ) ; Collections . sort ( divisor ) ; HashMap < Long , Long > map = new HashMap < > ( ) ; map . put ( 1L , K ) ; for ( long d : divisor ) { long add = pow ( K , ( d + 1 ) / 2 ) - K ; for ( long i = 2 ; i * i <= d ; i ++ ) { if ( d % i != 0 ) continue ; add += MOD - map . get ( i ) ; if ( i * i != d ) add += MOD - map . get ( d / i ) ; } map . put ( d , add % MOD ) ; } long ans = 0 ; for ( long k : map . keySet ( ) ) { ans += ( k % 2 == 0 ? k / 2 : k ) * map . get ( k ) ; } System . out . println ( ans % MOD ) ; } static long pow ( long base , long p ) { if ( p == 0 ) return 1 ; if ( p == 1 ) return base ; long ret = pow ( base , p / 2 ) ; ret = ret * ret % MOD ; if ( p % 2 == 1 ) { ret = ret * base % MOD ; } return ret ; } }

N , K = map ( int , input ( ) . split ( ) ) NEW_LINE S = [ ] ; T = [ ] NEW_LINE for x in range ( 1 , int ( N ** .5 ) + 1 ) : NEW_LINE INDENT if N % x == 0 : NEW_LINE INDENT S . append ( x ) NEW_LINE if x * x < N : NEW_LINE INDENT T . append ( N // x ) NEW_LINE DEDENT DEDENT DEDENT T . reverse ( ) NEW_LINE S += T NEW_LINE M = len ( S ) NEW_LINE U = [ ] NEW_LINE MOD = 10 ** 9 + 7 NEW_LINE ans = 0 NEW_LINE v = 0 NEW_LINE for i in range ( M ) : NEW_LINE INDENT x = S [ i ] NEW_LINE v = pow ( K , ( x + 1 ) // 2 , MOD ) NEW_LINE for j in range ( i ) : NEW_LINE INDENT y = S [ j ] NEW_LINE if x % y == 0 : NEW_LINE INDENT v -= U [ j ] NEW_LINE DEDENT DEDENT U . append ( v % MOD ) NEW_LINE ans = ( ans + ( v * x if x & 1 else v * ( x // 2 ) ) ) % MOD NEW_LINE DEDENT print ( ans ) NEW_LINE


import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Main main = new Main ( ) ; main . solve ( ) ; } void solve ( ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; List < Integer > list = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < n ; i ++ ) list . add ( Integer . parseInt ( sc . next ( ) ) ) ; sc . close ( ) ; List < Integer > res = new ArrayList < Integer > ( ) ; for ( int i = n - 1 ; i >= 0 ; i -- ) { for ( int j = i ; j >= 0 ; j -- ) { if ( list . get ( j ) == j + 1 ) { res . add ( j + 1 ) ; list . remove ( j ) ; break ; } } } if ( res . size ( ) == n ) for ( int i = n - 1 ; i >= 0 ; i -- ) System . out . println ( res . get ( i ) ) ; else System . out . println ( - 1 ) ; } }

import java . util . * ; import java . io . * ; import java . awt . * ; import java . awt . geom . Point2D ; import static java . lang . Math . * ; public class Main { public static void main ( String [ ] $ ) { int n = sc . nextInt ( ) ; ArrayList < Integer > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { list . add ( sc . nextInt ( ) ) ; } ArrayDeque < Integer > ans = new ArrayDeque < > ( ) ; int c = 1 ; while ( c == 1 && ! list . isEmpty ( ) ) { for ( int i = list . size ( ) - 1 ; i > - 1 ; i -- ) { if ( list . get ( i ) == i + 1 ) { ans . push ( list . get ( i ) ) ; list . remove ( i ) ; c = 1 ; break ; } else c = 0 ; } } if ( list . size ( ) > 0 ) { out . println ( - 1 ) ; } else { while ( ! ans . isEmpty ( ) ) { out . println ( ans . pop ( ) ) ; } } out . close ( ) ; } static PrintWriter out = new PrintWriter ( System . out ) ; static class sc { static Scanner s = new Scanner ( System . in ) ; static String next ( ) { return s . next ( ) ; } static int nextInt ( ) { return Integer . parseInt ( s . next ( ) ) ; } static long nextLong ( ) { return Long . parseLong ( s . next ( ) ) ; } static double nextDouble ( ) { return Double . parseDouble ( s . next ( ) ) ; } } }

import java . util . * ; import static java . lang . System . * ; public class Main { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int N = ni ( ) ; List < Integer > b = new ArrayList < > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { b . add ( sc . nextInt ( ) ) ; } List < Integer > seq = new ArrayList < > ( ) ; boolean canPick = true ; while ( canPick ) { canPick = false ; for ( int i = b . size ( ) - 1 ; i >= 0 ; i -- ) { if ( b . get ( i ) == i + 1 ) { b . remove ( i ) ; seq . add ( i + 1 ) ; canPick = true ; break ; } } } if ( b . isEmpty ( ) ) { Collections . reverse ( seq ) ; for ( int s : seq ) { out . println ( s ) ; } } else { out . println ( - 1 ) ; } } static int ni ( ) { return sc . nextInt ( ) ; } static long nl ( ) { return sc . nextLong ( ) ; } static String ns ( ) { return sc . next ( ) ; } static int [ ] niarr ( int N ) { int [ ] a = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } return a ; } static long [ ] nlarr ( int N ) { long [ ] a = new long [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { a [ i ] = sc . nextLong ( ) ; } return a ; } }

import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; boolean flag = false , imposible = false ; ArrayList < Integer > a = new ArrayList < Integer > ( ) ; ArrayList < Integer > b = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { b . add ( sc . nextInt ( ) ) ; } for ( int i = 0 ; i < n ; i ++ ) { for ( int j = b . size ( ) - 1 ; 0 <= j ; j -- ) { if ( b . get ( j ) == j + 1 ) { a . add ( j + 1 ) ; b . remove ( j ) ; flag = true ; break ; } } if ( flag == false ) { imposible = true ; break ; } else { flag = false ; } } if ( imposible == true ) { System . out . println ( - 1 ) ; } else { for ( int i = a . size ( ) - 1 ; 0 <= i ; i -- ) { System . out . println ( a . get ( i ) ) ; } } } }

import java . util . * ; import java . io . * ; import static java . lang . System . in ; public class Main { static int n , k ; static long mod = 1000000000 + 7 ; static long [ ] fac , inv ; static int [ ] id , size ; static ArrayList < Integer > ans = new ArrayList < > ( ) ; static boolean flag = true ; public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; ArrayList < Integer > rec = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) rec . add ( sc . nextInt ( ) ) ; LinkedList < Integer > ans = new LinkedList < > ( ) ; while ( rec . size ( ) > 0 ) { int idx = - 1 ; for ( int i = rec . size ( ) - 1 ; i >= 0 ; i -- ) { if ( rec . get ( i ) == i + 1 ) { idx = i ; break ; } } if ( idx == - 1 ) break ; ans . addFirst ( rec . get ( idx ) ) ; rec . remove ( idx ) ; } if ( ans . size ( ) != n ) System . out . println ( - 1 ) ; else { for ( int w : ans ) System . out . println ( w ) ; } } }

import sys NEW_LINE N = int ( input ( ) ) NEW_LINE b = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE ans = [ ] NEW_LINE while len ( b ) > 0 : NEW_LINE INDENT poped = False NEW_LINE for i in range ( len ( b ) - 1 , - 1 , - 1 ) : NEW_LINE INDENT if i + 1 == b [ i ] : NEW_LINE INDENT ans . append ( b . pop ( i ) ) NEW_LINE poped = True NEW_LINE break NEW_LINE DEDENT DEDENT if not poped : NEW_LINE INDENT print ( - 1 ) NEW_LINE sys . exit ( ) NEW_LINE DEDENT DEDENT ans . reverse ( ) NEW_LINE for a in ans : NEW_LINE INDENT print ( a ) NEW_LINE DEDENT

_ , s = open ( 0 ) ; a = [ ' ' ] NEW_LINE for i in s . split ( ) : a . insert ( int ( i ) - 1 , i ) NEW_LINE print ( * a [ - 1 ] and [ - 1 ] or a ) NEW_LINE

listOutput = list ( ) NEW_LINE listInput = list ( ) NEW_LINE nNum = int ( input ( ) ) NEW_LINE strInput = input ( ) NEW_LINE listInput = strInput . split ( ) NEW_LINE while ( len ( listInput ) > 0 ) and ( ( nNum - 1 ) >= 0 ) : NEW_LINE INDENT if int ( listInput [ nNum - 1 ] ) == nNum : NEW_LINE INDENT listOutput . insert ( 0 , nNum ) NEW_LINE del listInput [ nNum - 1 ] NEW_LINE nNum = len ( listInput ) NEW_LINE continue NEW_LINE DEDENT nNum -= 1 NEW_LINE DEDENT if len ( listInput ) == 0 : NEW_LINE INDENT while ( len ( listOutput ) > 0 ) : NEW_LINE INDENT print ( listOutput . pop ( 0 ) ) NEW_LINE DEDENT DEDENT else : NEW_LINE INDENT print ( ' - 1' ) NEW_LINE DEDENT

N = int ( input ( ) ) NEW_LINE b = [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE a = [ 0 for i in range ( N ) ] NEW_LINE number = [ ] NEW_LINE for j in range ( N ) : NEW_LINE INDENT for i in range ( len ( b ) - 1 , - 1 , - 1 ) : NEW_LINE INDENT if ( i + 1 == b [ i ] and a [ i ] == 0 ) : NEW_LINE INDENT del a [ i ] NEW_LINE number . append ( b [ i ] ) NEW_LINE del b [ i ] NEW_LINE break NEW_LINE DEDENT DEDENT DEDENT if ( not a ) : NEW_LINE INDENT for i in range ( N ) : NEW_LINE INDENT print ( number . pop ( ) ) NEW_LINE DEDENT DEDENT if ( a ) : NEW_LINE INDENT print ( - 1 ) NEW_LINE DEDENT

a = [ ] NEW_LINE num_len = int ( input ( ) ) NEW_LINE b = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE N = 100 NEW_LINE for i in range ( num_len ) : NEW_LINE INDENT if b [ i ] - 1 <= len ( a ) : NEW_LINE INDENT a . insert ( b [ i ] - 1 , b [ i ] ) NEW_LINE flag = True NEW_LINE DEDENT else : NEW_LINE INDENT flag = False NEW_LINE break NEW_LINE DEDENT DEDENT if flag : NEW_LINE INDENT for i in a : NEW_LINE INDENT print ( i ) NEW_LINE DEDENT DEDENT else : NEW_LINE INDENT print ( - 1 ) NEW_LINE DEDENT


import java . util . Map ; import java . util . Scanner ; import java . util . TreeMap ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; long [ ] A = new long [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { A [ i ] = sc . nextLong ( ) ; } sc . close ( ) ; long [ ] b = new long [ N + 1 ] ; for ( int i = 0 ; i < N ; i ++ ) { b [ i + 1 ] = b [ i ] + A [ i ] ; } Map < Long , Long > m = new TreeMap < Long , Long > ( ) ; for ( int i = 1 ; i <= N ; i ++ ) { m . merge ( b [ i ] , 1l , ( v1 , v2 ) -> ( v1 + v2 ) ) ; } long ans = 0 ; for ( long k : m . keySet ( ) ) { if ( k == 0 ) { long t = m . get ( k ) ; ans += t * ( t + 1 ) / 2 ; } else { long t = m . get ( k ) ; ans += t * ( t - 1 ) / 2 ; } } System . out . println ( ans ) ; } }

import java . util . * ; import static java . lang . System . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; long [ ] a = new long [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { a [ i ] = sc . nextLong ( ) ; } long [ ] acc = new long [ N + 1 ] ; for ( int i = 0 ; i < N ; i ++ ) { acc [ i + 1 ] = acc [ i ] + a [ i ] ; } Map < Long , Integer > cnts = new HashMap < > ( ) ; for ( int i = 0 ; i <= N ; i ++ ) { int cnt = cnts . containsKey ( acc [ i ] ) ? cnts . get ( acc [ i ] ) : 0 ; cnts . put ( acc [ i ] , ++ cnt ) ; } long ans = 0 ; for ( Map . Entry e : cnts . entrySet ( ) ) { int num = ( int ) e . getValue ( ) ; ans += ( long ) num * ( num - 1 ) / 2 ; } out . println ( ans ) ; } }

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 ; import org . omg . PortableInterceptor . SYSTEM_EXCEPTION ; public class Main { Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { new Main ( ) ; } public Main ( ) { new Test_200 ( ) . doIt ( ) ; } class Test_200 { void doIt ( ) { int N = sc . nextInt ( ) ; long S [ ] = new long [ N + 1 ] ; S [ 0 ] = 0 ; for ( int i = 1 ; i < N + 1 ; i ++ ) { S [ i ] = S [ i - 1 ] + sc . nextLong ( ) ; } Arrays . sort ( S ) ; long ans = 0 ; long cnt = 0 ; for ( int i = 1 ; i < N + 1 ; i ++ ) { if ( S [ i ] == S [ i - 1 ] ) { cnt ++ ; ans = ans + cnt ; } else cnt = 0 ; } System . out . println ( ans ) ; } } }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . HashMap ; public class Main { static long t [ ] ; static long l [ ] ; static long h [ ] ; public static void main ( String [ ] args ) throws IOException { BufferedReader r = new BufferedReader ( new InputStreamReader ( System . in ) , 1 ) ; String s ; String sl [ ] ; s = r . readLine ( ) ; int n = Integer . parseInt ( s ) ; HashMap < Long , Long > m = new HashMap < > ( ) ; m . put ( 0L , 1L ) ; long a = 0 ; long v = 0 ; s = r . readLine ( ) ; sl = s . split ( " ▁ " ) ; for ( int i = 0 ; i < n ; i ++ ) { v += Long . parseLong ( sl [ i ] ) ; Long z = m . get ( v ) ; if ( z != null && z > 0 ) { a += z ; } z = m . getOrDefault ( v , 0L ) ; m . put ( v , z + 1 ) ; } System . out . println ( a ) ; } }

import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) + 1 ; long [ ] nums = new long [ n ] ; nums [ 0 ] = 0 ; long output = 0 ; for ( int i = 1 ; i < n ; i ++ ) { nums [ i ] = sc . nextInt ( ) ; } for ( int i = 1 ; i < n ; i ++ ) { nums [ i ] += nums [ i - 1 ] ; } Arrays . sort ( nums ) ; long tmp = Integer . MIN_VALUE ; int outtmp = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( tmp == nums [ i ] ) { outtmp ++ ; if ( i == n - 1 ) { i -- ; tmp = Integer . MIN_VALUE ; } } else { if ( outtmp > 1 ) { output += nc2 ( outtmp ) ; } tmp = nums [ i ] ; outtmp = 1 ; } } System . out . println ( output ) ; } static long nc2 ( long input ) { long output = 1 ; output = input * ( input - 1 ) / 2 ; return output ; } }

n = int ( input ( ) ) NEW_LINE a = list ( int ( i ) for i in input ( ) . split ( ) ) NEW_LINE sa = [ 0 ] * ( n + 1 ) NEW_LINE num_cnt = { } NEW_LINE for i in range ( n ) : NEW_LINE INDENT sa [ i + 1 ] = sa [ i ] + a [ i ] NEW_LINE DEDENT for num in sa : NEW_LINE INDENT if num in num_cnt : NEW_LINE INDENT num_cnt [ num ] += 1 NEW_LINE DEDENT else : NEW_LINE INDENT num_cnt [ num ] = 1 NEW_LINE DEDENT DEDENT res = 0 NEW_LINE for cnt in num_cnt . values ( ) : NEW_LINE INDENT res += cnt * ( cnt - 1 ) // 2 NEW_LINE DEDENT print ( res ) NEW_LINE

import collections , itertools ; input ( ) ; print ( sum ( ( s * ( s - 1 ) ) // 2 for s in collections . Counter ( ( i for i in itertools . accumulate ( [ 0 ] + [ int ( i ) for i in input ( ) . split ( ) ] ) ) ) . values ( ) ) ) NEW_LINE

from itertools import * NEW_LINE from operator import mul NEW_LINE from functools import reduce NEW_LINE from collections import * NEW_LINE n , * a = map ( int , open ( 0 ) . read ( ) . split ( ) ) NEW_LINE def cmb ( n , r ) : NEW_LINE INDENT r = min ( n - r , r ) NEW_LINE if r == 0 : return 1 NEW_LINE over = reduce ( mul , range ( n , n - r , - 1 ) ) NEW_LINE under = reduce ( mul , range ( 1 , r + 1 ) ) NEW_LINE return over // under NEW_LINE DEDENT b = list ( accumulate ( a ) ) NEW_LINE print ( sum ( cmb ( v , 2 ) for k , v in Counter ( b ) . items ( ) if v > 1 ) + b . count ( 0 ) ) NEW_LINE

import sys NEW_LINE def main ( ) : NEW_LINE INDENT N = int ( input ( ) ) NEW_LINE A = input ( ) . split ( " ▁ " ) NEW_LINE A = [ int ( s ) for s in A ] NEW_LINE maps = [ 0 ] * ( len ( A ) ) NEW_LINE for i , val in enumerate ( A ) : NEW_LINE INDENT maps [ i ] = maps [ i - 1 ] + val NEW_LINE DEDENT maps . append ( 0 ) NEW_LINE counts = { } NEW_LINE for i , val in enumerate ( maps ) : NEW_LINE INDENT if val in counts : NEW_LINE INDENT counts [ val ] += 1 NEW_LINE DEDENT else : NEW_LINE INDENT counts [ val ] = 1 NEW_LINE DEDENT DEDENT ans = 0 NEW_LINE for key , val in counts . items ( ) : NEW_LINE INDENT if val == 1 : NEW_LINE INDENT continue NEW_LINE DEDENT for i in range ( val - 1 , 0 , - 1 ) : NEW_LINE INDENT ans += i NEW_LINE DEDENT DEDENT print ( ans ) NEW_LINE DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT main ( ) NEW_LINE DEDENT

from collections import defaultdict NEW_LINE N = int ( input ( ) ) NEW_LINE A = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE dp = defaultdict ( int , { 0 : 1 } ) NEW_LINE s = 0 NEW_LINE ans = 0 NEW_LINE for a in A : NEW_LINE INDENT s += a NEW_LINE ans += dp [ s ] NEW_LINE dp [ s ] += 1 NEW_LINE DEDENT print ( ans ) NEW_LINE


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 . 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 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 ; } } } }

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 ( ) ) ; } } }

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 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 . 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 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 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 { 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 ) ; } }

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 ) ; } }

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 . 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 " ) ; } }

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 " ) ; } } }

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 . 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 ( ) { } }

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 ) ) ; } }

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 . * ; 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 ] ; } } }

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 ; } } }

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 . 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 ) ; } } }

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 ) ; } }

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 . 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 " ) ; } }

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 " ) ; } } }

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