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

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

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

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

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

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

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

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

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

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


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

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

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

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

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

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

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

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

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

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


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

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

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

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

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

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

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

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

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


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

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

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

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

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

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

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

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

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

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


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

import 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 .

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

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

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

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

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


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 .

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

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

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

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

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

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

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

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 ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String name = sc . next ( ) ; System . out . println ( name + " pp " ) ; } }

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

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

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

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

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

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

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

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

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

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