import java . io . BufferedReader ; import java . io . File ; import java . io . FileNotFoundException ; import java . io . FileReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . util . HashMap ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) throws Throwable { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; HashMap < Integer , Integer > dp = new HashMap ( ) ; int res = 0 ; for ( int i = 0 ; i < n ; ++ i ) { int x = sc . nextInt ( ) ; dp . put ( x , dp . getOrDefault ( x - 1 , 0 ) + 1 ) ; res = Math . max ( res , dp . get ( x ) ) ; } System . out . println ( n - res ) ; } static class Scanner { StringTokenizer st ; BufferedReader br ; public Scanner ( InputStream s ) { br = new BufferedReader ( new InputStreamReader ( s ) ) ; } public Scanner ( String s ) throws FileNotFoundException { br = new BufferedReader ( new FileReader ( new File ( s ) ) ) ; } public String next ( ) throws IOException { while ( st == null || ! st . hasMoreTokens ( ) ) st = new StringTokenizer ( br . readLine ( ) ) ; return st . nextToken ( ) ; } public int nextInt ( ) throws IOException { return Integer . parseInt ( next ( ) ) ; } public long nextLong ( ) throws IOException { return Long . parseLong ( next ( ) ) ; } public String nextLine ( ) throws IOException { return br . readLine ( ) ; } public double nextDouble ( ) throws IOException { return Double . parseDouble ( next ( ) ) ; } public boolean ready ( ) throws IOException { return br . ready ( ) ; } } } Note : . / Main . java uses unchecked or unsafe operations . Note : Recompile with - Xlint : unchecked for details .


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


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


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


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


import java . util . * ; import java . awt . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] p_index = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { p_index [ sc . nextInt ( ) - 1 ] = i ; } int ans = 0 ; int count = 0 ; int prev_index = - 1 ; for ( int i = 0 ; i < n ; i ++ ) { if ( p_index [ i ] > prev_index ) { count ++ ; } else { ans = Math . max ( ans , count ) ; count = 1 ; } prev_index = p_index [ i ] ; } ans = Math . max ( ans , count ) ; System . out . println ( n - ans ) ; } }

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


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


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 + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) A [ i ] = sc . nextInt ( ) ; int [ ] rec = new int [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) rec [ A [ i ] ] = i ; int [ ] dp = new int [ n + 1 ] ; Arrays . fill ( dp , 1 ) ; boolean [ ] visited = new boolean [ n + 1 ] ; for ( int i = 1 ; i <= n - 1 ; i ++ ) { if ( visited [ i ] ) continue ; visited [ i ] = true ; int cur = i ; int len = 1 ; while ( cur <= n - 1 && rec [ cur + 1 ] > rec [ cur ] ) { cur ++ ; len ++ ; visited [ cur ] = true ; } dp [ i ] = len ; } int res = 0 ; for ( int i = 1 ; i <= n ; i ++ ) res = Math . max ( dp [ i ] , res ) ; System . out . println ( n - res ) ; } }


import java . util . * ; import static java . lang . System . * ; public class Main { public static void main ( String [ ] $ ) { Scanner sc = new Scanner ( in ) ; int n = sc . nextInt ( ) , m = sc . nextInt ( ) ; int [ ] a = new int [ 200001 ] ; int [ ] b = new int [ 200001 ] ; HashSet < Integer > [ ] via = new HashSet [ 200001 ] ; if ( n == 200001 || m == 200001 ) { while ( true ) { } } for ( int i = 1 ; i <= 200000 ; i ++ ) { via [ i ] = new HashSet < > ( ) ; } for ( int i = 0 ; i < m ; i ++ ) { a [ i ] = sc . nextInt ( ) ; b [ i ] = sc . nextInt ( ) ; via [ a [ i ] ] . add ( b [ i ] ) ; via [ b [ i ] ] . add ( a [ i ] ) ; } for ( Integer k : via [ 1 ] ) { for ( Integer l : via [ k ] ) { if ( l == n ) { out . println ( " POSSIBLE " ) ; exit ( 0 ) ; } } } out . println ( " IMPOSSIBLE " ) ; } } Note : . / Main . java uses unchecked or unsafe operations . Note : Recompile with - Xlint : unchecked for details .

a , b = map ( int , input ( ) . split ( " ▁ " ) ) NEW_LINE ar = [ [ ] for i in range ( a + 1 ) ] NEW_LINE for i in range ( b ) : NEW_LINE INDENT l = list ( map ( int , input ( ) . split ( " ▁ " ) ) ) NEW_LINE ar [ l [ 0 ] ] . append ( l [ 1 ] ) NEW_LINE ar [ l [ 1 ] ] . append ( l [ 0 ] ) NEW_LINE DEDENT for r in ar [ 1 ] : NEW_LINE INDENT if a in ar [ r ] : NEW_LINE INDENT print ( " POSSIBLE " ) NEW_LINE exit ( ) NEW_LINE DEDENT DEDENT print ( " IMPOSSIBLE " ) NEW_LINE


def main ( ) : NEW_LINE INDENT n , m = map ( int , input ( ) . split ( ) ) NEW_LINE is_included_1 = set ( ) NEW_LINE is_included_n = set ( ) NEW_LINE for i in range ( m ) : NEW_LINE INDENT ai , bi = map ( int , input ( ) . split ( ) ) NEW_LINE if ai == 1 : NEW_LINE INDENT is_included_1 . add ( bi ) NEW_LINE DEDENT elif bi == 1 : NEW_LINE INDENT is_included_1 . add ( ai ) NEW_LINE DEDENT if ai == n : NEW_LINE INDENT is_included_n . add ( bi ) NEW_LINE DEDENT elif bi == n : NEW_LINE INDENT is_included_n . add ( ai ) NEW_LINE DEDENT DEDENT if len ( is_included_1 & is_included_n ) > 0 : NEW_LINE INDENT print ( ' POSSIBLE ' ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( ' IMPOSSIBLE ' ) NEW_LINE DEDENT DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT main ( ) NEW_LINE DEDENT


class UnionFind : NEW_LINE INDENT def __init__ ( self , n ) : NEW_LINE INDENT self . par = [ i for i in range ( n + 1 ) ] NEW_LINE self . rank = [ 0 ] * ( n + 1 ) NEW_LINE DEDENT def find ( self , x ) : NEW_LINE INDENT if self . par [ x ] == x : NEW_LINE INDENT return x NEW_LINE DEDENT else : NEW_LINE INDENT self . par [ x ] = self . find ( self . par [ x ] ) NEW_LINE return self . par [ x ] NEW_LINE DEDENT DEDENT def union ( self , x , y ) : NEW_LINE INDENT x = self . find ( x ) NEW_LINE y = self . find ( y ) NEW_LINE if self . rank [ x ] < self . rank [ y ] : NEW_LINE INDENT self . par [ x ] = y NEW_LINE DEDENT else : NEW_LINE INDENT self . par [ y ] = x NEW_LINE if self . rank [ x ] == self . rank [ y ] : NEW_LINE INDENT self . rank [ x ] += 1 NEW_LINE DEDENT DEDENT DEDENT def same_check ( self , x , y ) : NEW_LINE INDENT return self . find ( x ) == self . find ( y ) NEW_LINE DEDENT DEDENT n , m = ( int ( i ) for i in input ( ) . split ( ) ) NEW_LINE uf = UnionFind ( n - 1 ) NEW_LINE for i in range ( m ) : NEW_LINE INDENT a , b = ( int ( i ) for i in input ( ) . split ( ) ) NEW_LINE if a == 1 or b == n : uf . union ( a - 1 , b - 1 ) NEW_LINE DEDENT if uf . same_check ( 0 , n - 1 ) : print ( ' POSSIBLE ' ) NEW_LINE else : print ( ' IMPOSSIBLE ' ) NEW_LINE


import heapq NEW_LINE import sys NEW_LINE input = sys . stdin . readline NEW_LINE N , M = map ( int , input ( ) . split ( ) ) NEW_LINE cand_1 = [ ] NEW_LINE cand_2 = [ ] NEW_LINE for _ in range ( M ) : NEW_LINE INDENT a , b = map ( int , input ( ) . split ( ) ) NEW_LINE if a == 1 : NEW_LINE INDENT cand_1 . append ( b ) NEW_LINE DEDENT elif b == N : NEW_LINE INDENT cand_2 . append ( a ) NEW_LINE DEDENT DEDENT ans = " IMPOSSIBLE " NEW_LINE heapq . heapify ( cand_1 ) NEW_LINE heapq . heapify ( cand_2 ) NEW_LINE while len ( cand_1 ) != 0 and len ( cand_2 ) != 0 : NEW_LINE INDENT if cand_1 [ 0 ] < cand_2 [ 0 ] : NEW_LINE INDENT heapq . heappop ( cand_1 ) NEW_LINE DEDENT elif cand_1 [ 0 ] > cand_2 [ 0 ] : NEW_LINE INDENT heapq . heappop ( cand_2 ) NEW_LINE DEDENT else : NEW_LINE INDENT ans = " POSSIBLE " NEW_LINE break NEW_LINE DEDENT DEDENT print ( ans ) NEW_LINE


from collections import deque NEW_LINE def dfs ( path ) : NEW_LINE INDENT global visited , A NEW_LINE q = deque ( [ ] ) NEW_LINE q . append ( path ) NEW_LINE for d in A [ 1 ] : NEW_LINE INDENT q . append ( d ) NEW_LINE DEDENT while q : NEW_LINE INDENT p = q . pop ( ) NEW_LINE for d in A [ p ] : NEW_LINE INDENT if visited [ d ] == True : NEW_LINE INDENT pass NEW_LINE DEDENT else : NEW_LINE INDENT visited [ d ] = True NEW_LINE DEDENT DEDENT DEDENT DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT N , M = map ( int , input ( ) . split ( ) ) NEW_LINE A = [ [ ] for _ in range ( N + 1 ) ] NEW_LINE for _ in range ( M ) : NEW_LINE INDENT a , b = map ( int , input ( ) . split ( ) ) NEW_LINE A [ a ] . append ( b ) NEW_LINE A [ b ] . append ( a ) NEW_LINE DEDENT visited = [ False ] * ( N + 1 ) NEW_LINE dfs ( 1 ) NEW_LINE if visited [ N ] : NEW_LINE INDENT print ( " POSSIBLE " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " IMPOSSIBLE " ) NEW_LINE DEDENT DEDENT


import java . util . Collections ; import java . util . List ; import java . util . Scanner ; import java . util . ArrayList ; import java . util . Stack ; public class Main { public static void main ( String [ ] args ) { Scanner stdin = new Scanner ( System . in ) ; int N , M ; int a , b ; List < Integer > alist = new ArrayList < Integer > ( ) ; List < Integer > blist = new ArrayList < Integer > ( ) ; N = stdin . nextInt ( ) ; M = stdin . nextInt ( ) ; for ( int i = 1 ; i <= M ; i ++ ) { a = stdin . nextInt ( ) ; b = stdin . nextInt ( ) ; if ( a == 1 ) alist . add ( b ) ; if ( b == N ) blist . add ( a ) ; } Collections . sort ( alist ) ; Collections . sort ( blist ) ; Stack < Integer > astack = new Stack < Integer > ( ) ; Stack < Integer > bstack = new Stack < Integer > ( ) ; for ( int i = 0 ; i < alist . size ( ) ; i ++ ) { astack . push ( alist . get ( i ) ) ; } for ( int i = 0 ; i < blist . size ( ) ; i ++ ) { bstack . push ( blist . get ( i ) ) ; } if ( astack . empty ( ) || bstack . empty ( ) ) { System . out . print ( " IMPOSSIBLE " ) ; System . exit ( 0 ) ; } a = astack . pop ( ) ; b = bstack . pop ( ) ; do { if ( a < b ) { if ( bstack . empty ( ) ) break ; b = bstack . pop ( ) ; } if ( a > b ) { if ( astack . empty ( ) ) break ; a = astack . pop ( ) ; } if ( a == b ) { System . out . print ( " POSSIBLE " ) ; System . exit ( 0 ) ; } } while ( true ) ; System . out . print ( " IMPOSSIBLE " ) ; } }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . HashSet ; import java . util . Set ; import java . util . StringTokenizer ; public class Main { int n , m ; Set < Integer > oneLines ; Set < Integer > nLines ; public static void main ( String args [ ] ) { new Main ( ) . run ( ) ; } void run ( ) { FastReader sc = new FastReader ( ) ; n = sc . nextInt ( ) ; m = sc . nextInt ( ) ; oneLines = new HashSet < > ( ) ; nLines = new HashSet < > ( ) ; for ( int i = 0 ; i < m ; i ++ ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; if ( a == 1 ) { oneLines . add ( b ) ; } if ( b == n ) { nLines . add ( a ) ; } } solve ( ) ; } void solve ( ) { for ( int i : oneLines ) { if ( nLines . contains ( i ) ) { System . out . println ( " POSSIBLE " ) ; return ; } } System . out . println ( " IMPOSSIBLE " ) ; } static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } }


import java . util . * ; public class Main { public static void main ( String [ ] args ) throws InterruptedException { Scanner in = new Scanner ( System . in ) ; int N = in . nextInt ( ) ; int M = in . nextInt ( ) ; Set < Integer > from1 = new TreeSet < Integer > ( ) ; Set < Integer > toN = new TreeSet < Integer > ( ) ; for ( int i = 0 ; i < M ; i ++ ) { int s = in . nextInt ( ) ; int g = in . nextInt ( ) ; if ( s == 1 && ! from1 . contains ( g ) ) { from1 . add ( g ) ; } else if ( g == N && ! toN . contains ( s ) ) { toN . add ( s ) ; } } String answer = " IMPOSSIBLE " ; for ( int island : from1 ) { if ( toN . contains ( island ) ) { answer = " POSSIBLE " ; break ; } } System . out . println ( answer ) ; } }


import java . util . Collections ; import java . util . HashMap ; import java . util . HashSet ; import java . util . Map ; import java . util . Scanner ; import java . util . Set ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ; ) { new Main ( ) . solve ( sc ) ; } } void solve ( Scanner sc ) { int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; Map < Integer , Set < Integer > > shipMap = new HashMap < > ( ) ; for ( int i = 0 ; i < m ; i ++ ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; shipMap . computeIfAbsent ( a , e -> new HashSet < Integer > ( ) ) . add ( b ) ; } Set < Integer > toSet = shipMap . getOrDefault ( 1 , Collections . emptySet ( ) ) ; for ( Integer i : toSet ) { Set < Integer > toSet2 = shipMap . getOrDefault ( i , Collections . emptySet ( ) ) ; if ( toSet2 . contains ( n ) ) { System . out . println ( " POSSIBLE " ) ; return ; } } System . out . println ( " IMPOSSIBLE " ) ; } }


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

A = int ( input ( ) ) NEW_LINE B = int ( input ( ) ) NEW_LINE C = int ( input ( ) ) NEW_LINE D = int ( input ( ) ) NEW_LINE print ( min ( A , B ) + min ( C , D ) ) NEW_LINE


a = int ( input ( ) ) NEW_LINE b = int ( input ( ) ) NEW_LINE c = int ( input ( ) ) NEW_LINE d = int ( input ( ) ) NEW_LINE if a <= b and c <= d : NEW_LINE INDENT print ( a + c ) NEW_LINE DEDENT elif a <= b and c >= d : NEW_LINE INDENT print ( a + d ) NEW_LINE DEDENT elif a >= b and c <= d : NEW_LINE INDENT print ( b + c ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( b + d ) NEW_LINE DEDENT


A = list ( map ( int , open ( 0 ) . read ( ) . split ( ) ) ) NEW_LINE print ( min ( A [ 0 ] , A [ 1 ] ) + min ( A [ 2 ] , A [ 3 ] ) ) NEW_LINE


print ( min ( int ( input ( ) ) , int ( input ( ) ) ) + min ( int ( input ( ) ) , int ( input ( ) ) ) ) NEW_LINE


A , B , C , D = map ( int , [ input ( ) for _ in range ( 4 ) ] ) NEW_LINE print ( min ( A , B ) + min ( C , D ) ) NEW_LINE


import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { new Main ( ) . solveA ( ) ; } private void solveA ( ) { Scanner scanner = null ; int numA = 0 ; int numB = 0 ; int numC = 0 ; int numD = 0 ; try { scanner = new Scanner ( System . in ) ; numA = scanner . nextInt ( ) ; numB = scanner . nextInt ( ) ; numC = scanner . nextInt ( ) ; numD = scanner . nextInt ( ) ; int wkBus = numA < numB ? numA : numB ; int wkTrain = numC < numD ? numC : numD ; System . out . println ( wkBus + wkTrain ) ; System . out . println ( " " ) ; } finally { if ( scanner != null ) { scanner . close ( ) ; } } } private void solveB ( ) { Scanner scanner = null ; int numN = 0 ; int numK = 0 ; int numS = 0 ; try { scanner = new Scanner ( System . in ) ; numN = scanner . nextInt ( ) ; System . out . println ( " " ) ; } finally { if ( scanner != null ) { scanner . close ( ) ; } } } private void solveC ( ) { Scanner scanner = null ; int numN = 0 ; int numK = 0 ; int numS = 0 ; try { scanner = new Scanner ( System . in ) ; numN = scanner . nextInt ( ) ; System . out . println ( " " ) ; } finally { if ( scanner != null ) { scanner . close ( ) ; } } } private void solveD ( ) { Scanner scanner = null ; int numN = 0 ; int numK = 0 ; int numS = 0 ; try { scanner = new Scanner ( System . in ) ; numN = scanner . nextInt ( ) ; System . out . println ( " " ) ; } finally { if ( scanner != null ) { scanner . close ( ) ; } } } }


import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { BufferedReader bf = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int a , b , c , d ; try { a = Integer . parseInt ( bf . readLine ( ) ) ; b = Integer . parseInt ( bf . readLine ( ) ) ; c = Integer . parseInt ( bf . readLine ( ) ) ; d = Integer . parseInt ( bf . readLine ( ) ) ; System . out . println ( Math . min ( a , b ) + Math . min ( c , d ) ) ; } catch ( Exception e ) { } } }


import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { RapidScanner sc = new RapidScanner ( ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; System . out . println ( Math . min ( a , b ) + Math . min ( c , d ) ) ; } } class RapidScanner { BufferedReader reader ; int index ; String [ ] buffer ; public RapidScanner ( ) { reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { buffer = reader . readLine ( ) . split ( " ▁ " ) ; } catch ( Exception e ) { } index = 0 ; } public int nextInt ( ) { if ( index == buffer . length ) { try { buffer = reader . readLine ( ) . split ( " ▁ " ) ; } catch ( Exception e ) { } index = 0 ; } return Integer . parseInt ( buffer [ index ++ ] ) ; } }


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


import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a , b , c ; a = sc . nextInt ( ) ; b = sc . nextInt ( ) ; if ( a * b % 2 == 0 ) System . out . println ( " No " ) ; else System . out . println ( " Yes " ) ; } }

A , B = map ( int , input ( ) . split ( ) ) NEW_LINE if A % 2 == 1 and B % 2 == 1 : NEW_LINE INDENT print ( ' Yes ' ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( ' No ' ) NEW_LINE DEDENT


print ( " No " if "2" in input ( ) . split ( ) else " Yes " ) NEW_LINE


def YesNo ( f ) : NEW_LINE INDENT return [ " Yes " , " No " ] [ not ( f ) ] NEW_LINE DEDENT A , B = map ( int , input ( ) . split ( ) ) NEW_LINE print ( YesNo ( A * B % 2 != 0 ) ) NEW_LINE


def main ( ) : NEW_LINE INDENT a , b = map ( int , input ( ) . split ( ) ) NEW_LINE if ( a * b ) % 2 != 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


A , B = map ( int , input ( ) . split ( ) ) NEW_LINE res = " No " NEW_LINE for i in range ( 1 , 4 ) : NEW_LINE INDENT if ( A * B * i ) % 2 == 1 : NEW_LINE INDENT res = " Yes " NEW_LINE break NEW_LINE DEDENT DEDENT print ( res ) NEW_LINE


import java . io . * ; import java . util . Scanner ; public class Main { public static boolean Odd ( int a , int b ) { for ( int i = 1 ; i <= 3 ; i ++ ) { if ( ( a * b * i ) % 2 != 0 ) return true ; } return false ; } public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; if ( Odd ( a , b ) == true ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } }


import java . util . Scanner ; public class Main { private static final String YES = " Yes " ; private static final String NO = " No " ; public static String process ( TestCase testCase ) { final int A = testCase . A ; final int B = testCase . B ; return areBothOdd ( A , B ) ? YES : NO ; } private static boolean areBothOdd ( int A , int B ) { return isOdd ( A ) && isOdd ( B ) ; } private static boolean isOdd ( int n ) { return n % 2 != 0 ; } public static void main ( String [ ] args ) { TestCase testCase = readFromInput ( ) ; final String result = process ( testCase ) ; output ( result ) ; } private static TestCase readFromInput ( ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; return new TestCase ( A , B ) ; } private static void output ( String result ) { System . out . println ( result ) ; } public static class TestCase { final int A ; final int B ; public TestCase ( int A , int B ) { this . A = A ; this . B = B ; } } }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] abc = br . readLine ( ) . split ( " ▁ " ) ; int a = Integer . parseInt ( abc [ 0 ] ) ; int b = Integer . parseInt ( abc [ 1 ] ) ; boolean flag = false ; for ( int c = 1 ; c <= 3 ; c ++ ) { if ( ( a * b * c ) % 2 == 1 ) { flag = true ; } } if ( flag ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } }


import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { new Main ( ) . solveA ( ) ; } private void solveA ( ) { Scanner scanner = null ; int numA = 0 ; int numB = 0 ; try { scanner = new Scanner ( System . in ) ; numA = scanner . nextInt ( ) ; numB = scanner . nextInt ( ) ; for ( int i = 1 ; i < 4 ; i ++ ) { if ( numA * numB * i % 2 != 0 ) { System . out . println ( " Yes " ) ; return ; } } System . out . println ( " No " ) ; } finally { if ( scanner != null ) { scanner . close ( ) ; } } } private void solveB ( ) { Scanner scanner = null ; int numN = 0 ; int numK = 0 ; int numS = 0 ; try { scanner = new Scanner ( System . in ) ; numN = scanner . nextInt ( ) ; System . out . println ( " " ) ; } finally { if ( scanner != null ) { scanner . close ( ) ; } } } private void solveC ( ) { Scanner scanner = null ; int numN = 0 ; int numK = 0 ; int numS = 0 ; try { scanner = new Scanner ( System . in ) ; numN = scanner . nextInt ( ) ; System . out . println ( " " ) ; } finally { if ( scanner != null ) { scanner . close ( ) ; } } } private void solveD ( ) { Scanner scanner = null ; int numN = 0 ; int numK = 0 ; int numS = 0 ; try { scanner = new Scanner ( System . in ) ; numN = scanner . nextInt ( ) ; System . out . println ( " " ) ; } finally { if ( scanner != null ) { scanner . close ( ) ; } } } }


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; double va = sc . nextDouble ( ) ; double vb = sc . nextDouble ( ) ; double L = sc . nextDouble ( ) ; double ans = L ; for ( int i = 0 ; i < N ; i ++ ) { ans = ( vb * ans ) / va ; } System . out . println ( ans ) ; } }

list = input ( ) . split ( " ▁ " ) NEW_LINE a = int ( list [ 1 ] ) NEW_LINE b = int ( list [ 2 ] ) NEW_LINE c = int ( list [ 3 ] ) NEW_LINE for i in range ( int ( list [ 0 ] ) ) : NEW_LINE INDENT full = c / a NEW_LINE full2 = full * b NEW_LINE c = full2 NEW_LINE DEDENT print ( c ) NEW_LINE


n , va , vb , l = map ( int , input ( ) . split ( ) ) ; print ( l * ( vb / va ) ** n if l > 10 ** - 6 else 0 ) NEW_LINE


def b_achilles_and_turtle ( N , Va , Vb , L ) : NEW_LINE INDENT distance = L NEW_LINE for _ in range ( N ) : NEW_LINE INDENT takahashi_moving_dist = distance NEW_LINE turtle_moving_dist = distance * ( 1 + ( Vb / Va ) ) NEW_LINE distance = turtle_moving_dist - takahashi_moving_dist NEW_LINE if distance <= 10 ** ( - 10 ) : NEW_LINE INDENT distance = 0 NEW_LINE break NEW_LINE DEDENT DEDENT ans = round ( distance , 12 ) NEW_LINE return ans NEW_LINE DEDENT N , Va , Vb , L = [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE print ( b_achilles_and_turtle ( N , Va , Vb , L ) ) NEW_LINE


a = list ( map ( int , input ( ) . split ( " ▁ " ) ) ) NEW_LINE b = 0 NEW_LINE c = a [ 3 ] NEW_LINE for i in range ( a [ 0 ] ) : NEW_LINE INDENT k = ( c - b ) / a [ 1 ] NEW_LINE b = c NEW_LINE c += k * a [ 2 ] NEW_LINE DEDENT print ( c - b ) NEW_LINE


N , a , b , L = map ( int , input ( ) . split ( ) ) NEW_LINE dl = ( b / a ) ** N * L NEW_LINE print ( ' { : . 6f } ' . format ( dl ) ) NEW_LINE


import java . util . Scanner ; import java . util . function . LongSupplier ; import java . util . stream . IntStream ; public class Main { static final Scanner s = new Scanner ( System . in ) ; static final long [ ] fal_rnd ( long [ ] ar , LongSupplier sp ) { int l = - 1 , r = ar . length ; while ( l + 1 != r ) ar [ Math . random ( ) < 0.5 ? ++ l : -- r ] = sp . getAsLong ( ) ; return ar ; } static final IntStream REPS ( int v ) { return IntStream . range ( 0 , v ) ; } ; public static void main ( String [ ] __ ) { int n = s . nextInt ( ) , chokudai = s . nextInt ( ) , kame = s . nextInt ( ) ; double dist = s . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) { dist = dist / chokudai * kame ; } System . out . printf ( " % .20f " , dist ) ; } }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . math . BigDecimal ; import java . util . StringTokenizer ; public class Main { static int N , VA , VB , L ; public static void main ( String [ ] args ) { FastScanner fc = new FastScanner ( System . in ) ; N = fc . nextInt ( ) ; VA = fc . nextInt ( ) ; VB = fc . nextInt ( ) ; L = fc . nextInt ( ) ; System . out . println ( BigDecimal . valueOf ( solve ( ) ) . toPlainString ( ) ) ; } static double solve ( ) { double len = L ; for ( int i = 0 ; i < N ; i ++ ) { double b = len / VA ; len = b * VB ; } return len ; } @ SuppressWarnings ( " unused " ) static class FastScanner { private BufferedReader reader ; private StringTokenizer tokenizer ; FastScanner ( InputStream in ) { reader = new BufferedReader ( new InputStreamReader ( in ) ) ; tokenizer = null ; } String next ( ) { if ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( ) ; } String nextLine ( ) { if ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { try { return reader . readLine ( ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( " \n " ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } int [ ] nextIntArray ( int n ) { int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextInt ( ) ; return a ; } long [ ] nextLongArray ( int n ) { long [ ] a = new long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextLong ( ) ; return a ; } } }


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double N = sc . nextDouble ( ) ; double va = sc . nextDouble ( ) ; double vb = sc . nextDouble ( ) ; double L = sc . nextDouble ( ) ; double y = L ; for ( int i = 0 ; i < N ; i ++ ) { y = y / va ; y = vb * y ; } System . out . println ( ( double ) y ) ; } }


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; double va = sc . nextInt ( ) ; double vb = sc . nextInt ( ) ; double len = sc . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) { double t = len / va ; len = vb * t ; } System . out . println ( java . math . BigDecimal . valueOf ( len ) . toPlainString ( ) ) ; } }


import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String name = sc . next ( ) ; System . out . println ( name + " pp " ) ; } }

s = input ( ) NEW_LINE print ( s + ' pp ' ) NEW_LINE


print ( ' { } pp ' . format ( input ( ) ) ) NEW_LINE


S = input ( ) NEW_LINE if S . islower ( ) : NEW_LINE INDENT if 1 <= len ( S ) <= 10 : NEW_LINE INDENT print ( S + " pp " ) NEW_LINE DEDENT DEDENT


s = input ( ) NEW_LINE s += " pp " NEW_LINE print ( s ) NEW_LINE


print ( str ( input ( ) ) + ' pp ' ) NEW_LINE


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


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . lang . String ; public class Main { public static void main ( String args [ ] ) { try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; System . out . println ( str + " pp " ) ; } catch ( IOException e ) { System . out . println ( " Exception ▁ : " + e ) ; } } }


import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { try { Scanner sc = new Scanner ( System . in ) ; String s ; s = sc . next ( ) ; System . out . println ( s + " pp " ) ; } catch ( Exception e ) { System . out . println ( " out " ) ; } } }


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


import java . util . * ; public class Main { private static long split ( long n , long k ) { long sum = 0 ; while ( n > 0 ) { sum += n % k ; n /= k ; } return sum ; } private static long solve ( long n , long s ) { long k ; for ( k = 2 ; k * k <= n || k < 100 ; k ++ ) { if ( split ( n , k ) == s ) { return k ; } } while ( k <= n ) { long a = n / k ; long b = n % k ; if ( ( a + b - s ) % a == 0 ) { long dk = ( a + b - s ) / a ; if ( dk >= 0 && b - dk * a >= 0 ) { return k + dk ; } } k = n / a + 1 ; } if ( n == s ) { return n + 1 ; } return - 1 ; } public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; long nl = s . nextLong ( ) ; long sl = s . nextLong ( ) ; System . out . println ( solve ( nl , sl ) ) ; } }

def digitsum ( n , b ) : NEW_LINE INDENT if n < b : NEW_LINE INDENT return n NEW_LINE DEDENT else : NEW_LINE INDENT return digitsum ( n // b , b ) + n % b NEW_LINE DEDENT DEDENT n = int ( input ( ) ) NEW_LINE s = int ( input ( ) ) NEW_LINE inf = float ( ' inf ' ) NEW_LINE ans = inf NEW_LINE for i in range ( 2 , int ( n ** ( 1 / 2 ) ) + 2 ) : NEW_LINE INDENT if digitsum ( n , i ) == s : NEW_LINE INDENT ans = i NEW_LINE break NEW_LINE DEDENT DEDENT if n == s : NEW_LINE INDENT ans = n + 1 NEW_LINE DEDENT else : NEW_LINE INDENT for i in range ( 1 , int ( n ** ( 1 / 2 ) ) ) : NEW_LINE INDENT if i * i - i >= n - s : NEW_LINE INDENT break NEW_LINE DEDENT if ( n - s ) % i == 0 : NEW_LINE INDENT if s - i >= ( n - s ) // i + 1 or i > s : NEW_LINE INDENT continue NEW_LINE DEDENT ans = min ( ans , ( ( n - s ) // i ) + 1 ) NEW_LINE DEDENT DEDENT DEDENT if ans == inf : NEW_LINE INDENT print ( - 1 ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( int ( ans ) ) NEW_LINE DEDENT


import array NEW_LINE from bisect import * NEW_LINE from collections import * NEW_LINE import fractions NEW_LINE import heapq NEW_LINE from itertools import * NEW_LINE import math NEW_LINE import random NEW_LINE import re NEW_LINE import string NEW_LINE import sys NEW_LINE def get_sum ( base , n ) : NEW_LINE INDENT nums = [ ] NEW_LINE while n > 0 : NEW_LINE INDENT nums . append ( n % base ) NEW_LINE n //= base NEW_LINE DEDENT return sum ( nums ) NEW_LINE DEDENT def solve ( N , S ) : NEW_LINE INDENT if S == N : NEW_LINE INDENT return S + 1 NEW_LINE DEDENT for base in range ( 2 , int ( math . sqrt ( N ) ) + 2 ) : NEW_LINE INDENT if S == get_sum ( base , N ) : NEW_LINE INDENT return base NEW_LINE DEDENT DEDENT for p in range ( int ( math . sqrt ( N ) ) + 1 , 0 , - 1 ) : NEW_LINE INDENT q = S - p NEW_LINE if ( N - q ) % p == 0 : NEW_LINE INDENT base = ( N - q ) // p NEW_LINE if base <= 1 or q < 0 or q >= base : NEW_LINE INDENT continue NEW_LINE DEDENT return base NEW_LINE DEDENT DEDENT return - 1 NEW_LINE DEDENT N = int ( input ( ) ) NEW_LINE S = int ( input ( ) ) NEW_LINE print ( solve ( N , S ) ) NEW_LINE


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 floor , sqrt NEW_LINE def digit_sum ( num : int , base : int ) -> int : NEW_LINE INDENT if num < base : NEW_LINE INDENT return num NEW_LINE DEDENT else : NEW_LINE INDENT return digit_sum ( int ( num / base ) , base ) + ( num % base ) NEW_LINE DEDENT DEDENT n = ni ( ) NEW_LINE s = ni ( ) NEW_LINE root = floor ( sqrt ( n ) ) NEW_LINE ans = float ( " inf " ) NEW_LINE for p in range ( 2 , root + 1 ) : NEW_LINE INDENT ds = digit_sum ( n , p ) NEW_LINE if ds == s : NEW_LINE INDENT ans = min ( ans , p ) NEW_LINE DEDENT DEDENT for a in range ( 1 , root + 2 ) : NEW_LINE INDENT p = ( n - s + a ) / a NEW_LINE b = s - a NEW_LINE if p == int ( p ) and 0 < a < p and 0 <= b < p : NEW_LINE INDENT ans = min ( ans , int ( p ) ) NEW_LINE DEDENT DEDENT if n == s : NEW_LINE INDENT ans = min ( ans , n + 1 ) NEW_LINE DEDENT print ( - 1 ) if ans == float ( " inf " ) else print ( ans ) NEW_LINE


from math import floor NEW_LINE from math import sqrt NEW_LINE def f ( bb , nn ) : NEW_LINE INDENT if ( nn < bb ) : return nn NEW_LINE else : return f ( bb , floor ( nn / bb ) ) + ( nn % bb ) NEW_LINE DEDENT n = int ( input ( ) ) NEW_LINE s = int ( input ( ) ) NEW_LINE if n == s : NEW_LINE INDENT print ( n + 1 ) NEW_LINE exit ( ) NEW_LINE DEDENT elif n < s : NEW_LINE INDENT print ( - 1 ) NEW_LINE exit ( ) NEW_LINE DEDENT for i in range ( 2 , int ( sqrt ( n ) ) + 2 ) : NEW_LINE INDENT if s == f ( i , n ) : NEW_LINE INDENT print ( i ) NEW_LINE exit ( ) NEW_LINE DEDENT DEDENT for i in reversed ( range ( 1 , int ( sqrt ( n ) ) + 2 ) ) : NEW_LINE INDENT if ( n - s ) % i == 0 : NEW_LINE INDENT tmpb = ( n - s ) // i + 1 NEW_LINE if tmpb >= sqrt ( n ) and f ( tmpb , n ) == s : NEW_LINE INDENT print ( tmpb ) NEW_LINE exit ( ) NEW_LINE DEDENT DEDENT DEDENT print ( - 1 ) NEW_LINE


import itertools NEW_LINE import math NEW_LINE n , s = [ int ( input ( ) ) for _ in range ( 2 ) ] NEW_LINE def n_base_sum ( n , b ) : NEW_LINE INDENT if ( math . floor ( n / b ) ) : NEW_LINE INDENT return n_base_sum ( math . floor ( n / b ) , b ) + n % b NEW_LINE DEDENT else : NEW_LINE INDENT return n % b NEW_LINE DEDENT DEDENT def search_p ( n , s ) : NEW_LINE INDENT for p in range ( math . floor ( math . sqrt ( n ) ) + 1 , 0 , - 1 ) : NEW_LINE INDENT b = ( n - s ) // p + 1 NEW_LINE if b > 1 : NEW_LINE INDENT q = n % b NEW_LINE if p + q == s and q < b and n == p * b + q and p < b : NEW_LINE INDENT return b NEW_LINE DEDENT DEDENT DEDENT return - 1 NEW_LINE DEDENT ans = - 1 NEW_LINE flag = False NEW_LINE answers = [ ] NEW_LINE if s == n : NEW_LINE INDENT ans = n + 1 NEW_LINE flag = True NEW_LINE answers . append ( ans ) NEW_LINE DEDENT for b in range ( 2 , math . ceil ( math . sqrt ( n ) ) + 1 ) : NEW_LINE INDENT if s == n_base_sum ( n , b ) : NEW_LINE INDENT ans = b NEW_LINE flag = True NEW_LINE answers . append ( ans ) NEW_LINE break NEW_LINE DEDENT DEDENT ans = search_p ( n , s ) NEW_LINE if ans != - 1 : NEW_LINE INDENT flag = True NEW_LINE answers . append ( ans ) NEW_LINE DEDENT if not flag : NEW_LINE INDENT print ( - 1 ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( int ( min ( answers ) ) ) NEW_LINE DEDENT


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 . InputMismatchException ; 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 ) ; TaskD solver = new TaskD ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskD { public void solve ( int testNumber , InputReader in , PrintWriter out ) { long n = in . nextLong ( ) ; long s = in . nextLong ( ) ; if ( n < s ) { out . println ( - 1 ) ; return ; } if ( n == s ) { out . println ( n + 1 ) ; return ; } long i = 2 ; while ( i * i <= n ) { long tmp = n ; long sum = 0 ; while ( tmp > 0 ) { sum += tmp % i ; tmp /= i ; } if ( sum == s ) { out . println ( i ) ; return ; } i ++ ; } while ( i * i >= n ) i -- ; while ( i > 0 ) { long b = ( n - s ) / i + 1 ; if ( n / b + n % b == s ) { out . println ( b ) ; return ; } i -- ; } out . println ( - 1 ) ; } } static class InputReader { BufferedReader in ; StringTokenizer tok ; public String nextString ( ) { while ( ! tok . hasMoreTokens ( ) ) { try { tok = new StringTokenizer ( in . readLine ( ) , " ▁ " ) ; } catch ( IOException e ) { throw new InputMismatchException ( ) ; } } return tok . nextToken ( ) ; } public long nextLong ( ) { return Long . parseLong ( nextString ( ) ) ; } public InputReader ( InputStream inputStream ) { in = new BufferedReader ( new InputStreamReader ( inputStream ) ) ; tok = new StringTokenizer ( " " ) ; } } }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; long n = Long . parseLong ( br . readLine ( ) ) ; long s = Long . parseLong ( br . readLine ( ) ) ; if ( n < s ) { System . out . println ( - 1 ) ; return ; } if ( n == s ) { System . out . println ( n + 1 ) ; return ; } long squareRootN = Double . valueOf ( Math . ceil ( Math . sqrt ( n ) ) ) . longValue ( ) ; for ( long base = 2 ; base <= squareRootN ; base ++ ) { long sum = sumDigitsInBase ( base , n ) ; if ( sum == s ) { System . out . println ( base ) ; return ; } } long nMinusS = n - s ; long minBase = - 1 ; for ( long p = 1 ; p <= squareRootN ; p ++ ) { if ( nMinusS % p != 0 ) { continue ; } long base = nMinusS / p + 1 ; if ( base > squareRootN ) { long sum = sumDigitsInBase ( base , n ) ; if ( sum == s ) { minBase = base ; } } } System . out . println ( minBase ) ; } private static long sumDigitsInBase ( long base , long number ) { if ( base > number ) { return number ; } long sum = sumDigitsInBase ( base , number / base ) ; return sum + ( number % base ) ; } }


import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long n = sc . nextLong ( ) ; long s = sc . nextLong ( ) ; System . out . println ( ans ( n , s ) ) ; } static long ans ( long n , long s ) { if ( n < s ) { return - 1 ; } else if ( n == s ) { return n + 1 ; } else { List < Long > divisor = new ArrayList < Long > ( ) ; for ( long i = 1 ; i <= Math . sqrt ( n - s ) ; i ++ ) { if ( digitSum ( n , i + 1 ) == s ) { return i + 1 ; } if ( ( n - s ) % i == 0 ) { divisor . add ( i ) ; } } Collections . reverse ( divisor ) ; for ( Long l : divisor ) { if ( digitSum ( n , ( n - s ) / l + 1 ) == s ) { return ( n - s ) / l + 1 ; } } return - 1 ; } } static long digitSum ( long n , long b ) { if ( n < b ) { return n ; } else { return ( n % b + digitSum ( n / b , b ) ) ; } } }


import java . util . * ; public class Main { public void main ( Scanner sc ) { long n = sc . nextLong ( ) ; long s = sc . nextLong ( ) ; if ( n == s ) { System . out . println ( n + 1 ) ; return ; } if ( ( n + 1 ) / 2 < s ) { System . out . println ( - 1 ) ; return ; } for ( long b = 2 ; b * b <= n ; b ++ ) { if ( f ( n , b ) == s ) { System . out . println ( b ) ; return ; } } long min = Long . MAX_VALUE ; for ( long p = 1 ; p * p <= n ; p ++ ) { long b = ( n - s ) / p + 1 ; if ( f ( n , b ) == s ) { min = Math . min ( min , b ) ; } } System . out . println ( min ) ; } private long f ( long n , long b ) { if ( n < b ) { return n ; } else { return f ( n / b , b ) + n % b ; } } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; new Main ( ) . main ( sc ) ; sc . close ( ) ; } }


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int D = sc . nextInt ( ) ; int [ ] id = new int [ N + 1 ] ; for ( int i = 0 ; i < N + 1 ; i ++ ) { id [ i ] = i ; } for ( int i = 0 ; i < M ; i ++ ) { int a = sc . nextInt ( ) ; int temp = id [ a ] ; id [ a ] = id [ a + 1 ] ; id [ a + 1 ] = temp ; } int [ ] goal = new int [ N + 1 ] ; for ( int i = 1 ; i < N + 1 ; i ++ ) { goal [ id [ i ] ] = i ; } int [ ] [ ] powGoal = new int [ N + 1 ] [ 31 ] ; for ( int i = 1 ; i < N + 1 ; i ++ ) { powGoal [ i ] [ 0 ] = goal [ i ] ; } for ( int j = 1 ; j < 31 ; j ++ ) { for ( int i = 1 ; i < N + 1 ; i ++ ) { powGoal [ i ] [ j ] = powGoal [ powGoal [ i ] [ j - 1 ] ] [ j - 1 ] ; } } for ( int i = 1 ; i < N + 1 ; i ++ ) { int g = i ; for ( int j = 0 ; j < 30 ; j ++ ) { if ( ( D & ( 1 << j ) ) != 0 ) { g = powGoal [ g ] [ j ] ; } } System . out . println ( g ) ; } } }

N , M , D = map ( int , input ( ) . split ( ) ) NEW_LINE A = [ int ( x ) for x in input ( ) . split ( ) ] NEW_LINE S = [ i for i in range ( N ) ] NEW_LINE Q = [ 0 ] * N NEW_LINE for a in A : NEW_LINE INDENT swap = S [ a ] NEW_LINE S [ a ] = S [ a - 1 ] NEW_LINE S [ a - 1 ] = swap NEW_LINE DEDENT for i , s in enumerate ( S ) : NEW_LINE INDENT Q [ s ] = i NEW_LINE DEDENT L = [ 0 ] * N NEW_LINE for q in range ( N ) : NEW_LINE INDENT if L [ q ] == 0 : NEW_LINE INDENT P = [ q ] NEW_LINE nq = q NEW_LINE while Q [ nq ] != q : NEW_LINE INDENT nq = Q [ nq ] NEW_LINE P . append ( nq ) NEW_LINE DEDENT k = D % len ( P ) NEW_LINE for i , p in enumerate ( P ) : NEW_LINE INDENT L [ p ] = P [ ( i + k ) % len ( P ) ] + 1 NEW_LINE DEDENT DEDENT DEDENT for l in L : NEW_LINE INDENT print ( l ) NEW_LINE DEDENT


from collections import defaultdict NEW_LINE from heapq import heappush , heappop NEW_LINE import sys NEW_LINE import math NEW_LINE import bisect NEW_LINE import random NEW_LINE def LI ( ) : return list ( map ( int , sys . stdin . readline ( ) . split ( ) ) ) NEW_LINE def I ( ) : return int ( sys . stdin . readline ( ) ) NEW_LINE def LS ( ) : return sys . stdin . readline ( ) . split ( ) NEW_LINE def S ( ) : return list ( sys . stdin . readline ( ) ) NEW_LINE def IR ( n ) : return [ I ( ) for i in range ( n ) ] NEW_LINE def LIR ( n ) : return [ LI ( ) for i in range ( n ) ] NEW_LINE def SR ( n ) : return [ S ( ) for i in range ( n ) ] NEW_LINE def LSR ( n ) : return [ LS ( ) for i in range ( n ) ] NEW_LINE mod = 1000000007 NEW_LINE def mul ( a , b ) : NEW_LINE INDENT c = [ 0 for i in range ( n + 1 ) ] NEW_LINE for i in range ( n + 1 ) : NEW_LINE INDENT c [ i ] = a [ b [ i ] ] NEW_LINE DEDENT return c NEW_LINE DEDENT def pow ( a , b ) : NEW_LINE INDENT if b == 1 : NEW_LINE INDENT return a NEW_LINE DEDENT if b % 2 : NEW_LINE INDENT return mul ( a , pow ( mul ( a , a ) , b // 2 ) ) NEW_LINE DEDENT else : NEW_LINE INDENT return pow ( mul ( a , a ) , b // 2 ) NEW_LINE DEDENT DEDENT n , m , d = LI ( ) NEW_LINE a = LI ( ) NEW_LINE f = [ i for i in range ( n + 1 ) ] NEW_LINE for i in range ( m ) [ : : - 1 ] : NEW_LINE INDENT v = f [ a [ i ] ] NEW_LINE f [ a [ i ] ] = f [ a [ i ] + 1 ] NEW_LINE f [ a [ i ] + 1 ] = v NEW_LINE DEDENT f = pow ( f , d ) NEW_LINE for i in range ( 1 , n + 1 ) : NEW_LINE INDENT print ( f [ i ] ) NEW_LINE NEW_LINE DEDENT


n , m , d = ( int ( i ) for i in input ( ) . split ( ) ) NEW_LINE a = [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE b = [ i for i in range ( n + 1 ) ] NEW_LINE for i in a : b [ i ] , b [ i + 1 ] = b [ i + 1 ] , b [ i ] NEW_LINE x , y , ans = [ 0 for i in range ( n + 1 ) ] , [ True for i in range ( n + 1 ) ] , [ 0 for i in range ( n + 1 ) ] NEW_LINE for i in range ( 1 , n + 1 ) : x [ b [ i ] ] = i NEW_LINE for i in range ( 1 , n + 1 ) : NEW_LINE INDENT if y [ i ] : NEW_LINE INDENT z , now = [ ] , i NEW_LINE while True : NEW_LINE INDENT if y [ now ] : NEW_LINE INDENT z . append ( now ) NEW_LINE y [ now ] , now = False , x [ now ] NEW_LINE DEDENT else : break NEW_LINE DEDENT num , lz = d % len ( z ) , len ( z ) NEW_LINE for i in range ( lz ) : ans [ z [ i ] ] = z [ ( i + num ) % lz ] NEW_LINE DEDENT DEDENT for i in ans [ 1 : ] : print ( i ) NEW_LINE


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 , M , D = inpl ( ) NEW_LINE aa = inpl ( ) NEW_LINE L = int ( math . log2 ( D ) ) + 1 NEW_LINE T = [ [ i for i in range ( N ) ] for j in range ( L ) ] NEW_LINE for a in reversed ( aa ) : NEW_LINE INDENT T [ 0 ] [ a - 1 ] , T [ 0 ] [ a ] = T [ 0 ] [ a ] , T [ 0 ] [ a - 1 ] NEW_LINE DEDENT flags = [ ] NEW_LINE for k in range ( L ) : NEW_LINE INDENT flags . append ( D >> k & 1 ) NEW_LINE DEDENT for k in range ( 1 , L ) : NEW_LINE INDENT for i in range ( N ) : NEW_LINE INDENT T [ k ] [ i ] = T [ k - 1 ] [ T [ k - 1 ] [ i ] ] NEW_LINE DEDENT DEDENT for i in range ( N ) : NEW_LINE INDENT ans = i NEW_LINE for k , flag in enumerate ( flags ) : NEW_LINE INDENT if flag : NEW_LINE INDENT ans = T [ k ] [ ans ] NEW_LINE DEDENT DEDENT print ( ans + 1 ) NEW_LINE DEDENT


N , M , D = [ int ( x ) for x in input ( ) . split ( ) ] NEW_LINE A = [ int ( x ) for x in input ( ) . split ( ) ] NEW_LINE Amida = [ [ ] for x in range ( N + 1 ) ] NEW_LINE for a in A : NEW_LINE INDENT Amida [ a ] . append ( ( a + 1 , len ( Amida [ a + 1 ] ) + 1 ) ) NEW_LINE Amida [ a + 1 ] . append ( ( a , len ( Amida [ a ] ) ) ) NEW_LINE DEDENT rec = [ 0 for x in range ( N ) ] NEW_LINE for i in range ( 1 , N + 1 ) : NEW_LINE INDENT r = i NEW_LINE j = 0 NEW_LINE while j < len ( Amida [ r ] ) : NEW_LINE INDENT r , j = Amida [ r ] [ j ] [ 0 ] , Amida [ r ] [ j ] [ 1 ] NEW_LINE DEDENT rec [ i - 1 ] = r NEW_LINE DEDENT kaijou = [ ] NEW_LINE for i in reversed ( range ( 30 ) ) : NEW_LINE INDENT c = 2 ** i NEW_LINE if c > D : NEW_LINE INDENT continue NEW_LINE DEDENT kaijou . append ( i ) NEW_LINE if D == c : break NEW_LINE D -= c NEW_LINE DEDENT R = [ ] NEW_LINE R . append ( rec ) NEW_LINE for a in range ( kaijou [ 0 ] + 1 ) : NEW_LINE INDENT R . append ( [ R [ - 1 ] [ r - 1 ] for r in R [ - 1 ] ] ) NEW_LINE DEDENT ans = [ i for i in range ( 1 , N + 1 ) ] NEW_LINE for k in kaijou : NEW_LINE INDENT ans = [ R [ k ] [ i - 1 ] for i in ans ] NEW_LINE DEDENT print ( * ans , sep = ' \n ' ) NEW_LINE


import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; final int N = sc . nextInt ( ) ; final int M = sc . nextInt ( ) ; final int D = sc . nextInt ( ) ; final int [ ] a = new int [ M ] ; for ( int i = 0 ; i < M ; i ++ ) a [ i ] = sc . nextInt ( ) - 1 ; sc . close ( ) ; int [ ] once = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) once [ i ] = i ; for ( int m = 0 ; m < M ; m ++ ) { int t = once [ a [ m ] ] ; once [ a [ m ] ] = once [ a [ m ] + 1 ] ; once [ a [ m ] + 1 ] = t ; } int [ ] intervel = new int [ N ] ; int [ ] ans = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { intervel [ once [ i ] ] = i ; ans [ i ] = i ; } for ( int i = D ; i > 0 ; i = i / 2 ) { if ( i % 2 == 1 ) for ( int j = 0 ; j < N ; j ++ ) ans [ j ] = intervel [ ans [ j ] ] ; int [ ] tmp = new int [ N ] ; for ( int j = 0 ; j < N ; j ++ ) tmp [ j ] = intervel [ j ] ; for ( int j = 0 ; j < N ; j ++ ) intervel [ j ] = tmp [ tmp [ j ] ] ; } for ( int i = 0 ; i < N ; i ++ ) System . out . println ( ans [ i ] + 1 ) ; } }


import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) , M = sc . nextInt ( ) , D = sc . nextInt ( ) ; int A [ ] = new int [ M ] ; for ( int i = 0 ; i < M ; i ++ ) { A [ i ] = sc . nextInt ( ) - 1 ; } int amida [ ] = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { amida [ i ] = i ; } for ( int i = 0 ; i < M ; i ++ ) { int tmp = amida [ A [ i ] ] ; amida [ A [ i ] ] = amida [ A [ i ] + 1 ] ; amida [ A [ i ] + 1 ] = tmp ; } int doubling [ ] [ ] = new int [ 31 ] [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { doubling [ 0 ] [ amida [ i ] ] = i ; } for ( int i = 0 ; i < 30 ; i ++ ) { for ( int j = 0 ; j < N ; j ++ ) { doubling [ i + 1 ] [ j ] = doubling [ i ] [ doubling [ i ] [ j ] ] ; } } for ( int i = 0 ; i < N ; i ++ ) { int now = i , res = D ; for ( int j = 30 ; j >= 0 ; j -- ) { if ( ( res >> j & 1 ) == 1 ) { now = doubling [ j ] [ now ] ; res -= 1 << j ; } } System . out . println ( now + 1 ) ; } } }


import java . io . * ; import java . util . * ; class Main { public static void main ( String [ ] args ) { solve ( ) ; } public static void solve ( ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int q = sc . nextInt ( ) ; String s = sc . next ( ) ; int [ ] l = new int [ q ] ; int [ ] r = new int [ q ] ; for ( int i = 0 ; i < q ; i ++ ) { l [ i ] = sc . nextInt ( ) ; r [ i ] = sc . nextInt ( ) ; } int [ ] len = new int [ n ] ; for ( int i = 1 ; i < n ; i ++ ) { if ( s . charAt ( i ) == ' C ' && s . charAt ( i - 1 ) == ' A ' ) { len [ i ] = len [ i - 1 ] + 1 ; } else { len [ i ] = len [ i - 1 ] ; } } for ( int i = 0 ; i < q ; i ++ ) { System . out . println ( len [ r [ i ] - 1 ] - len [ l [ i ] - 1 ] ) ; } } }

n , q = map ( int , input ( ) . split ( ) ) NEW_LINE s = input ( ) NEW_LINE t = [ 0 ] * ( n + 1 ) NEW_LINE for i in range ( n ) : NEW_LINE INDENT t [ i + 1 ] = t [ i ] + ( 1 if s [ i : i + 2 ] == " AC " else 0 ) NEW_LINE DEDENT for i in range ( q ) : NEW_LINE INDENT l , r = map ( int , input ( ) . split ( ) ) NEW_LINE print ( t [ r - 1 ] - t [ l - 1 ] ) NEW_LINE DEDENT


import sys NEW_LINE s2nn = lambda s : [ int ( c ) for c in s . split ( ' ▁ ' ) ] NEW_LINE ss2nn = lambda ss : [ int ( s ) for s in list ( ss ) ] NEW_LINE ss2nnn = lambda ss : [ s2nn ( s ) for s in list ( ss ) ] NEW_LINE i2s = lambda : sys . stdin . readline ( ) . rstrip ( ) NEW_LINE i2n = lambda : int ( i2s ( ) ) NEW_LINE i2nn = lambda : s2nn ( i2s ( ) ) NEW_LINE ii2ss = lambda n : [ sys . stdin . readline ( ) for _ in range ( n ) ] NEW_LINE def main ( N , Q , S , lrs ) : NEW_LINE INDENT S2 = [ 0 ] * ( N ) NEW_LINE for i in range ( 1 , N ) : NEW_LINE INDENT if S [ i - 1 ] == ' A ' and S [ i ] == ' C ' : NEW_LINE INDENT S2 [ i ] = S2 [ i - 1 ] + 1 NEW_LINE DEDENT else : NEW_LINE INDENT S2 [ i ] = S2 [ i - 1 ] NEW_LINE DEDENT DEDENT for l , r in lrs : NEW_LINE INDENT count = S2 [ r - 1 ] - S2 [ l - 1 ] NEW_LINE print ( count ) NEW_LINE DEDENT DEDENT N , Q = i2nn ( ) NEW_LINE S = i2s ( ) NEW_LINE lr = ss2nnn ( ii2ss ( Q ) ) NEW_LINE main ( N , Q , S , lr ) NEW_LINE


if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT length , question_count = map ( int , input ( ) . split ( ) ) NEW_LINE string = input ( ) NEW_LINE ac_sums = [ 0 ] NEW_LINE for i in range ( 1 , len ( string ) + 1 ) : NEW_LINE INDENT if i > 1 and string [ i - 2 ] == ' A ' and string [ i - 1 ] == ' C ' : NEW_LINE INDENT ac_sums . append ( ac_sums [ i - 1 ] + 1 ) NEW_LINE DEDENT else : NEW_LINE INDENT ac_sums . append ( ac_sums [ i - 1 ] ) NEW_LINE DEDENT DEDENT for i in range ( question_count ) : NEW_LINE INDENT l , r = map ( int , input ( ) . split ( ) ) NEW_LINE ans = ac_sums [ r ] - ac_sums [ l - 1 ] NEW_LINE if l > 1 and string [ l - 1 ] == ' C ' and string [ l - 2 ] == ' A ' : NEW_LINE INDENT ans -= 1 NEW_LINE DEDENT print ( ans ) NEW_LINE DEDENT DEDENT


N , Q = [ int ( x ) for x in input ( ) . split ( ) ] NEW_LINE S = input ( ) NEW_LINE t = [ 0 ] * ( N + 1 ) NEW_LINE for i in range ( N ) : NEW_LINE INDENT if S [ i : i + 2 ] == ' AC ' : NEW_LINE INDENT t [ i + 1 ] = t [ i ] + 1 NEW_LINE DEDENT else : NEW_LINE INDENT t [ i + 1 ] = t [ i ] NEW_LINE DEDENT DEDENT for i in range ( Q ) : NEW_LINE INDENT l , r = [ int ( x ) for x in input ( ) . split ( ) ] NEW_LINE print ( t [ r - 1 ] - t [ l - 1 ] ) NEW_LINE DEDENT


n , q = map ( int , input ( ) . split ( ) ) NEW_LINE s = input ( ) NEW_LINE lr = [ list ( map ( int , input ( ) . split ( ) ) ) for i in range ( q ) ] NEW_LINE for i in range ( q ) : NEW_LINE INDENT for j in range ( 2 ) : NEW_LINE INDENT lr [ i ] [ j ] -= 1 NEW_LINE DEDENT DEDENT ac_cnt = [ 0 for i in range ( n ) ] NEW_LINE for i in range ( n - 1 ) : NEW_LINE INDENT ac_cnt [ i + 1 ] = ac_cnt [ i ] + ( 1 if s [ i : i + 2 ] == ' AC ' else 0 ) NEW_LINE DEDENT for i in range ( q ) : NEW_LINE INDENT print ( ac_cnt [ lr [ i ] [ 1 ] ] - ac_cnt [ lr [ i ] [ 0 ] ] ) NEW_LINE DEDENT


import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; CGeTAC solver = new CGeTAC ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class CGeTAC { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int n = in . nextInt ( ) ; int q = in . nextInt ( ) ; String s = in . next ( ) ; int p [ ] = new int [ n ] ; char a [ ] = s . toCharArray ( ) ; if ( a [ 0 ] == ' A ' && a [ 1 ] == ' C ' ) p [ 0 ] = 1 ; for ( int i = 1 ; i < n - 1 ; i ++ ) { if ( a [ i ] == ' A ' && a [ i + 1 ] == ' C ' ) { p [ i ] = p [ i - 1 ] + 1 ; } else { p [ i ] = p [ i - 1 ] ; } } p [ n - 1 ] = p [ n - 2 ] ; int ans = 0 ; for ( int i = 0 ; i < q ; i ++ ) { int l = in . nextInt ( ) ; int r = in . nextInt ( ) ; l -- ; r -- ; if ( l == 0 ) { ans = p [ r - 1 ] ; } else { ans = p [ r - 1 ] - p [ l - 1 ] ; } out . println ( ans ) ; } } } }


import java . io . * ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; BufferedWriter bw = new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; int N = Integer . parseInt ( st . nextToken ( ) ) ; int Q = Integer . parseInt ( st . nextToken ( ) ) ; char [ ] arr = br . readLine ( ) . toCharArray ( ) ; int [ ] num = new int [ N ] ; num [ 0 ] = 0 ; for ( int i = 1 ; i < N ; ++ i ) { num [ i ] = num [ i - 1 ] + ( arr [ i - 1 ] == ' A ' && arr [ i ] == ' C ' ? 1 : 0 ) ; } for ( int i = 0 ; i < Q ; ++ i ) { st = new StringTokenizer ( br . readLine ( ) ) ; int start = Integer . parseInt ( st . nextToken ( ) ) ; int end = Integer . parseInt ( st . nextToken ( ) ) ; bw . write ( ( num [ end - 1 ] - num [ start - 1 ] ) + " \n " ) ; } bw . close ( ) ; } }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) { FastReader scan = new FastReader ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; int n = scan . nextInt ( ) , q = scan . nextInt ( ) ; int [ ] p = new int [ n + 1 ] ; char prev = ' z ' ; char [ ] a = scan . next ( ) . toCharArray ( ) ; for ( int i = 1 ; i <= n ; i ++ ) { if ( a [ i - 1 ] == ' C ' && prev == ' A ' ) p [ i ] ++ ; p [ i ] += p [ i - 1 ] ; prev = a [ i - 1 ] ; } for ( int i = 0 ; i < q ; i ++ ) { int l = scan . nextInt ( ) - 1 , r = scan . nextInt ( ) ; int get = p [ r ] - p [ l ] ; if ( l > 0 && a [ l ] == ' C ' && a [ l - 1 ] == ' A ' ) get -- ; out . println ( get ) ; } out . close ( ) ; } static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } }


import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { int N = Integer . parseInt ( sc . next ( ) ) ; int Q = Integer . parseInt ( sc . next ( ) ) ; String S = sc . next ( ) ; int [ ] [ ] lr = new int [ Q ] [ 2 ] ; for ( int i = 0 ; i < Q ; i ++ ) { lr [ i ] [ 0 ] = Integer . parseInt ( sc . next ( ) ) ; lr [ i ] [ 1 ] = Integer . parseInt ( sc . next ( ) ) ; } final String AC = " AC " ; int [ ] [ ] counter = new int [ S . length ( ) ] [ 2 ] ; int count = 0 ; for ( int i = 0 ; i < S . length ( ) - 1 ; i ++ ) { counter [ i ] [ 1 ] = count ; if ( AC . equals ( S . substring ( i , i + 2 ) ) ) { count ++ ; } } counter [ S . length ( ) - 1 ] [ 1 ] = count ; for ( int i = 0 ; i < Q ; i ++ ) { System . out . println ( counter [ lr [ i ] [ 1 ] - 1 ] [ 1 ] - counter [ lr [ i ] [ 0 ] - 1 ] [ 1 ] ) ; } } } }


import java . util . * ; import java . awt . * ; import static java . lang . System . * ; import static java . lang . Math . * ; public class Main { public static void main ( String [ ] $ ) { Scanner sc = new Scanner ( in ) ; int n = sc . nextInt ( ) ; char [ ] r = sc . next ( ) . toCharArray ( ) ; double sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( r [ i ] != ' F ' ) sum += ( 69 - ( int ) r [ i ] ) ; } out . println ( sum / n ) ; } }

n = int ( input ( ) ) ; s = input ( ) ; print ( sum ( v * ( 4 - k ) for ( k , v ) in enumerate ( map ( s . count , " ABCD " ) ) ) / n ) NEW_LINE


SCORE = { ' A ' : 4 , ' B ' : 3 , ' C ' : 2 , ' D ' : 1 , ' F ' : 0 } NEW_LINE def main ( ) : NEW_LINE INDENT N = int ( input ( ) ) NEW_LINE ranks = input ( ) . rstrip ( ) NEW_LINE gpa = float ( sum ( SCORE [ t ] for t in ranks ) ) / float ( len ( ranks ) ) NEW_LINE print ( " { } " . format ( gpa ) ) NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT main ( ) NEW_LINE DEDENT


import sys NEW_LINE import copy NEW_LINE input = sys . stdin . readline NEW_LINE N = int ( input ( ) ) NEW_LINE r = input ( ) . rstrip ( ) NEW_LINE sum = 0 NEW_LINE sum += r . count ( ' A ' ) * 4 NEW_LINE sum += r . count ( ' B ' ) * 3 NEW_LINE sum += r . count ( ' C ' ) * 2 NEW_LINE sum += r . count ( ' D ' ) * 1 NEW_LINE print ( sum / N ) NEW_LINE


n = int ( input ( ) ) NEW_LINE list = list ( input ( ) ) NEW_LINE gpa = 0 NEW_LINE for i in range ( n ) : NEW_LINE INDENT if list [ i ] == " A " : NEW_LINE INDENT gpa += 4 NEW_LINE DEDENT elif list [ i ] == " B " : NEW_LINE INDENT gpa += 3 NEW_LINE DEDENT elif list [ i ] == " C " : NEW_LINE INDENT gpa += 2 NEW_LINE DEDENT elif list [ i ] == " D " : NEW_LINE INDENT gpa += 1 NEW_LINE DEDENT DEDENT print ( gpa / n ) NEW_LINE


def io_generator ( ) : NEW_LINE INDENT return input ( ) NEW_LINE DEDENT def main ( io ) : NEW_LINE INDENT n = int ( io ( ) ) NEW_LINE s = io ( ) [ : n ] NEW_LINE dd = { ' A ' : 4 , ' B ' : 3 , ' C ' : 2 , ' D ' : 1 , ' F ' : 0 } NEW_LINE aa = [ dd [ c ] for c in s ] NEW_LINE print ( sum ( aa ) / len ( aa ) ) NEW_LINE DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT io = lambda : io_generator ( ) NEW_LINE main ( io ) NEW_LINE DEDENT


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . OutputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; Task solver = new Task ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class Task { public void solve ( int testNumber , InputReader in , PrintWriter out ) { int N = in . nextInt ( ) ; String t = in . next ( ) ; double total = 0 ; for ( int i = 0 ; i < N ; i ++ ) { switch ( t . charAt ( i ) ) { case ' A ' : total += 4 ; break ; case ' B ' : total += 3 ; break ; case ' C ' : total += 2 ; break ; case ' D ' : total += 1 ; break ; case ' F ' : break ; } } if ( total / N == 0.0 ) { out . println ( 0 ) ; } else { out . println ( total / 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 . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . stream . IntStream ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; AGPA solver = new AGPA ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class AGPA { public void solve ( int testNumber , Scanner in , PrintWriter out ) { double n = in . nextInt ( ) ; out . println ( in . next ( ) . chars ( ) . map ( i -> Math . max ( 0 , ' E ' - i ) ) . sum ( ) / n ) ; } } }


import java . util . * ; import java . math . * ; public class Main { public static void main ( String [ ] args ) { int total = 0 ; Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; String C = sc . next ( ) ; for ( int i = 0 ; i < C . length ( ) ; i ++ ) { char ca = C . charAt ( i ) ; if ( ca == ' A ' ) { total += 4 ; } else if ( ca == ' B ' ) { total += 3 ; } else if ( ca == ' C ' ) { total += 2 ; } else if ( ca == ' D ' ) { total += 1 ; } } BigDecimal divided = new BigDecimal ( total ) ; BigDecimal divisor = new BigDecimal ( N ) ; BigDecimal ans = divided . divide ( divisor , 10 , RoundingMode . HALF_UP ) ; System . out . println ( ans ) ; sc . close ( ) ; } }


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . nextLine ( ) ) ; String rLine = sc . nextLine ( ) ; char [ ] r = rLine . toCharArray ( ) ; HashMap < Character , Integer > map = new HashMap < Character , Integer > ( ) ; map . put ( ' A ' , 4 ) ; map . put ( ' B ' , 3 ) ; map . put ( ' C ' , 2 ) ; map . put ( ' D ' , 1 ) ; map . put ( ' F ' , 0 ) ; double sum = 0 ; for ( char c : r ) { sum += map . get ( c ) ; } System . out . println ( sum / n ) ; } }


import java . util . Scanner ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int x [ ] = new int [ n ] ; int y [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { x [ i ] = sc . nextInt ( ) ; y [ i ] = sc . nextInt ( ) ; } double line = 0.0 ; for ( int i = 0 ; i < n - 1 ; i ++ ) { for ( int j = i + 1 ; j < n ; j ++ ) { double line2 = ( double ) Math . pow ( x [ i ] - x [ j ] , 2 ) + ( double ) Math . pow ( y [ i ] - y [ j ] , 2 ) ; if ( line < line2 ) { line = line2 ; } } } double answer = Math . sqrt ( line ) ; System . out . println ( answer ) ; } }

import math NEW_LINE N = int ( input ( ) ) NEW_LINE points = [ list ( map ( int , input ( ) . split ( ) ) ) for _ in range ( N ) ] NEW_LINE max = 0 NEW_LINE for i in range ( N - 1 ) : NEW_LINE INDENT for j in range ( i + 1 , N ) : NEW_LINE INDENT dist = ( points [ i ] [ 0 ] - points [ j ] [ 0 ] ) ** 2 + ( points [ i ] [ 1 ] - points [ j ] [ 1 ] ) ** 2 NEW_LINE if dist > max : max = dist NEW_LINE DEDENT DEDENT print ( math . sqrt ( max ) ) NEW_LINE


from math import sqrt NEW_LINE n = int ( input ( ) ) NEW_LINE points = [ ] NEW_LINE for i in range ( n ) : NEW_LINE INDENT point = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE points . append ( point ) NEW_LINE DEDENT ans = 0 NEW_LINE while not points == [ ] : NEW_LINE INDENT point = points . pop ( ) NEW_LINE x , y = point NEW_LINE for other in points : NEW_LINE INDENT x1 , y1 = other NEW_LINE ans = max ( ans , sqrt ( ( x - x1 ) ** 2 + ( y - y1 ) ** 2 ) ) NEW_LINE DEDENT DEDENT print ( " { : . 6f } " . format ( ans , ) ) NEW_LINE


import math NEW_LINE import sys NEW_LINE input = sys . stdin . readline NEW_LINE N = int ( input ( ) ) NEW_LINE setlist = [ input ( ) for _ in range ( N ) ] NEW_LINE result = 0.0 NEW_LINE for s1 in setlist : NEW_LINE INDENT x1 , y1 = map ( int , s1 . split ( ) ) NEW_LINE for s2 in setlist : NEW_LINE INDENT x2 , y2 = map ( int , s2 . split ( ) ) NEW_LINE tmp = math . sqrt ( ( x2 - x1 ) ** 2 + ( y2 - y1 ) ** 2 ) NEW_LINE if result < tmp : NEW_LINE INDENT result = tmp NEW_LINE DEDENT DEDENT DEDENT print ( result ) NEW_LINE


import math NEW_LINE n = int ( input ( ) ) NEW_LINE lmax = 0 NEW_LINE lx = [ ] NEW_LINE ly = [ ] NEW_LINE for i in range ( n ) : NEW_LINE INDENT x , y = map ( int , input ( ) . split ( ) ) NEW_LINE lx . append ( x ) NEW_LINE ly . append ( y ) NEW_LINE DEDENT for i in range ( n ) : NEW_LINE INDENT for j in range ( 1 , n ) : NEW_LINE INDENT a = abs ( lx [ i ] - lx [ j ] ) NEW_LINE b = abs ( ly [ i ] - ly [ j ] ) NEW_LINE l = a * a + b * b NEW_LINE if lmax < l : NEW_LINE INDENT lmax = l NEW_LINE DEDENT DEDENT DEDENT print ( math . sqrt ( lmax ) ) NEW_LINE


N = int ( input ( ) ) NEW_LINE points = [ [ int ( i ) for i in input ( ) . split ( ) ] for i in range ( N ) ] NEW_LINE ans = 0 NEW_LINE for x , y , in points : NEW_LINE INDENT for dx , dy in points : NEW_LINE INDENT ans = max ( ans , ( ( x - dx ) ** 2 + ( y - dy ) ** 2 ) ** 0.5 ) NEW_LINE DEDENT DEDENT print ( ans ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . OutputStream ; import java . io . PrintWriter ; import java . math . BigDecimal ; 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 ) ; TaskA solver = new TaskA ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskA { public void solve ( int testNumber , InputReader in , PrintWriter out ) { int N = in . nextInt ( ) ; int [ ] x = new int [ N ] ; int [ ] y = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { x [ i ] = in . nextInt ( ) ; y [ i ] = in . nextInt ( ) ; } double max = 0 ; for ( int i = 0 ; i < N ; i ++ ) { for ( int j = 0 ; j < N ; j ++ ) { if ( i == j ) continue ; max = Math . max ( max , Math . sqrt ( Math . pow ( x [ i ] - x [ j ] , 2 ) + Math . pow ( y [ i ] - y [ j ] , 2 ) ) ) ; } } System . out . println ( max ) ; } } 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 ; import java . util . stream . Stream ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int num = Integer . parseInt ( sc . nextLine ( ) ) ; List < int [ ] > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < num ; i ++ ) { String [ ] str = sc . nextLine ( ) . split ( " ▁ " ) ; list . add ( Stream . of ( str ) . mapToInt ( Integer :: parseInt ) . toArray ( ) ) ; } double maxLength = 0 ; for ( int i = 0 ; i < list . size ( ) ; i ++ ) { int [ ] baseNums = list . get ( i ) ; for ( int k = 0 ; k < list . size ( ) ; k ++ ) { if ( i <= k ) { continue ; } int [ ] targetNums = list . get ( k ) ; double xLength = Math . pow ( Math . abs ( baseNums [ 0 ] - targetNums [ 0 ] ) , 2 ) ; double yLength = Math . pow ( Math . abs ( baseNums [ 1 ] - targetNums [ 1 ] ) , 2 ) ; double sqrt = Math . sqrt ( xLength + yLength ) ; if ( sqrt > maxLength ) { maxLength = sqrt ; } } } System . out . println ( maxLength ) ; } }


import java . io . PrintStream ; import java . util . Scanner ; public class Main { static void exec ( Scanner in , PrintStream out ) { int N = in . nextInt ( ) ; int [ ] x = new int [ N ] ; int [ ] y = new int [ N ] ; for ( int i = 0 ; i < N ; i += 1 ) { x [ i ] = in . nextInt ( ) ; y [ i ] = in . nextInt ( ) ; } double max = 0.0 ; for ( int i = 0 ; i < N ; i += 1 ) { for ( int j = i + 1 ; j < N ; j += 1 ) { int dx = x [ i ] - x [ j ] ; int dy = y [ i ] - y [ j ] ; double len = Math . sqrt ( dx * dx + dy * dy ) ; if ( max < len ) { max = len ; } } } out . printf ( " % .6f % n " , max ) ; } public static void main ( String [ ] args ) { exec ( new Scanner ( System . in ) , System . out ) ; } }


import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; import java . util . stream . IntStream ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; List < Integer > x = new ArrayList < > ( ) ; List < Integer > y = new ArrayList < > ( ) ; IntStream . range ( 0 , n ) . forEach ( i -> { x . add ( sc . nextInt ( ) ) ; y . add ( sc . nextInt ( ) ) ; } ) ; double maxLen = 0 ; for ( int i = 0 ; i < x . size ( ) ; i ++ ) { for ( int j = i + 1 ; j < x . size ( ) ; j ++ ) { double len = Math . sqrt ( Math . pow ( x . get ( j ) - x . get ( i ) , 2 ) + Math . pow ( y . get ( j ) - y . get ( i ) , 2 ) ) ; if ( i == 0 && j == 1 || maxLen < len ) { maxLen = len ; } } } System . out . println ( maxLen ) ; } }


import java . util . Scanner ; public class Main { static double dp [ ] [ ] [ ] ; static int n , k ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; n = sc . nextInt ( ) ; k = sc . nextInt ( ) ; dp = new double [ n + 1 ] [ k + 2 ] [ 2 ] ; for ( int i = 0 ; i < k + 1 ; i ++ ) { dp [ n ] [ i ] [ 1 ] = 1 ; } for ( int i = n - 1 ; i >= 0 ; i -- ) { for ( int j = 0 ; j < k + 1 ; j ++ ) { for ( int l = 0 ; l < 2 ; l ++ ) { double p = 1.0 / ( i + 1 ) ; double r = ( 1.0 - p ) * dp [ i + 1 ] [ j ] [ l ] + p * Math . max ( dp [ i + 1 ] [ j + 1 ] [ 1 ] , dp [ i + 1 ] [ j ] [ 0 ] ) ; dp [ i ] [ j ] [ l ] = r ; } } } System . out . println ( dp [ 0 ] [ 0 ] [ 0 ] ) ; } }

import sys NEW_LINE sys . setrecursionlimit ( 10 ** 6 ) NEW_LINE N , K = map ( int , input ( ) . split ( ) ) NEW_LINE dp = [ [ [ - 1 , - 1 ] for _ in [ 0 ] * ( K + 2 ) ] for _ in [ 0 ] * ( N + 1 ) ] NEW_LINE for i in range ( K + 1 ) : NEW_LINE INDENT dp [ N ] [ i ] = [ 0 , 0 ] NEW_LINE DEDENT dp [ N ] [ K ] [ 1 ] = 1 NEW_LINE for i in range ( N + 1 ) : NEW_LINE INDENT dp [ i ] [ K + 1 ] = [ 0 , 0 ] NEW_LINE DEDENT def solve ( i , j , b ) : NEW_LINE INDENT if dp [ i ] [ j ] [ b ] == - 1 : NEW_LINE INDENT max_prob , not_max_prob = 1 / ( i + 1 ) , 1 - 1 / ( i + 1 ) NEW_LINE if N - i + j == K : NEW_LINE INDENT dp [ i ] [ j ] [ b ] = solve ( i + 1 , j + 1 , b ) * not_max_prob + solve ( i + 1 , j + 1 , 1 ) * max_prob NEW_LINE DEDENT else : NEW_LINE INDENT dp [ i ] [ j ] [ b ] = solve ( i + 1 , j , b ) * not_max_prob + max ( solve ( i + 1 , j + 1 , 1 ) , solve ( i + 1 , j , 0 ) ) * max_prob NEW_LINE DEDENT DEDENT return dp [ i ] [ j ] [ b ] NEW_LINE DEDENT print ( solve ( 0 , 0 , 0 ) ) NEW_LINE


from collections import defaultdict , Counter NEW_LINE from itertools import product , groupby , count , permutations , combinations NEW_LINE from math import pi , sqrt NEW_LINE from collections import deque NEW_LINE from bisect import bisect , bisect_left , bisect_right NEW_LINE INF = float ( " inf " ) NEW_LINE def main ( ) : NEW_LINE INDENT N , K = map ( int , input ( ) . split ( ) ) NEW_LINE dp = [ [ [ 0 , 0 ] for j in range ( K + 2 ) ] for l in range ( N + 1 ) ] NEW_LINE for j in range ( K + 1 ) : NEW_LINE INDENT dp [ N ] [ j ] [ 1 ] = 1 NEW_LINE DEDENT for i in range ( N - 1 , - 1 , - 1 ) : NEW_LINE INDENT for j in range ( K + 1 ) : NEW_LINE INDENT p = 1 / ( i + 1 ) NEW_LINE a = p * max ( dp [ i + 1 ] [ j + 1 ] [ 1 ] , dp [ i + 1 ] [ j ] [ 0 ] ) NEW_LINE dp [ i ] [ j ] [ 1 ] = ( 1 - p ) * dp [ i + 1 ] [ j ] [ 1 ] + a NEW_LINE dp [ i ] [ j ] [ 0 ] = ( 1 - p ) * dp [ i + 1 ] [ j ] [ 0 ] + a NEW_LINE DEDENT DEDENT print ( dp [ 0 ] [ 0 ] [ 0 ] ) NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT main ( ) NEW_LINE DEDENT


def read ( ) : NEW_LINE INDENT return map ( int , input ( ) . split ( ) ) NEW_LINE DEDENT ( N , K ) = read ( ) NEW_LINE dp = [ [ 0 ] * ( K + 1 ) for _ in range ( 2 ) ] NEW_LINE for r in range ( N - 1 , 0 , - 1 ) : NEW_LINE INDENT dp [ r & 1 ] [ 0 ] = dp [ ( r + 1 ) & 1 ] [ 0 ] NEW_LINE for s in range ( 1 , K + 1 ) : NEW_LINE INDENT dp [ r & 1 ] [ s ] = dp [ ( r + 1 ) & 1 ] [ s ] + max ( 1 / N + dp [ ( r + 1 ) & 1 ] [ s - 1 ] , dp [ ( r + 1 ) & 1 ] [ s ] ) / r NEW_LINE DEDENT DEDENT print ( max ( 1 / N + dp [ 1 ] [ K - 1 ] , dp [ 1 ] [ K ] ) ) NEW_LINE


import sys NEW_LINE def read ( ) : NEW_LINE INDENT return map ( int , input ( ) . split ( ) ) NEW_LINE DEDENT ( N , K ) = read ( ) NEW_LINE if N == 1 : NEW_LINE INDENT print ( 1 ) NEW_LINE sys . exit ( ) NEW_LINE DEDENT dp = [ [ 0 ] * ( K + 1 ) for _ in range ( 2 ) ] NEW_LINE dp [ ( N - 1 ) & 1 ] [ 0 ] = 0 NEW_LINE for s in range ( 1 , K + 1 ) : NEW_LINE INDENT dp [ ( N - 1 ) & 1 ] [ s ] = 1 / N / ( N - 1 ) NEW_LINE DEDENT for r in range ( N - 2 , 0 , - 1 ) : NEW_LINE INDENT dp [ r & 1 ] [ 0 ] = dp [ ( r + 1 ) & 1 ] [ 0 ] NEW_LINE for s in range ( 1 , K + 1 ) : NEW_LINE INDENT dp [ r & 1 ] [ s ] = dp [ ( r + 1 ) & 1 ] [ s ] + max ( 1 / N + dp [ ( r + 1 ) & 1 ] [ s - 1 ] , dp [ ( r + 1 ) & 1 ] [ s ] ) / r NEW_LINE DEDENT DEDENT result = max ( 1 / N + dp [ 1 ] [ K - 1 ] , dp [ 1 ] [ K ] ) NEW_LINE print ( result ) NEW_LINE


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


import java . util . * ; public class Main { static int n , k ; static double [ ] [ ] [ ] dp ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; n = sc . nextInt ( ) ; k = sc . nextInt ( ) ; dp = new double [ n + 1 ] [ k + 2 ] [ 2 ] ; for ( int i = 0 ; i < k + 1 ; i ++ ) { dp [ n ] [ i ] [ 1 ] = 1 ; } for ( int i = n - 1 ; i >= 0 ; i -- ) { for ( int j = 0 ; j < k + 1 ; j ++ ) { for ( int l = 0 ; l < 2 ; l ++ ) { double p = 1.0 / ( i + 1 ) ; double r = ( 1.0 - p ) * dp [ i + 1 ] [ j ] [ l ] + p * Math . max ( dp [ i + 1 ] [ j + 1 ] [ 1 ] , dp [ i + 1 ] [ j ] [ 0 ] ) ; dp [ i ] [ j ] [ l ] = r ; } } } System . out . println ( dp [ 0 ] [ 0 ] [ 0 ] ) ; } }


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; double [ ] [ ] dp = new double [ 1001 ] [ 1001 ] ; for ( int r = n - 1 ; r > 0 ; r -- ) { dp [ r ] [ 0 ] = dp [ r + 1 ] [ 0 ] ; for ( int s = 1 ; s <= k ; s ++ ) { dp [ r ] [ s ] = dp [ r + 1 ] [ s ] + Math . max ( 1.0 / n + dp [ r + 1 ] [ s - 1 ] , dp [ r + 1 ] [ s ] ) / r ; } } System . out . println ( Math . max ( 1.0 / n + dp [ 1 ] [ k - 1 ] , dp [ 1 ] [ k ] ) ) ; } }


import java . io . * ; import java . util . * ; public class Main { private static Scanner sc ; private static Printer pr ; private static void solve ( ) { int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; double [ ] [ ] dp = new double [ k + 1 ] [ n + 1 ] ; double [ ] [ ] dp2 = new double [ k + 1 ] [ n + 1 ] ; for ( int i = 0 ; i <= k ; i ++ ) { dp2 [ i ] [ 0 ] = 1 ; } for ( int i = 1 ; i <= n ; i ++ ) { double p = ( double ) 1 / ( n - i + 1 ) ; for ( int j = 0 ; j <= k ; j ++ ) { dp [ j ] [ i ] = dp [ j ] [ i - 1 ] * ( 1 - p ) ; dp2 [ j ] [ i ] = dp2 [ j ] [ i - 1 ] * ( 1 - p ) ; double tmp = 0 ; if ( j > 0 ) { tmp = dp2 [ j - 1 ] [ i - 1 ] * p ; } else { } dp [ j ] [ i ] += Math . max ( tmp , dp [ j ] [ i - 1 ] * p ) ; dp2 [ j ] [ i ] += Math . max ( tmp , dp [ j ] [ i - 1 ] * p ) ; } } pr . printf ( " % .7f \n " , dp [ k ] [ n ] ) ; } public static void main ( String [ ] args ) { sc = new Scanner ( System . in ) ; pr = new Printer ( System . out ) ; solve ( ) ; pr . close ( ) ; sc . close ( ) ; } private static class Printer extends PrintWriter { Printer ( PrintStream out ) { super ( out ) ; } } }


import java . util . * ; public class Main { static int N ; static double [ ] [ ] [ ] memo ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; N = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; memo = new double [ 2 ] [ N + 1 ] [ K + 1 ] ; for ( int t = 0 ; t < 2 ; t ++ ) for ( int i = 0 ; i < N + 1 ; i ++ ) Arrays . fill ( memo [ t ] [ i ] , - 1 ) ; System . out . println ( calc ( 0 , 0 , K ) ) ; sc . close ( ) ; } static double calc ( int i , int j , int k ) { if ( memo [ i ] [ j ] [ k ] >= 0 ) return memo [ i ] [ j ] [ k ] ; double ans = 0 ; if ( j == N ) return i == 1 ? 1.0 : 0.0 ; double p = 1.0 / ( j + 1 ) ; if ( k > 0 ) { ans = p * Math . max ( calc ( 0 , j + 1 , k ) , calc ( 1 , j + 1 , k - 1 ) ) + ( 1 - p ) * calc ( i , j + 1 , k ) ; } else { ans = p * calc ( 0 , j + 1 , k ) + ( 1 - p ) * calc ( i , j + 1 , k ) ; } return memo [ i ] [ j ] [ k ] = ans ; } }


import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int two , three , four ; if ( m % 2 == 0 ) { three = 0 ; two = ( 4 * n - m ) / 2 ; four = n - two ; } else { three = 1 ; two = ( 4 * n - m - 1 ) / 2 ; four = n - 1 - two ; } if ( two < 0 || four < 0 ) { System . out . println ( " - 1 ▁ - 1 ▁ - 1" ) ; } else { System . out . println ( two + " ▁ " + three + " ▁ " + four ) ; } } }

N , M = map ( int , input ( ) . split ( ) ) NEW_LINE if M / N > 4 or M / N < 2 : NEW_LINE INDENT print ( " - 1 ▁ - 1 ▁ - 1" ) NEW_LINE DEDENT else : NEW_LINE INDENT a = M - N * 3 NEW_LINE if ( a < 0 ) : NEW_LINE INDENT print ( - a , a + N , 0 ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( 0 , N - a , a ) NEW_LINE DEDENT DEDENT


import sys NEW_LINE n , m = map ( int , input ( ) . split ( ) ) NEW_LINE for i in range ( n + 1 ) : NEW_LINE INDENT b = 4 * n - 2 * i - m NEW_LINE if isinstance ( b , int ) and n - i - b >= 0 and b >= 0 : NEW_LINE INDENT print ( i , b , n - i - b ) NEW_LINE sys . exit ( ) NEW_LINE DEDENT DEDENT print ( - 1 , - 1 , - 1 ) NEW_LINE


N , M = map ( int , input ( ) . split ( ' ▁ ' ) ) NEW_LINE rem = M % 4 NEW_LINE if rem == 0 : NEW_LINE INDENT if M // 4 <= N <= M // 2 : NEW_LINE INDENT print ( M // 2 - ( M // 2 - N ) * 2 , 0 , M // 2 - N ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( ' - 1 ▁ - 1 ▁ - 1' ) NEW_LINE DEDENT DEDENT elif rem == 1 : NEW_LINE INDENT if M // 4 + 1 <= N <= M // 2 : NEW_LINE INDENT print ( M // 2 - ( M // 2 - N ) * 2 - 1 , 1 , M // 2 - N ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( ' - 1 ▁ - 1 ▁ - 1' ) NEW_LINE DEDENT DEDENT elif rem == 2 : NEW_LINE INDENT if M // 4 + 1 <= N <= M // 2 : NEW_LINE INDENT print ( M // 2 - ( M // 2 - N ) * 2 , 0 , M // 2 - N ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( ' - 1 ▁ - 1 ▁ - 1' ) NEW_LINE DEDENT DEDENT elif rem == 3 : NEW_LINE INDENT if M // 4 + 1 <= N <= M // 2 : NEW_LINE INDENT print ( M // 2 - ( M // 2 - N ) * 2 - 1 , 1 , M // 2 - N ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( ' - 1 ▁ - 1 ▁ - 1' ) NEW_LINE DEDENT DEDENT


n , m = [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE if m < 2 * n or 4 * n < m : NEW_LINE INDENT print ( - 1 , - 1 , - 1 ) NEW_LINE DEDENT else : NEW_LINE INDENT f = m - 2 * n NEW_LINE baby = f // 2 NEW_LINE old = f % 2 NEW_LINE adult = n - baby - old NEW_LINE print ( adult , old , baby ) NEW_LINE DEDENT


N , M = map ( int , input ( ) . split ( ' ▁ ' ) ) NEW_LINE if M % 4 == 0 : NEW_LINE INDENT ans = ( M // 2 - ( M // 2 - N ) * 2 , 0 , M // 2 - N ) if M // 4 <= N <= M // 2 else ( - 1 , - 1 , - 1 ) NEW_LINE DEDENT elif M % 4 == 2 : NEW_LINE INDENT ans = ( M // 2 - ( M // 2 - N ) * 2 , 0 , M // 2 - N ) if M // 4 + 1 <= N <= M // 2 else ( - 1 , - 1 , - 1 ) NEW_LINE DEDENT else : NEW_LINE INDENT ans = ( M // 2 - ( M // 2 - N ) * 2 - 1 , 1 , M // 2 - N ) if M // 4 + 1 <= N <= M // 2 else ( - 1 , - 1 , - 1 ) NEW_LINE DEDENT print ( ans [ 0 ] , ans [ 1 ] , ans [ 2 ] ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . OutputStream ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . Comparator ; 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 M = in . nextInt ( ) ; int a = - 1 ; int b = - 1 ; int c = - 1 ; if ( M % 2 == 0 ) { for ( int i = 0 ; i <= N ; i ++ ) { if ( 2 * i + ( 4 * ( N - i ) ) == M ) { a = i ; b = 0 ; c = N - i ; } } } else { for ( int i = 0 ; i <= N - 1 ; i ++ ) { if ( 2 * i + 3 + ( 4 * ( N - 1 - i ) ) == M ) { a = i ; b = 1 ; c = N - 1 - i ; } } } out . println ( a + " ▁ " + b + " ▁ " + c ) ; } } 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 . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . PrintWriter ; @ SuppressWarnings ( " unchecked " ) public class Main { public static void main ( String [ ] args ) throws IOException { final String s ; try ( BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { s = reader . readLine ( ) ; } PrintWriter out = new PrintWriter ( System . out ) ; final String [ ] sl = s . split ( " ▁ " ) ; long N = Long . parseLong ( sl [ 0 ] ) ; long M = Long . parseLong ( sl [ 1 ] ) ; long adult = - 1 ; long old = - 1 ; long baby = - 1 ; boolean flg = false ; for ( long i = 0 ; i < N + 1 ; i ++ ) { for ( long j = 0 ; j < 2 ; j ++ ) { if ( N - i - j < 0 ) continue ; if ( M == 2 * ( N - i - j ) + 3 * j + 4 * i ) { flg = true ; adult = N - i - j ; old = j ; baby = i ; break ; } } if ( flg ) break ; } out . println ( adult + " ▁ " + old + " ▁ " + baby ) ; out . flush ( ) ; } }


import java . util . * ; import static java . lang . System . * ; public class Main { public static void main ( String [ ] $ ) { Scanner sc = new Scanner ( in ) ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int s = ( M - 2 * N ) / 2 ; for ( int k = 0 ; k <= s ; k ++ ) { int j = M - 2 * ( N + k ) ; int i = N - j - k ; if ( i >= 0 && j >= 0 && i + j + k == N ) { out . println ( i + " ▁ " + j + " ▁ " + k ) ; exit ( 0 ) ; } } out . println ( " - 1 ▁ - 1 ▁ - 1" ) ; } }


import java . util . * ; import java . util . stream . IntStream ; public class Main { public static boolean found = false ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int numOfPerson = sc . nextInt ( ) ; int numOfFoot = sc . nextInt ( ) ; int maxFoot = numOfPerson * 4 ; int minFoot = numOfPerson * 2 ; if ( numOfFoot < minFoot || maxFoot < numOfFoot ) { System . out . println ( " - 1 ▁ - 1 ▁ - 1" ) ; return ; } int numOfAdult = numOfPerson ; int diff = numOfFoot - minFoot ; if ( diff % 2 == 0 ) { int numOfBaby = ( diff / 2 ) ; numOfAdult = numOfAdult - numOfBaby ; System . out . println ( numOfAdult + " ▁ 0 ▁ " + numOfBaby ) ; } else { int numOfBaby = ( diff / 2 ) ; numOfAdult = numOfAdult - numOfBaby - 1 ; System . out . println ( numOfAdult + " ▁ 1 ▁ " + numOfBaby ) ; } } }


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 . next ( ) . charAt ( 0 ) - ' A ' + 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 ; } private int readByte ( ) { if ( bufPointer >= bufLength ) { if ( bufLength == - 1 ) throw new InputMismatchException ( ) ; bufPointer = 0 ; try { bufLength = in . read ( buffer ) ; } catch ( IOException e ) { throw new InputMismatchException ( ) ; } if ( bufLength <= 0 ) return - 1 ; } return buffer [ bufPointer ++ ] ; } private static boolean isPrintableChar ( int c ) { return c >= 33 && c <= 126 ; } public String next ( ) { StringBuilder sb = new StringBuilder ( ) ; int b = readByte ( ) ; while ( ! isPrintableChar ( b ) ) b = readByte ( ) ; while ( isPrintableChar ( b ) ) { sb . appendCodePoint ( b ) ; b = readByte ( ) ; } return sb . toString ( ) ; } } }

n = input ( ) NEW_LINE if n == " A " : NEW_LINE INDENT print ( 1 ) NEW_LINE DEDENT elif n == " B " : NEW_LINE INDENT print ( 2 ) NEW_LINE DEDENT elif n == " C " : NEW_LINE INDENT print ( 3 ) NEW_LINE DEDENT elif n == " D " : NEW_LINE INDENT print ( 4 ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( 5 ) NEW_LINE DEDENT


s = input ( ) NEW_LINE print ( ord ( s ) - 64 ) NEW_LINE


s = input ( ) NEW_LINE if s == " A " : NEW_LINE INDENT print ( 1 ) NEW_LINE DEDENT elif s == " B " : NEW_LINE INDENT print ( 2 ) NEW_LINE DEDENT elif s == " C " : NEW_LINE INDENT print ( 3 ) NEW_LINE DEDENT elif s == " D " : NEW_LINE INDENT print ( 4 ) NEW_LINE DEDENT elif s == " E " : NEW_LINE INDENT print ( 5 ) NEW_LINE DEDENT


print ( ' ABCDE ' . find ( input ( ) ) + 1 ) NEW_LINE


a = input ( ) NEW_LINE for i , j in enumerate ( [ " A " , " B " , " C " , " D " , " E " ] ) : NEW_LINE INDENT if j == a : NEW_LINE INDENT print ( i + 1 ) NEW_LINE DEDENT DEDENT


import java . util . Scanner ; public class Main { private static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { char x = sc . next ( ) . charAt ( 0 ) ; System . out . println ( x - ' A ' + 1 ) ; } }


import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { MyScanner sc = new MyScanner ( ) ; String s = sc . next ( ) ; char x [ ] = s . toCharArray ( ) ; System . out . println ( x [ 0 ] - ' 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 . 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 ) ; TaskA solver = new TaskA ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskA { public void solve ( int testNumber , InputReader in , PrintWriter out ) { String X = in . next ( ) ; int ans = 0 ; switch ( X ) { case " A " : ans = 1 ; break ; case " B " : ans = 2 ; break ; case " C " : ans = 3 ; break ; case " D " : ans = 4 ; break ; case " E " : ans = 5 ; break ; } 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 . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String x = scanner . nextLine ( ) ; scanner . close ( ) ; String [ ] alphabets = { " A " , " B " , " C " , " D " , " E " } ; int order = Arrays . asList ( alphabets ) . indexOf ( x ) + 1 ; System . out . println ( order ) ; } }


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

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


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


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


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


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