import java . util . * ; import java . lang . * ; import java . io . * ;   public class UdayLand { public static void main ( String [ ] args ) throws java . lang . Exception {

import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String s = " ▁ " ; while ( n -- > 0 ) { s = s + sc . next ( ) + " \n " ; } String s1 = s . replaceFirst ( " OO " , " + + " ) ; if ( s1 . equals ( s ) ) { System . out . println ( " NO " ) ; } else { System . out . println ( " YES " ) ; System . out . println ( s1 ) ; } } }

import java . util . Scanner ;   public class BusToUdayland { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = Integer . parseInt ( scanner . nextLine ( ) ) ;   StringBuilder sb = new StringBuilder ( ) ; boolean didReplaceEmptySeats = false ;   for ( int i = 0 ; i < n ; i ++ ) { String line = scanner . nextLine ( ) ; if ( didReplaceEmptySeats ) {   } else { if ( line . contains ( " OO " ) ) { line = line . replaceFirst ( " OO " , " + + " ) ; didReplaceEmptySeats = true ; } } sb . append ( line + System . lineSeparator ( ) ) ; }   if ( didReplaceEmptySeats ) { System . out . println ( " YES " ) ; System . out . println ( sb . toString ( ) ) ; } else { System . out . println ( " NO " ) ; }   } }

n = int ( input ( ) ) found = Falsebus = [ ] for i in range ( n ) : row = list ( input ( ) ) for seat in range ( len ( row ) - 1 ) : if ( row [ seat ] == row [ seat + 1 ] and row [ seat ] == ' O ' and not found ) : found = True row [ seat ] = ' + ' row [ seat + 1 ] = ' + ' bus . append ( row )   if found : print ( " YES " ) for i in range ( n ) : print ( " " . join ( map ( str , bus [ i ] ) ) ) else : print ( " NO " ) NEW_LINE

n = int ( input ( ) )   bus = [ ]   for x in range ( n ) : s = input ( )   row = [ s [ 0 ] , s [ 1 ] , s [ 3 ] , s [ 4 ] ]   bus . append ( row )   result = ' NO '   for x in bus : if x [ 0 ] == ' O ' and x [ 1 ] == ' O ' : result = ' YES ' x [ 0 ] = ' + ' x [ 1 ] = ' + ' break if x [ 2 ] == ' O ' and x [ 3 ] == ' O ' : result = ' YES ' x [ 2 ] = ' + ' x [ 3 ] = ' + ' break   if result == ' NO ' : print ( ' NO ' ) else : print ( ' YES ' ) for x in bus : print ( ' % s % s | % s % s ' % ( x [ 0 ] , x [ 1 ] , x [ 2 ] , x [ 3 ] ) ) NEW_LINE

n = int ( input ( ) ) l = [ ] for i in range ( n ) : l . append ( input ( ) ) c = 0 for i in range ( n ) : if " OO " in l [ i ] : c = 1 if l [ i ] [ 0 ] == ' O ' and l [ i ] [ 1 ] == ' O ' : l [ i ] = " + + " + l [ i ] [ 2 : ] else : l [ i ] = l [ i ] [ : 3 ] + " + + " breakif c : print ( " YES " ) for i in l : print ( i ) else : print ( " NO " ) NEW_LINE

num_rows = int ( input ( ) ) rows = [ ] vacancy = Falsefor i in range ( num_rows ) : row = input ( ) NEW_LINE


import java . util . * ; public class CounterExample { public static long co_prime ( long n1 , long n2 ) {

import java . util . * ;   public class Main { public static void main ( String [ ] args ) {   Scanner sc = new Scanner ( System . in ) ;   long x = sc . nextLong ( ) ; long y = sc . nextLong ( ) ; if ( x % 2 != 0 ) { x ++ ; } if ( x + 2 > y ) { System . out . println ( " - 1" ) ; } else { System . out . println ( x + " ▁ " + ( x + 1 ) + " ▁ " + ( x + 2 ) ) ; }   } }

import java . util . * ; import java . lang . * ; import java . io . * ;   public class FastIO { BufferedReader br ; StringTokenizer st ; public FastIO ( ) {

import java . util . * ; public class CounterExample { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long l = sc . nextLong ( ) ; long r = sc . nextLong ( ) ;   long a = 0 ; long b = 0 ; long c = 0 ; sc . close ( ) ;   for ( long i = l ; i <= r ; i ++ ) { if ( i % 2 == 0 && a == 0 ) { a = i ; }   else if ( i % 2 != 0 && a != 0 ) { b = i ; } else if ( i % 2 == 0 && ( a != 0 && b != 0 ) ) { c = i ; break ; } } if ( a != 0 && b != 0 && c != 0 ) System . out . println ( a + " ▁ " + b + " ▁ " + c ) ; else System . out . println ( - 1 ) ; } }

import sys   def answer ( l , r ) : if ( r - l ) < 2 : print ( ' - 1' ) return NEW_LINE

from math import gcdl , r = map ( int , input ( ) . split ( ) ) if ( r - l < 2 ) : print ( - 1 ) exit ( ) for a in range ( l , r + 1 ) : for b in range ( a + 1 , r + 1 ) : for c in range ( b + 1 , r + 1 ) : if ( gcd ( a , b ) == 1 and gcd ( b , c ) == 1 and gcd ( a , c ) != 1 ) : print ( a , b , c ) exit ( ) else : print ( - 1 ) NEW_LINE

def gcd ( a , b ) : while ( b ) : a , b = b , a % b return a   a , b = map ( int , input ( ) . split ( ) ) s1 , s2 , s3 = 0 , 0 , 0 if b - a < 2 : print ( - 1 ) exit ( )   else : for i in range ( a , b ) : for j in range ( i + 1 , b + 1 ) : if gcd ( i , j ) == 1 : s1 , s2 = i , j for k in range ( s2 + 1 , b + 1 ) : if gcd ( s1 , k ) != 1 and gcd ( s2 , k ) == 1 : s3 = k print ( s1 , s2 , s3 ) exit ( ) print ( - 1 ) NEW_LINE

a , b = map ( int , input ( ) . split ( ) ) if a % 2 : a += 1 if a + 2 > b : print ( - 1 ) else : print ( a , a + 1 , a + 2 ) NEW_LINE


import java . util . * ; public class CodeForces { static Scanner input = new Scanner ( System . in ) ; public static void main ( String args [ ] ) { String s = input . next ( ) ; String ss = " " ; String sk = " " ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == s . toLowerCase ( ) . charAt ( i ) ) ss += s . charAt ( i ) ; else sk += s . charAt ( i ) ; } if ( ss . length ( ) >= sk . length ( ) ) System . out . println ( s . toLowerCase ( ) ) ; else System . out . println ( s . toUpperCase ( ) ) ; } }

import java . util . Scanner ; public class java { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; String ch = s . next ( ) ; int k = 0 ; int m = 0 ; for ( int i = 0 ; i < ( ch . length ( ) ) ; i ++ ) { if ( ch . charAt ( i ) >= ' a ' && ch . charAt ( i ) <= ' z ' ) k = k + 1 ; else m = m + 1 ; } if ( m > k ) System . out . println ( ch . toUpperCase ( ) ) ; else System . out . println ( ch . toLowerCase ( ) ) ; } }

import java . util . Scanner ; public class Word { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; String ch = s . next ( ) ; int i = 0 ; int j = 0 ; char c ; for ( int r = 0 ; r < ch . length ( ) ; r ++ ) { c = ch . charAt ( r ) ; if ( Character . isUpperCase ( c ) ) { i ++ ; } else { j ++ ; } } if ( j >= i ) { ch = ch . toLowerCase ( ) ; } else { ch = ch . toUpperCase ( ) ; } System . out . println ( ch ) ; } }

import java . util . Scanner ; public class Main {   public static void main ( String [ ] args ) {

s = input ( ) NEW_LINE countc = 0 NEW_LINE counts = 0 NEW_LINE for i in s : if NEW_LINE INDENT ( ord ( i ) >= 97 and ord ( i ) <= 122 ) : counts += 1 elif ( ord ( i ) >= 65 and ord ( i ) <= 90 ) : countc += 1 NEW_LINE DEDENT if ( countc > counts ) : NEW_LINE INDENT print ( s . upper ( ) ) else : NEW_LINE print ( s . lower ( ) ) NEW_LINE DEDENT

word = input ( ' ' ) NEW_LINE upper = 0 l NEW_LINE ower = 0 NEW_LINE for x in word : if NEW_LINE x >= " A " and x <= " Z " : upper += 1 elif x >= " a " and x <= " z " : lower += 1 NEW_LINE if lower >= upper : NEW_LINE INDENT print ( word . lower ( ) ) else : NEW_LINE print ( word . upper ( ) ) NEW_LINE DEDENT

s1 = input ( )   lowers = 0 u NEW_LINE ppers = 0   for c in s1 : if NEW_LINE c . isupper ( ) : uppers += 1 else : lowers += 1   if lowers < uppers : NEW_LINE INDENT print ( s1 . upper ( ) ) else : NEW_LINE print ( s1 . lower ( ) )   NEW_LINE DEDENT

s = input ( ) NEW_LINE c = 0 NEW_LINE def f ( ) : for NEW_LINE i in range ( 2 ) : ddd = 999 NEW_LINE for x in s : if NEW_LINE x . isupper ( ) : c += 1   if c > len ( s ) // 2 : NEW_LINE INDENT s = s . upper ( ) else : NEW_LINE s = s . lower ( ) NEW_LINE DEDENT f ( ) NEW_LINE print ( s ) NEW_LINE

Into = list ( input ( ) ) NEW_LINE big = 0 NEW_LINE small = 0 NEW_LINE out = [ ] NEW_LINE for i in Into : if NEW_LINE ord ( i ) < 97 : big += 1 else : small += 1 NEW_LINE if big > small : for NEW_LINE j in Into : NEW_LINE if ord ( j ) >= 97 : j = chr ( ord ( j ) - 32 ) NEW_LINE out . append ( j ) else : out . append ( j ) else : for j in Into : if NEW_LINE ord ( j ) < 97 : j = chr ( ord ( j ) + 32 ) NEW_LINE out . append ( j ) else : out . append ( j ) NEW_LINE s = ' ' NEW_LINE for k in out : s += kprint ( s ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class Flipping_Game { static class RealScanner { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( " " ) ;   String next ( ) { while ( ! st . hasMoreTokens ( ) ) try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   int [ ] readArray ( int n ) { int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextInt ( ) ; return a ; }   long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } }   public static void main ( String [ ] args ) { RealScanner sc = new RealScanner ( ) ; int n = sc . nextInt ( ) ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; } int count1 = 0 , count0 = 0 , max = - 1 ; for ( int i = 0 ; i < n ; i ++ ) { int val = arr [ i ] ; if ( val == 1 ) { count1 ++ ; if ( count0 > 0 ) { count0 -- ; } } if ( val == 0 ) { count0 ++ ; if ( count0 > max ) { max = count0 ; } } } System . out . println ( count1 + max ) ; } }

import java . io . * ; import java . util . * ;   public class P1 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Map < Integer , ArrayList < Integer > > map = new HashMap < > ( ) ; int n = sc . nextInt ( ) ;   int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < n ; i ++ ) { int cursum = 0 ; int min = Integer . MAX_VALUE ; for ( int j = i ; j < n ; j ++ ) { ArrayList < Integer > al = new ArrayList < > ( ) ; if ( a [ j ] == 0 ) { cursum -= 1 ; } else { cursum += 1 ; } if ( cursum < min ) { min = cursum ; al . add ( i ) ; al . add ( j ) ; map . put ( min , al ) ; } } } int min = Integer . MAX_VALUE ; for ( int k : map . keySet ( ) ) { if ( min > k ) min = k ; }   ArrayList < Integer > p = map . get ( min ) ; int x = p . get ( 0 ) ; int y = p . get ( 1 ) ;   for ( int i = x ; i <= y ; i ++ ) { if ( a [ i ] == 1 ) a [ i ] = 0 ; else a [ i ] = 1 ; } int sum = 0 ;   for ( int i = 0 ; i < n ; i ++ ) { sum += a [ i ] ; } System . out . println ( sum ) ; } }

x = int ( input ( ) )   difference = [ 0 ]   ones = 0 zeros = 0   line = input ( ) . split ( " ▁ " )   for i in line : if ( int ( i ) == 1 ) : ones += 1 else : zeros += 1 difference . append ( zeros - ones )   minimum = 0 maximum = 0   for i in range ( 1 , len ( difference ) ) : result = difference [ i ] - minimum maximum = max ( ones + result , maximum ) minimum = min ( difference [ i ] , minimum )   print ( maximum )   NEW_LINE

n = int ( input ( ) ) zeros_and_ones = list ( map ( int , input ( ) . split ( ) ) ) num_of_ones = zeros_and_ones . count ( 1 ) cnt = 0 max_arr = [ ] print_ans = Truefor i in zeros_and_ones : if 0 not in zeros_and_ones : print_ans = False print ( num_of_ones - 1 ) break if cnt >= 0 : if i == 1 and cnt != 0 : cnt -= 1 if i == 0 : cnt += 1 max_arr . append ( cnt ) if print_ans : print ( num_of_ones + max ( max_arr ) ) NEW_LINE

n = int ( input ( ) ) array = list ( map ( int , input ( ) . split ( ) ) ) maxOnes = sum ( array ) newArray = [ ] for i in array : newArray . append ( 1 if i == 0 else - 1 )   curMaxSum = 0 totalMaxSum = 0 for i in newArray : curMaxSum = max ( 0 , curMaxSum + i ) totalMaxSum = max ( totalMaxSum , curMaxSum )   print ( maxOnes + totalMaxSum if maxOnes != n else n - 1 ) NEW_LINE

def run2 ( ) : numberOfBits = int ( input ( ) ) line = input ( ) . split ( " ▁ " ) bits = [ int ( element ) for element in line ] scores = [ 1 - 2 * element for element in bits ] NEW_LINE


import java . util . * ; import java . io . * ; import java . math . * ;   public class Practice   { static FastReader sc = new FastReader ( ) ; static int mod = ( int ) Math . pow ( 10 , 9 ) + 7 ; static int dp [ ] [ ] ; static ArrayList < Integer > l = new ArrayList < Integer > ( ) ; public static void main ( String [ ] args ) { PrintWriter out = new PrintWriter ( System . out ) ;

n = int ( input ( ) ) g = [ [ ] for i in range ( n ) ] for i in range ( n - 1 ) : a , b = map ( int , input ( ) . split ( ) ) g [ a - 1 ] . append ( b - 1 ) g [ b - 1 ] . append ( a - 1 ) start = list ( map ( int , input ( ) . split ( ) ) ) goal = list ( map ( int , input ( ) . split ( ) ) ) q = [ ( 0 , 0 , 0 , 0 ) ] ans = [ ] while q : node , dst , a , b = q . pop ( ) if dst : if a != ( start [ node ] != goal [ node ] ) : ans . append ( node + 1 ) a = 1 - a else : if b != ( start [ node ] != goal [ node ] ) : ans . append ( node + 1 ) b = 1 - b dst = 1 - dst for to in g [ node ] : g [ to ] . remove ( node ) q . append ( ( to , dst , a , b ) ) print ( len ( ans ) ) print ( " \n " . join ( map ( str , ans ) ) ) NEW_LINE

n = int ( input ( ) ) adj = [ [ ] for i in range ( n + 1 ) ] for i in range ( n - 1 ) : a , b = map ( int , input ( ) . split ( ) ) adj [ a ] . append ( b ) adj [ b ] . append ( a ) u = [ - 1 ] + list ( map ( int , input ( ) . split ( ) ) ) v = [ - 1 ] + list ( map ( int , input ( ) . split ( ) ) ) q = [ ( 1 , 0 , 0 , 0 ) ] ans = [ ] while q : x , a , b , c = q . pop ( ) if a : if b != ( u [ x ] != v [ x ] ) : ans . append ( x ) b = 1 - b else : if c != ( u [ x ] != v [ x ] ) : ans . append ( x ) c = 1 - c a = 1 - a for i in adj [ x ] : adj [ i ] . remove ( x ) q . append ( ( i , a , b , c ) ) print ( len ( ans ) ) print ( ' \n ' . join ( map ( str , ans ) ) ) NEW_LINE

from sys import stdin , stdoutfrom collections import defaultdict , dequenmbr = lambda : int ( stdin . readline ( ) ) lst = lambda : list ( map ( int , stdin . readline ( ) . split ( ) ) ) def bfs ( ) : global ans q = deque ( ) p [ 1 ] = - 1 q . append ( 1 ) while q : src = q . popleft ( ) if p [ src ] != - 1 and p [ p [ src ] ] != - 1 : dp [ src ] = dp [ p [ p [ src ] ] ] if dp [ src ] ^ init [ src - 1 ] != goal [ src - 1 ] : dp [ src ] ^= 1 ans += [ src ] for neigh in g [ src ] : if neigh == p [ src ] : continue p [ neigh ] = src q . append ( neigh )   for _ in range ( 1 ) : NEW_LINE


import java . util . Arrays ; import java . util . Scanner ;   public class hello { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; long t = in . nextLong ( ) ; String num = in . next ( ) ; int dec = num . indexOf ( " . " ) ; num = num . replace ( " . " , " " ) ; char [ ] cs = num . toCharArray ( ) ;   int len = cs . length ; for ( int i = dec ; i < len ; i ++ ) { if ( cs [ i ] - '0' >= 5 ) { len = i + 1 ; break ; } } while ( t > 0 ) { int roundIdx = - 1 ; for ( int i = len - 1 ; i >= dec ; i -- ) { int v = cs [ i ] - '0' ; if ( v >= 5 ) { roundIdx = i ; break ; } } if ( roundIdx == - 1 ) break ; len = roundIdx ; while ( len > 0 && cs [ len - 1 ] == '9' ) { cs [ len - 1 ] = '0' ; len -- ; } if ( len == 0 ) { System . out . print ( "1" ) ; break ; } cs [ len - 1 ] ++ ; t -- ; } System . out . print ( new String ( cs , 0 , dec ) ) ; if ( len - dec > 0 ) { System . out . print ( " . " ) ; System . out . println ( new String ( cs , dec , len - dec ) ) ; } else { System . out . println ( ) ; } } }

import java . io . BufferedReader ; import java . io . FileReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . StringTokenizer ; import java . util . * ; import java . io . * ; public class codeforces { static class Student { int x , y ; Student ( int x , int y ) { this . x = x ; this . y = y ;

n , t = map ( int , input ( ) . split ( ) ) s = '0' + input ( ) f = s . find ( ' . ' ) if f == - 1 : print ( s [ 1 : ] ) exit ( ) r = list ( s [ : f ] + s [ f + 1 : ] ) for i in range ( f , len ( r ) ) : execute = False while r [ i ] >= '5' and r [ i ] <= '9' : if i < f or t <= 0 : break i -= 1 z = ord ( r [ i ] ) + 1 while z == ord ( "9" ) + 1 : i -= 1 z = ord ( r [ i ] ) + 1 while len ( r ) != i + 1 : r . pop ( ) r [ - 1 ] = chr ( z ) t -= 1 execute = True if execute : breakif r [ 0 ] == '0' : r = r [ 1 : ] f -= 1 r += [ '0' ] * max ( f - len ( r ) , 0 ) if len ( r ) == f : print ( ' ' . join ( map ( str , r ) ) ) else : print ( * r [ : f ] , ' . ' , * r [ f : ] , sep = ' ' ) NEW_LINE

import sysn , t = map ( int , sys . stdin . readline ( ) . split ( ) ) x = sys . stdin . readline ( ) y = x . find ( ' . ' ) for i in range ( y + 1 , n ) : if x [ i ] > '4' : for j in range ( t ) : i -= 1 if x [ i ] != '4' : break if i == y : i -= 1 while i and x [ i ] == '9' : i -= 1 x = x [ : i ] + str ( int ( x [ i ] ) + 1 ) + '0' * ( y - i - 1 ) else : x = x [ : i ] + str ( int ( x [ i ] ) + 1 ) breakprint ( x )             NEW_LINE

from sys import * input = stdin . readlinen , t = map ( int , input ( ) . split ( ) ) num = input ( ) idx = num . find ( " . " ) if idx < 0 : print ( num ) exit ( ) cnt = 1 for i in range ( idx + 1 , n ) : if num [ i ] < "5" : if 5 - int ( num [ i ] ) == 1 : cnt += 1 else : cnt = 1 if num [ i ] >= "5" : j = min ( cnt , t ) if num [ i - j ] != " . " : num = num [ : i - j ] + str ( int ( num [ i - j ] ) + 1 ) else : curr = 0 while num [ idx - curr - 1 ] == "9" and ( idx - curr ) != 0 : curr += 1 num = num [ : idx - curr - 1 ] + str ( int ( num [ idx - curr - 1 ] ) + 1 ) + "0" * curr if curr != idx else "1" + "0" * curr breakprint ( num ) NEW_LINE


import java . util . Scanner ;   public class A1348 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int t = scanner . nextInt ( ) ; for ( int i = 0 ; i < t ; i ++ ) { int n = scanner . nextInt ( ) ; int index = n / 2 ; int sum = ( int ) ( 2 * ( Math . pow ( 2 , index ) - 1 ) ) ; System . out . println ( sum ) ; } } }

import java . io . * ; import java . util . * ;   public class Temp { static class Reader { final private int BUFFER_SIZE = 1 << 16 ; private DataInputStream din ; private byte [ ] buffer ; private int bufferPointer , bytesRead ;   public Reader ( ) { din = new DataInputStream ( System . in ) ; buffer = new byte [ BUFFER_SIZE ] ; bufferPointer = bytesRead = 0 ; }   public Reader ( String file_name ) throws IOException { din = new DataInputStream ( new FileInputStream ( file_name ) ) ; buffer = new byte [ BUFFER_SIZE ] ; bufferPointer = bytesRead = 0 ; }   public String readLine ( ) throws IOException { byte [ ] buf = new byte [ 64 ] ;

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ;   public class CF1348A { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int t = Integer . parseInt ( br . readLine ( ) ) ; while ( t -- > 0 ) { int n = Integer . parseInt ( br . readLine ( ) ) ; System . out . println ( ( int ) ( Math . pow ( 2 , Math . floor ( n / 2.0 ) + 1 ) - 2 ) ) ; } } }

import java . util . Scanner ; import java . lang . Math ; public class NewMain { public static void main ( String args [ ] ) { Scanner in = new Scanner ( System . in ) ; int t ; t = in . nextInt ( ) ; for ( int j = 0 ; j < t ; j ++ ) { int n ; n = in . nextInt ( ) ; int sum1 = 0 , sum2 = 0 ; sum1 += Math . pow ( 2 , n ) ; for ( int i = 1 ; i < n / 2 ; i ++ ) { sum1 += Math . pow ( 2 , i ) ; } for ( int i = n / 2 ; i < n ; i ++ ) { sum2 += Math . pow ( 2 , i ) ; } System . out . println ( sum1 - sum2 ) ; } } }

import java . util . * ;   public class balance { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int n = sc . nextInt ( ) ; int c1 = 1 << n ; int c2 = 0 ; for ( int i = 1 ; i < n ; ++ i ) { if ( i < n / 2 ) c1 += 1 << i ; else c2 += 1 << i ; }

t = int ( input ( ) ) for _ in range ( t ) : n = int ( input ( ) ) l = [ 2 ** i for i in range ( 1 , n + 1 ) ] NEW_LINE

for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) x = n // 2 print ( 2 ** ( x + 1 ) - 2 )   NEW_LINE

t = int ( input ( ) ) for i in range ( t ) : n = int ( input ( ) ) sa = ( 1 << n ) for i in range ( 1 , n // 2 ) : sa += ( 1 << i ) sb = 0 for i in range ( n // 2 , n ) : sb += ( 1 << i ) print ( abs ( sb - sa ) ) NEW_LINE

for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) a = 2 k = 4 for i in range ( 1 , n // 2 ) : a += k k *= 2 print ( a ) NEW_LINE

t = int ( input ( ) ) for _ in range ( t ) : n = int ( input ( ) ) li = [ ] for i in range ( 1 , n + 1 ) : li . append ( 2 ** i ) NEW_LINE


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = Integer . parseInt ( sc . next ( ) ) ; int [ ] map = new int [ 10 ] ; for ( int i = 0 ; i < 4 ; i ++ ) { for ( char c : sc . next ( ) . toCharArray ( ) ) { if ( c != ' . ' ) { map [ c - '0' ] ++ ; if ( map [ c - '0' ] > 2 * k ) { System . out . println ( " NO " ) ; return ; } } } } System . out . println ( " YES " ) ; } }

import java . util . * ; import java . util . stream . * ; public class Solution { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int k = scan . nextInt ( ) ; scan . nextLine ( ) ; Map < Integer , Integer > count = new HashMap < > ( ) ; String result = " YES " ; for ( int i = 0 ; i < 4 ; i ++ ) { String s = scan . nextLine ( ) ; for ( int j = 0 ; j < 4 ; j ++ ) { char ch = s . charAt ( j ) ; if ( ch == ' . ' ) continue ; int num = Integer . parseInt ( String . valueOf ( ch ) ) ; if ( ! count . containsKey ( num ) ) { count . put ( num , 0 ) ; } int c = count . get ( num ) ; if ( c == 2 * k ) { result = " NO " ; break ; } else { count . put ( num , c + 1 ) ; } } } System . out . println ( result ) ; } }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ; import java . util . StringTokenizer ; public class Main { static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( newInputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } }    public static void main ( String [ ] args ) { FastReader fs = new FastReader ( ) ; int l = fs . nextInt ( ) ;   HashMap < Integer , Integer > hs = new HashMap < > ( ) ;   for ( int i = 0 ; i < 4 ; i ++ ) { String k = fs . nextLine ( ) ; for ( char ch : k . toCharArray ( ) ) { if ( ch >= '0' && ch <= '9' ) { hs . putIfAbsent ( ( int ) ch , 0 ) ; hs . put ( ( int ) ch , hs . get ( ( int ) ch ) + 1 ) ; } } }   boolean flag = true ;   for ( Integer key : hs . keySet ( ) ) { if ( hs . get ( key ) > l * 2 ) { flag = false ; break ; } }   if ( flag ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; }    } }

import java . util . * ; public class CollectingBeatsIsFun { public static void main ( String [ ] args ) {   Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; Map < Integer , Integer > map = new HashMap < > ( ) ; boolean flag = true ;   for ( int i = 0 ; i < 4 ; i ++ ) { String temp = sc . next ( ) ; for ( int j = 0 ; j < temp . length ( ) ; j ++ ) { if ( temp . charAt ( j ) != ' . ' ) { int num = temp . charAt ( j ) - '0' ; if ( map . containsKey ( num ) ) { map . put ( num , map . get ( num ) + 1 ) ; } else map . put ( num , 1 ) ; } } } sc . close ( ) ; for ( Map . Entry < Integer , Integer > entry : map . entrySet ( ) ) { if ( entry . getValue ( ) > 2 * k ) { flag = false ; break ; } } if ( flag ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } }

k = int ( input ( ) ) l = [ 0 ] * 10 for i in range ( 4 ) : for j in input ( ) : if ( j != ' . ' ) : l [ int ( j ) ] += 1 for i in range ( 10 ) : if l [ i ] > k * 2 : print ( " NO " ) exit ( ) print ( " YES " ) NEW_LINE

k = int ( input ( ) ) a = [ ] for i in range ( 4 ) : s = input ( ) for j in s : if j . isdigit ( ) : a . append ( int ( j ) ) for i in range ( 1 , 10 ) : if a . count ( i ) > k * 2 : print ( " NO " ) breakelse : print ( " YES " ) NEW_LINE

k = int ( input ( ) ) d = { } t = [ ] for i in range ( 10 ) : d [ i ] = 0 for i in range ( 4 ) : arr = input ( ) t . append ( arr ) for i in range ( 4 ) : for j in range ( 4 ) : if t [ i ] [ j ] == " . " : continue else : d [ int ( t [ i ] [ j ] ) ] += 1 for i in range ( 10 ) : if d [ i ] > 2 * k : print ( " NO " ) breakelse : print ( " YES " ) NEW_LINE

from collections import Counterk = int ( input ( ) ) * 2 x = [ ] for i in range ( 4 ) : x . extend ( list ( input ( ) ) ) c = Counter ( x ) v = 0 del c [ ' . ' ] for i in c : if c [ i ] > k : v = 1 breakif v == 1 : print ( " NO " ) else : print ( " YES " ) NEW_LINE

n = int ( input ( ) )   arr = [ ] for i in range ( 4 ) : arr . append ( input ( ) )   flag = Truefor i in arr : for j in i : if j == ' . ' : continue else : c = 0 for k in arr : c += k . count ( j ) if c > ( 2 * n ) : flag = False break   if not flag : break if not flag : break   if flag : print ( " YES " ) else : print ( " NO " ) NEW_LINE


import java . util . Scanner ;   public class Codeforces {   public static void main ( String [ ] args ) {   Scanner input = new Scanner ( System . in ) ;

import java . io . * ; import java . util . * ; public class MyClass { public static void main ( String args [ ] ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( br . readLine ( ) ) ; int arr [ ] = new int [ 3 ] ; while ( n -- > 0 ) { String s [ ] = br . readLine ( ) . split ( " ▁ " ) ; for ( int i = 0 ; i < 3 ; i ++ ) { arr [ i ] += Integer . parseInt ( s [ i ] ) ; } } for ( int i = 0 ; i < 3 ; i ++ ) { if ( arr [ i ] != 0 ) { System . out . println ( " NO " ) ; return ; } } System . out . println ( " YES " ) ; } }

import java . util . Scanner ; public class YoungPhysicist { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n , x , y , z , Sum_X = 0 , Sum_Y = 0 , Sum_Z = 0 ; n = in . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) { x = in . nextInt ( ) ; y = in . nextInt ( ) ; z = in . nextInt ( ) ; Sum_X = Sum_X + x ; Sum_Y = Sum_Y + y ; Sum_Z = Sum_Z + z ; } if ( Sum_X == 0 && Sum_Y == 0 && Sum_Z == 0 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } }

import java . io . * ; import java . util . * ;   public class YoungPhysicist { public static void main ( String args [ ] ) { FScanner in = new FScanner ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; int n = in . nextInt ( ) ; int xsum = 0 , ysum = 0 , zsum = 0 ; while ( n -- > 0 ) { xsum = xsum + in . nextInt ( ) ; ysum = ysum + in . nextInt ( ) ; zsum = zsum + in . nextInt ( ) ; } if ( xsum == 0 && ysum == 0 && zsum == 0 ) out . println ( " YES " ) ; else out . println ( " NO " ) ; out . close ( ) ; }   static class FScanner { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer sb = new StringTokenizer ( " " ) ;   String next ( ) { while ( ! sb . hasMoreTokens ( ) ) { try { sb = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { } } return sb . nextToken ( ) ; } String nextLine ( ) { try { return br . readLine ( ) ; } catch ( IOException e ) { } return " " ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   long nextLong ( ) { return Long . parseLong ( next ( ) ) ; }   int [ ] readArray ( int n ) { int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextInt ( ) ; return a ; }   float nextFloat ( ) { return Float . parseFloat ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } } }

pos = [ 0 , 0 , 0 ] NEW_LINE for i in range ( int ( input ( ) ) ) : forces = input ( ) . split ( ) NEW_LINE for j in range ( 3 ) : pos [ j ] += int ( forces [ j ] ) NEW_LINE if all ( i == 0 for i in pos ) : NEW_LINE INDENT print ( " YES " ) else : NEW_LINE print ( " NO " ) NEW_LINE DEDENT

n = int ( input ( ) ) NEW_LINE x , y , z = 0 , 0 , 0 NEW_LINE for _ in range ( n ) : [ xi , yi , zi ] = [ int ( i ) for i in input ( ) . split ( ' ▁ ' ) ] NEW_LINE x += xi NEW_LINE y += yi NEW_LINE z += zi   if x == 0 and y == 0 and z == 0 : NEW_LINE INDENT print ( " YES " ) else : NEW_LINE print ( " NO " )   NEW_LINE DEDENT

n = int ( input ( ) ) NEW_LINE res = [ [ None , None , None ] for i in range ( n ) ] NEW_LINE for i in range ( n ) : res [ i ] [ 0 ] , res [ i ] [ 1 ] , res [ i ] [ 2 ] = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE ans = [ 0 ] * 3   for i in range ( n ) : ans [ 0 ] += res [ i ] [ 0 ]   for i in range ( n ) : ans [ 1 ] += res [ i ] [ 1 ]   for i in range ( n ) : NEW_LINE ans [ 2 ] += res [ i ] [ 2 ]   if ans [ 0 ] == 0 and ans [ 1 ] == 0 and ans [ 2 ] == 0 : print ( " YES " ) NEW_LINE exit ( ) NEW_LINE print ( " NO " ) NEW_LINE

n = int ( input ( ) ) NEW_LINE x = 0 NEW_LINE y = 0 NEW_LINE z = 0 NEW_LINE for i in range ( n ) : inp = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE x += inp [ 0 ] NEW_LINE y += inp [ 1 ] NEW_LINE z += inp [ 2 ] NEW_LINE if ( x == 0 and y == 0 and z == 0 ) : NEW_LINE INDENT print ( " YES " ) else : NEW_LINE print ( " NO " ) NEW_LINE DEDENT

n = int ( input ( ) ) NEW_LINE x = 0 ; NEW_LINE y = 0 ; NEW_LINE z = 0 NEW_LINE for _ in range ( n ) : a , b , c = map ( int , input ( ) . split ( ) ) NEW_LINE x += a NEW_LINE y += b NEW_LINE z += c NEW_LINE if x == 0 and y == 0 and z == 0 : NEW_LINE INDENT print ( " YES " ) else : NEW_LINE print ( " NO " ) NEW_LINE DEDENT


import java . util . Scanner ;    public class SimpleXML {   public static void main ( String [ ] args ) {

import java . util . * ;   public class Main {    public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . nextLine ( ) ; String [ ] c = s . split ( " > < " ) ; c [ 0 ] = c [ 0 ] . substring ( 1 ) ; c [ c . length - 1 ] = c [ c . length - 1 ] . substring ( 0 , 2 ) ; int spaces = 0 ; for ( int i = 0 ; i < c . length ; i ++ ) { if ( c [ i ] . charAt ( 0 ) != ' / ' ) { for ( int j = spaces ; j > 0 ; j -- ) System . out . print ( " ▁ " ) ; System . out . println ( " < " + c [ i ] + " > " ) ; spaces += 2 ; } else { spaces -= 2 ; for ( int j = spaces ; j > 0 ; j -- ) System . out . print ( " ▁ " ) ; System . out . println ( " < " + c [ i ] + " > " ) ; } }   }   }

import java . util . Scanner ; public class Ishu1 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String str ; int nested = 0 , i , j ; int [ ] degree = new int [ 26 ] ; char [ ] ch = new char [ 1000 ] ; str = scan . next ( ) ; ch = str . toCharArray ( ) ; for ( i = 0 ; i < str . length ( ) ; ++ i ) if ( ch [ i ] >= ' a ' && ch [ i ] <= ' z ' ) { if ( ch [ i - 1 ] == ' < ' ) { for ( j = 1 ; j <= 2 * nested ; ++ j ) System . out . print ( " ▁ " ) ; System . out . println ( " < " + ch [ i ] + " > " ) ; ++ nested ; } else if ( ch [ i - 1 ] == ' / ' ) { -- nested ; for ( j = 1 ; j <= 2 * nested ; ++ j ) System . out . print ( " ▁ " ) ; System . out . println ( " < / " + ch [ i ] + " > " ) ; } } } }

import java . util . * ; import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ;   public final class Xml { public static void main ( String [ ] args ) throws IOException {   BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s = br . readLine ( ) ;   int h = 0 ; int i = 0 ;   while ( i + 1 < s . length ( ) ) { if ( s . charAt ( i + 1 ) == ' / ' ) { h -- ; for ( int j = 0 ; j < 2 * h ; j ++ ) { System . out . print ( ' ▁ ' ) ; } System . out . println ( s . substring ( i , i + 4 ) ) ; i += 4 ; } else { for ( int j = 0 ; j < 2 * h ; j ++ ) { System . out . print ( ' ▁ ' ) ; } System . out . println ( s . substring ( i , i + 3 ) ) ; i += 3 ; h ++ ; } } } }

s = input ( ) s1 = s . split ( ' < ' ) NEW_LINE

a = input ( ) . split ( ' > ' ) NEW_LINE

s = input ( ) s = " " . join ( s . split ( ' > ' ) ) s = " " . join ( s . split ( ' < ' ) ) a = [ ] i = 0 tab = 0 ws = ' ▁ ' while i < len ( s ) : if s [ i ] != ' / ' : a . append ( ws * tab + ' < ' + s [ i ] + ' > ' ) tab += 2 i += 1 if s [ i ] == ' / ' : tab -= 2 a . append ( ws * tab + ' < / ' + s [ i + 1 ] + ' > ' ) i += 2 for i in a : print ( i ) NEW_LINE

str_input = input ( ) queue = [ ] indentation = 0 while ( str_input != " " ) : if ( str_input [ 1 ] == ' / ' ) : print ( " % s % s " % ( indentation * " ▁ " , str_input [ 0 : 4 ] ) ) queue . pop ( ) str_input = str_input [ 4 : ] if ( str_input != " " and str_input [ 1 ] == " / " ) : indentation -= 2 else : print ( " % s % s " % ( indentation * " ▁ " , str_input [ 0 : 3 ] ) ) queue . append ( str_input [ 1 : 2 ] ) str_input = str_input [ 3 : ] if ( str_input != " " and str_input [ 0 : 3 ] != " < / % s " % ( queue [ - 1 ] ) ) : indentation += 2 NEW_LINE

s = input ( ) . split ( ' < ' ) [ 1 : ] level = - 1 arr = set ( ) f = Falsefor i in s : f = False if i [ 0 ] != ' / ' : f = True   if f : level += 1 print ( " ▁ " * ( 2 * level ) + ' < ' + i ) if not f : level -= 1 NEW_LINE


import java . io . * ; import java . math . * ; import java . security . * ; import java . text . * ; import java . util . * ; import javafx . util . Pair ; public class CodeForce { static BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; static StringBuilder sb = new StringBuilder ( ) ; static boolean flag = false ; static int next ( String [ ] sr , int ind ) { return Integer . parseInt ( sr [ ind ] ) ; } public static void main ( String [ ] args ) throws IOException { String sr = br . readLine ( ) ; char [ ] arr = sr . toCharArray ( ) ; int i = sr . length ( ) - 1 ; int count = 0 ; while ( i > 0 ) { if ( arr [ i ] == '0' ) { count ++ ; } else { int j = i - 1 ; while ( j >= 0 && arr [ j ] != '0' ) { arr [ j ] = '0' ; j -- ; } count = count + 2 ; if ( j >= 0 ) arr [ j ] = 1 ; else { count += i ; System . out . println ( count ) ; return ; } } i -- ; } if ( arr [ 0 ] == '0' ) count ++ ; System . out . println ( count ) ; } }

import java . util . * ; import java . io . * ; public class Binary_Number { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter pw = new PrintWriter ( System . out ) ; int t = 1 ; while ( t -- > 0 ) { int carry = 0 ; char a [ ] = br . readLine ( ) . trim ( ) . toCharArray ( ) ; long ans = 0 ; int n = a . length ; for ( int i = n - 1 ; i > 0 ; i -- ) { int val = Integer . parseInt ( " " + a [ i ] ) + carry ; if ( val == 2 ) { ans ++ ; carry = 1 ; } else if ( val == 1 ) { ans += 2 ; carry = 1 ; } else { ans ++ ; } } int val = Integer . parseInt ( " " + a [ 0 ] ) + carry ; if ( val == 2 ) ans ++ ; pw . println ( ans ) ; } pw . flush ( ) ; } }

import java . util . Scanner ; public class BinaryNumber { static public void print ( String s ) { int rem = 0 ; int count = 0 ; for ( int i = s . length ( ) - 1 ; i >= 1 ; i -- ) { int x = s . charAt ( i ) - '0' ; int y = x + rem ; if ( y % 2 == 0 ) { count = count + 1 ; } else { count = count + 2 ; } if ( y != 0 ) { rem = 1 ; } else { rem = 0 ; } } System . out . print ( count + rem ) ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; print ( s ) ; } }

s = list ( input ( ) [ : : - 1 ] ) NEW_LINE i = 0 NEW_LINE l = len ( s ) NEW_LINE carry = False NEW_LINE c = 0 NEW_LINE if s . count ( '1' ) == 1 : NEW_LINE INDENT print ( l - 1 ) NEW_LINE exit ( 0 ) NEW_LINE DEDENT while i < l : NEW_LINE INDENT if s [ i ] == '1' : NEW_LINE INDENT if not carry : NEW_LINE INDENT c += 2 NEW_LINE i += 1 NEW_LINE carry = True NEW_LINE DEDENT else : NEW_LINE INDENT s [ i ] = '0' NEW_LINE c += 1 NEW_LINE i += 1 NEW_LINE DEDENT DEDENT else : NEW_LINE INDENT if carry : NEW_LINE INDENT s [ i ] = '1' NEW_LINE carry = False NEW_LINE DEDENT else : NEW_LINE INDENT c += 1 NEW_LINE i += 1 NEW_LINE DEDENT DEDENT DEDENT print ( c ) NEW_LINE

s = list ( input ( ) ) NEW_LINE n = len ( s ) - 1 NEW_LINE ans = 0 NEW_LINE while s [ n ] != '1' : NEW_LINE INDENT ans += 1 NEW_LINE n -= 1 NEW_LINE DEDENT if n == 0 : NEW_LINE INDENT print ( ans ) NEW_LINE exit ( ) NEW_LINE DEDENT counter = 0 NEW_LINE while n >= 0 : NEW_LINE INDENT if s [ n ] != '0' : NEW_LINE INDENT counter += 1 NEW_LINE n -= 1 NEW_LINE continue NEW_LINE DEDENT ans += ( counter + 1 ) NEW_LINE s [ n ] = '1' NEW_LINE counter = 0 NEW_LINE DEDENT ans += counter + 1 NEW_LINE print ( ans ) NEW_LINE

a = input ( ) [ : : - 1 ] . replace ( ' ' , ' ▁ ' ) . split ( ) NEW_LINE z = len ( a ) - 1 NEW_LINE ans = 0 NEW_LINE i = 0 NEW_LINE while i < z : NEW_LINE INDENT if a [ i ] == '0' : NEW_LINE INDENT while i < z and a [ i ] == '0' : i += 1 ; ans += 1 NEW_LINE DEDENT else : NEW_LINE INDENT ans += 1 NEW_LINE while i < z and a [ i ] == '1' : i += 1 ; ans += 1 NEW_LINE if i == z : ans += 1 NEW_LINE a [ i ] = '1' NEW_LINE DEDENT DEDENT print ( ans ) NEW_LINE

import sys NEW_LINE from array import array NEW_LINE def input ( ) : NEW_LINE INDENT return sys . stdin . buffer . readline ( ) . decode ( ' utf - 8' ) NEW_LINE DEDENT x = list ( map ( int , input ( ) . rstrip ( ) ) ) NEW_LINE y = 0 NEW_LINE ans = 0 NEW_LINE while len ( x ) > 1 : NEW_LINE INDENT if x [ - 1 ] ^ y == 1 : NEW_LINE INDENT y = 1 NEW_LINE ans += 1 NEW_LINE DEDENT else : NEW_LINE INDENT y = ( x [ - 1 ] + y ) >> 1 NEW_LINE DEDENT ans += 1 NEW_LINE x . pop ( ) NEW_LINE DEDENT if y == 1 : NEW_LINE INDENT ans += 1 NEW_LINE DEDENT print ( ans ) NEW_LINE


import java . util . Scanner ; public class GymContest { static int [ ] [ ] mem ; public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; mem = new int [ n ] [ 3 ] ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) arr [ i ] = s . nextInt ( ) ; System . out . println ( dp ( arr , 0 , 0 ) ) ;

import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . * ; import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ;   public class Newbie {   public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskA solver = new TaskA ( ) ; int t ;

import java . util . * ;   public class Test {   static Scanner sc ; static Map < String , Integer > dp ; public static void main ( String [ ] args ) { sc = new Scanner ( System . in ) ; dp = new HashMap < > ( ) ; int t = 1 ; while ( t -- > 0 ) solve ( ) ; }   static void solve ( ) { int n = sc . nextInt ( ) ; int [ ] arr = new int [ n ] ;   for ( int i = 0 ; i < n ; i ++ ) arr [ i ] = sc . nextInt ( ) ;   int ans = 0 ; ans = rest ( 0 , 0 , arr ) ;   System . out . println ( ans ) ;   }   static int rest ( int pvs , int curr_ind , int [ ] arr ) { int ans = 0 ;   if ( curr_ind >= arr . length ) return ans ;   String key = pvs + " - " + curr_ind ; if ( dp . containsKey ( key ) ) return dp . get ( key ) ;   if ( arr [ curr_ind ] == 0 ) { ans = rest ( 0 , curr_ind + 1 , arr ) + 1 ; } else if ( arr [ curr_ind ] == 3 ) { if ( pvs == 1 ) { ans = Math . min ( 1 + rest ( 0 , curr_ind + 1 , arr ) , rest ( 2 , curr_ind + 1 , arr ) ) ; } else if ( pvs == 2 ) ans = Math . min ( rest ( 1 , curr_ind + 1 , arr ) , 1 + rest ( 0 , curr_ind + 1 , arr ) ) ; else ans = Math . min ( rest ( 1 , curr_ind + 1 , arr ) , rest ( 2 , curr_ind + 1 , arr ) ) ;   } else { if ( pvs == arr [ curr_ind ] ) ans = 1 + rest ( 0 , curr_ind + 1 , arr ) ; else ans = rest ( arr [ curr_ind ] , curr_ind + 1 , arr ) ; }   dp . put ( key , ans ) ;   return ans ;   } }

def answer ( n , a ) : num_rest = 0 if a [ 0 ] == 0 : num_rest += 1 NEW_LINE

n = int ( input ( ) )   day = list ( map ( int , input ( ) . split ( ) ) )   inf = 10 ** 20 dp = [ [ inf for _ in range ( 3 ) ] for _ in range ( n + 5 ) ]   NEW_LINE


import java . util . Scanner ;   public class Main {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; String str1 = in . next ( ) ; String str2 = in . next ( ) ; char c1 , c2 ; int a1 , a2 ; int ansSum = 0 ; int arr [ ] = new int [ 26 ] ; for ( int i = 0 ; i < 26 ; i ++ ) { arr [ i ] = - 1 ; } in . close ( ) ; for ( int i = 0 ; i < str1 . length ( ) ; i ++ ) { c1 = str1 . charAt ( i ) ; c2 = str2 . charAt ( i ) ; a1 = ( int ) c1 - 97 ; a2 = ( int ) c2 - 97 ; if ( ( arr [ a2 ] != a1 || arr [ a1 ] != a2 ) && ( arr [ a1 ] != - 1 || arr [ a2 ] != - 1 ) ) { System . out . println ( - 1 ) ; return ; } else if ( a1 == a2 ) { arr [ a1 ] = a1 ; } else if ( arr [ a1 ] == - 1 && arr [ a2 ] == - 1 ) { arr [ a1 ] = a2 ; arr [ a2 ] = a1 ; ansSum ++ ; } } System . out . println ( ansSum ) ; for ( int i = 0 ; i < 26 ; i ++ ) { if ( arr [ i ] != - 1 && arr [ i ] != arr [ arr [ i ] ] ) { System . out . println ( ( char ) ( arr [ i ] + 97 ) + " ▁ " + ( char ) ( arr [ arr [ i ] ] + 97 ) ) ; arr [ arr [ i ] ] = - 1 ; arr [ i ] = - 1 ; } } }   }

import java . io . * ; import java . math . BigInteger ; import java . util . * ;   public class icpc { public static void main ( String [ ] args ) throws IOException {

import java . io . * ; import java . util . * ;   public class A {   static final boolean stdin = true ; static final String filename = " " ; static FastScanner br ; static PrintWriter pw ;   public static void main ( String [ ] args ) throws IOException {   if ( stdin ) { br = new FastScanner ( ) ; pw = new PrintWriter ( new OutputStreamWriter ( System . out ) ) ; } else { br = new FastScanner ( filename + " . in " ) ; pw = new PrintWriter ( new FileWriter ( filename + " . out " ) ) ; }   Solver solver = new Solver ( ) ; solver . solve ( br , pw ) ; }   static class Solver { public void solve ( FastScanner br , PrintWriter pw ) throws IOException { char [ ] a = br . nextToken ( ) . toCharArray ( ) , b = br . nextToken ( ) . toCharArray ( ) ; int c = a . length ; boolean poss = true ; ArrayList < Character > d = new ArrayList < Character > ( ) ; for ( int i = 0 ; i < c ; i ++ ) { if ( a [ i ] != b [ i ] ) { if ( d . contains ( a [ i ] ) || d . contains ( b [ i ] ) ) { poss = false ; break ; } d . add ( a [ i ] ) ; d . add ( b [ i ] ) ; for ( int j = 0 ; j < c ; j ++ ) { if ( b [ j ] == d . get ( d . size ( ) - 1 ) ) { b [ j ] = d . get ( d . size ( ) - 2 ) ; } else if ( b [ j ] == d . get ( d . size ( ) - 2 ) ) { b [ j ] = d . get ( d . size ( ) - 1 ) ; } } }

first = input ( ) . strip ( ) second = input ( ) . strip ( ) mapping = dict ( ) printed = Falsefor i , letter in enumerate ( first ) : if letter == second [ i ] : mapping [ letter ] = second [ i ] else : if mapping . get ( letter ) : if mapping . get ( letter ) != second [ i ] : printed = True print ( - 1 ) break else : if first . count ( letter ) == second . count ( second [ i ] ) : mapping [ letter ] = second [ i ] else : printed = True print ( - 1 ) breakanswers = dict ( ) for k , v in mapping . items ( ) : if answers . get ( v ) : if mapping . get ( v ) == k : continue else : printed = True print ( - 1 ) break else : if k != v : answers [ k ] = v   if not printed : print ( len ( answers ) ) for k , v in answers . items ( ) : print ( k , v ) NEW_LINE

def fun ( s1 , s2 ) : if s1 == s2 : return 0 , [ ] d = { } rep = set ( ) ans = [ ] for k in range ( len ( s1 ) ) : if s1 [ k ] != s2 [ k ] : if s1 [ k ] in d and d [ s1 [ k ] ] != s2 [ k ] or s2 [ k ] in d and d [ s2 [ k ] ] != s1 [ k ] : return - 1 , [ ] if s1 [ k ] in rep or s2 [ k ] in rep : return - 1 , [ ] if s1 [ k ] not in d : ans . append ( s1 [ k ] + s2 [ k ] ) d [ s1 [ k ] ] = s2 [ k ] d [ s2 [ k ] ] = s1 [ k ] else : if s1 [ k ] in d : return - 1 , [ ] rep . add ( s1 [ k ] ) return len ( ans ) , ans s1 = input ( ) s2 = input ( ) ans , changes = fun ( s1 , s2 ) if ans < 1 : print ( ans ) else : print ( ans ) for k in range ( ans ) : print ( changes [ k ] [ 0 ] , changes [ k ] [ 1 ] ) NEW_LINE

import syss = input ( ) t = input ( ) st1 = [ ] st2 = [ ] checked = [ ] right = [ ] for i in range ( len ( s ) ) : if s [ i ] in checked and t [ i ] not in checked : print ( ' - 1' ) sys . exit ( ) if s [ i ] not in checked and t [ i ] in checked : print ( ' - 1' ) sys . exit ( ) if s [ i ] in right and t [ i ] not in right : print ( ' - 1' ) sys . exit ( ) if s [ i ] not in right and t [ i ] in right : print ( ' - 1' ) sys . exit ( ) if s [ i ] not in st1 and s [ i ] not in st2 : if t [ i ] not in st1 and t [ i ] not in st2 : if s [ i ] != t [ i ] : checked . append ( s [ i ] ) checked . append ( t [ i ] ) st1 . append ( s [ i ] ) st2 . append ( t [ i ] ) else : right . append ( s [ i ] ) right . append ( t [ i ] ) if s [ i ] == t [ i ] : if s [ i ] in st1 or s [ i ] in st2 : print ( ' - 1' ) sys . exit ( ) elif t [ i ] in st1 or t [ i ] in st2 : print ( ' - 1' ) sys . exit ( ) if s [ i ] in st2 : if st1 [ st2 . index ( s [ i ] ) ] != t [ i ] : print ( ' - 1' ) sys . exit ( ) if s [ i ] in right or t [ i ] in right : if s [ i ] != t [ i ] : print ( ' - 1' ) sys . exit ( ) print ( len ( st1 ) ) for i in range ( len ( st1 ) ) : print ( st1 [ i ] , end = " ▁ " ) print ( st2 [ i ] ) NEW_LINE

import syss = input ( ) t = input ( ) st1 = [ ] st2 = [ ] checked = [ ] right = [ ] for i in range ( len ( s ) ) : a = [ ] if s [ i ] in checked and t [ i ] not in checked : print ( ' - 1' ) sys . exit ( ) if s [ i ] not in checked and t [ i ] in checked : print ( ' - 1' ) sys . exit ( ) if s [ i ] in right and t [ i ] not in right : print ( ' - 1' ) sys . exit ( ) if s [ i ] not in right and t [ i ] in right : print ( ' - 1' ) sys . exit ( ) if s [ i ] not in st1 and s [ i ] not in st2 : if t [ i ] not in st1 and t [ i ] not in st2 : if s [ i ] != t [ i ] : checked . append ( s [ i ] ) checked . append ( t [ i ] ) st1 . append ( s [ i ] ) st2 . append ( t [ i ] ) else : right . append ( s [ i ] ) right . append ( t [ i ] ) if s [ i ] == t [ i ] : if s [ i ] in st1 or s [ i ] in st2 : print ( ' - 1' ) sys . exit ( ) elif t [ i ] in st1 or t [ i ] in st2 : print ( ' - 1' ) sys . exit ( ) if s [ i ] in st2 : if st1 [ st2 . index ( s [ i ] ) ] != t [ i ] : print ( ' - 1' ) sys . exit ( ) if s [ i ] in right or t [ i ] in right : if s [ i ] != t [ i ] : print ( ' - 1' ) sys . exit ( ) print ( len ( st1 ) ) for i in range ( len ( st1 ) ) : print ( st1 [ i ] , end = " ▁ " ) print ( st2 [ i ] ) NEW_LINE

import sys   string1 = input ( ) string2 = input ( ) st1 = [ ] st2 = [ ] checked = [ ] right = [ ] for i in range ( len ( string1 ) ) : a = [ ] if string1 [ i ] in checked and string2 [ i ] not in checked : print ( ' - 1' ) sys . exit ( ) if string1 [ i ] not in checked and string2 [ i ] in checked : print ( ' - 1' ) sys . exit ( )   if string1 [ i ] in right and string2 [ i ] not in right : print ( ' - 1' ) sys . exit ( ) if string1 [ i ] not in right and string2 [ i ] in right : print ( ' - 1' ) sys . exit ( )   if string1 [ i ] not in st1 and string1 [ i ] not in st2 : if string2 [ i ] not in st1 and string2 [ i ] not in st2 : if string1 [ i ] != string2 [ i ] : checked . append ( string1 [ i ] ) checked . append ( string2 [ i ] ) st1 . append ( string1 [ i ] ) st2 . append ( string2 [ i ] ) else : right . append ( string1 [ i ] ) right . append ( string2 [ i ] ) if string1 [ i ] == string2 [ i ] : if string1 [ i ] in st1 or string1 [ i ] in st2 : print ( ' - 1' ) sys . exit ( ) elif string2 [ i ] in st1 or string2 [ i ] in st2 : print ( ' - 1' ) sys . exit ( ) if string1 [ i ] in st2 : if st1 [ st2 . index ( string1 [ i ] ) ] != string2 [ i ] : print ( ' - 1' ) sys . exit ( ) if string1 [ i ] in right or string2 [ i ] in right : if string1 [ i ] != string2 [ i ] : print ( ' - 1' ) sys . exit ( ) print ( len ( st1 ) ) for i in range ( len ( st1 ) ) : print ( st1 [ i ] , end = " ▁ " ) print ( st2 [ i ] ) NEW_LINE


import java . util . * ;   public class CodeForces698 {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ;

import java . io . BufferedReader ; import java . io . * ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . StringTokenizer ; import java . util . * ; import java . math . * ; public class Main { 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 ; } } public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; PrintWriter pw = new PrintWriter ( System . out ) ; int t = 1 ;

import java . io . * ; import java . util . * ;   public class Dpairs {   public static void main ( String [ ] args ) throws IOException { BufferedReader ob = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringBuffer sb = new StringBuffer ( ) ; String s [ ] = ob . readLine ( ) . split ( " ▁ " ) ; int n = Integer . parseInt ( s [ 0 ] ) ; int k = Integer . parseInt ( s [ 1 ] ) ; int cpy = 0 ; String str [ ] = ob . readLine ( ) . split ( " ▁ " ) ; int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = Integer . parseInt ( str [ i ] ) ;

n , k = map ( int , input ( ) . split ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) diff = max ( l ) - min ( l ) if diff == 0 : print ( 0 , 0 ) elif diff == 1 : print ( 1 , 0 ) else : s = 0 ans = [ ] while ( s < k ) : x = l . index ( min ( l ) ) y = l . index ( max ( l ) ) if max ( l ) - min ( l ) <= 1 : break else :   s += 1 l [ x ] += 1 l [ y ] -= 1 ans . append ( [ y + 1 , x + 1 ] ) print ( max ( l ) - min ( l ) , s ) for i in range ( len ( ans ) ) : print ( * ans [ i ] ) NEW_LINE

towers , operationsNum = map ( int , input ( ) . split ( ) ) towersHeights = list ( map ( int , input ( ) . split ( ) ) ) changes = [ ] for i in range ( operationsNum ) : minH , maxH = min ( towersHeights ) , max ( towersHeights ) instability = max ( towersHeights ) - min ( towersHeights ) minindex , maxindex = towersHeights . index ( minH ) , towersHeights . index ( maxH ) if instability != 0 : changes . append ( str ( maxindex + 1 ) + " ▁ " + str ( minindex + 1 ) ) towersHeights [ minindex ] += 1 towersHeights [ maxindex ] -= 1 print ( max ( towersHeights ) - min ( towersHeights ) , len ( changes ) ) for i in changes : print ( i ) NEW_LINE

''' ▁ ▁ ▁ ▁ Problem ▁ Link ▁ https : / / codeforces . com / contest / 479 / problem / B '''   n , k = map ( int , input ( ) . split ( ) ) towers = list ( map ( int , input ( ) . split ( ) ) )   def get_min_max_indices ( ) : tmp = towers [ 0 ] max_index = 0 min_index = 0 for i in range ( 1 , len ( towers ) ) : if ( towers [ i ] > towers [ max_index ] ) : max_index = i if ( towers [ i ] < towers [ min_index ] ) : min_index = i return min_index , max_index   tracks = [ ] for i in range ( k ) : min_index , max_index = get_min_max_indices ( ) if ( towers [ min_index ] == towers [ max_index ] ) : break towers [ max_index ] -= 1 towers [ min_index ] += 1 tracks . append ( [ max_index + 1 , min_index + 1 ] )   lowest_point , highest_point = get_min_max_indices ( ) print ( towers [ highest_point ] - towers [ lowest_point ] , len ( tracks ) )   for record in tracks : print ( * record ) NEW_LINE

numOfTowers , numOfOperations = map ( int , input ( ) . split ( ) ) heights = list ( map ( int , input ( ) . split ( ) ) ) l = [ ] for i in range ( numOfOperations ) : max_index = heights . index ( max ( heights ) ) min_index = heights . index ( min ( heights ) )   if min_index != max_index : heights [ max_index ] -= 1 heights [ min_index ] += 1 l . append ( [ max_index + 1 , min_index + 1 ] )   print ( max ( heights ) - min ( heights ) , len ( l ) ) for j in l : print ( ' ▁ ' . join ( map ( str , j ) ) ) NEW_LINE

n , k = map ( int , input ( ) . split ( ) )   heights = list ( map ( int , input ( ) . split ( ) ) ) stabilities = [ max ( heights ) - min ( heights ) ] pos = [ ( 0 , 0 ) ]   for i in range ( k ) : higher = heights . index ( max ( heights ) ) lower = heights . index ( min ( heights ) ) heights [ higher ] -= 1 heights [ lower ] += 1 stabilities . append ( max ( heights ) - min ( heights ) ) pos . append ( ( higher + 1 , lower + 1 ) )   smallest = min ( stabilities ) operations = stabilities . index ( smallest )   print ( smallest , operations ) for i in range ( operations ) : print ( * pos [ i + 1 ] ) NEW_LINE


import java . util . * ;   public class Q4 {   public static void main ( String [ ] args ) {

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class A_Nearly_Lucky_Number { public static void main ( String [ ] args ) { FastScanner fs = new FastScanner ( ) ; char [ ] s = fs . next ( ) . toCharArray ( ) ;   int lucky = 0 ; for ( char c : s ) { if ( c == '4' || c == '7' ) { lucky ++ ; } }   System . out . println ( ( lucky == 4 || lucky == 7 ) ? " YES " : " NO " ) ; }   static int min ( int a , int b ) { return Math . min ( a , b ) ; }   static int max ( int a , int b ) { return Math . max ( a , b ) ; }   static long min ( long a , long b ) { return Math . min ( a , b ) ; }   static long max ( long a , long b ) { return Math . max ( a , b ) ; }   static class FastScanner { BufferedReader br ; StringTokenizer st ;   public FastScanner ( ) { 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 ( ) ) ; } char nextChar ( ) { return next ( ) . charAt ( 0 ) ; }   String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } }

import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) throws java . lang . Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s = ( br . readLine ( ) ) ; int c = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == '4' || s . charAt ( i ) == '7' ) { c ++ ; } } if ( c == 4 || c == 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } }

import java . io . * ; import java . util . Scanner ; public class Solution { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; if ( System . getProperty ( " ONLINE _ JUDGE " ) == null ) { try { System . setOut ( new PrintStream ( new FileOutputStream ( " output . txt " ) ) ) ; sc = new Scanner ( new File ( " input . txt " ) ) ; } catch ( Exception e ) { } }

n = int ( input ( ) ) m = 0 while n > 0 : d = n % 10 if d == 4 or d == 7 : m += 1 n = n // 10 if m == 4 or m == 7 : print ( " YES " ) else : print ( " NO " ) NEW_LINE

n = input ( ) k = n . count ( '4' ) + n . count ( '7' ) if k == 4 or k == 7 : print ( " YES " ) else : print ( " NO " ) NEW_LINE

n = input ( ) c = 0 for i in n : if ( i == '4' or i == '7' ) : c += 1 if ( c == 4 or c == 7 ) : print ( ' YES ' ) else : print ( ' NO ' ) NEW_LINE

print ( " NYOE ▁ S " [ sum ( i in '47' for i in input ( ) ) in ( 4 , 7 ) : : 2 ] ) NEW_LINE


import java . util . Scanner ;   public class StupidBusPrice { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ;   int n = scanner . nextInt ( ) ; int m = scanner . nextInt ( ) ;   if ( n == 0 ) { if ( m == 0 ) System . out . println ( "0 ▁ 0" ) ; else System . out . println ( " Impossible " ) ; return ; }   if ( m > n ) { System . out . print ( m + " ▁ " ) ; System . out . println ( n + m - 1 ) ; } else { System . out . print ( n + " ▁ " ) ; if ( m > 1 ) System . out . println ( n + m - 1 ) ; else System . out . println ( n ) ; } } }

import java . util . * ;    public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; int m = input . nextInt ( ) ;

import java . util . * ; import java . util . stream . Collectors ; import java . lang . * ; import java . io . * ; public class Problem { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; if ( n == 0 && m > 0 ) System . out . println ( " Impossible " ) ; else if ( m == 0 ) { System . out . println ( n + " ▁ " + n ) ; } else { int max = 0 , min = n * m ; if ( n >= m ) { min = n ; max = ( n - 1 ) + m ; } else { min = m ; max = n - 1 + m ; } System . out . println ( min + " ▁ " + max ) ; } }   }

arr = list ( map ( int , input ( ) . split ( ) ) ) n = arr [ 0 ] m = arr [ 1 ] if ( n == 0 and m > 0 ) : print ( " Impossible " ) else : a = max ( m , n ) b = m + n - 1 if ( m == 0 ) : b = n a = n print ( str ( a ) + " ▁ " + str ( b ) ) NEW_LINE

n , m = map ( int , input ( ) . split ( ) ) if m == 0 : print ( n , n ) elif n == 0 : print ( ' Impossible ' ) else : print ( max ( n , m ) , n + m - 1 ) NEW_LINE

n , m = map ( int , input ( ) . split ( ) )   if n == 0 : if m == 0 : print ( '0 ▁ 0' ) else : print ( ' Impossible ' )   else : if m == 0 : print ( str ( n ) + ' ▁ ' + str ( n ) ) NEW_LINE

n , m = map ( int , input ( ) . split ( ) ) if n == 0 : if m == 0 : print ( 0 , 0 ) else : print ( " Impossible " ) else : print ( n + max ( 0 , m - n ) , n + max ( 0 , m - 1 ) ) NEW_LINE


import java . util . Scanner ; public class Main { public static boolean notSqr ( int num ) { return ( num < 0 ) ? true : Math . sqrt ( num ) > ( int ) Math . sqrt ( num ) ; } public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) , i , k = - 1 ; int [ ] a = new int [ 1000 ] ; for ( i = 0 ; i < n ; i ++ ) { a [ i ] = scan . nextInt ( ) ; if ( notSqr ( a [ i ] ) ) k = ( k == - 1 ) ? i : ( ( a [ i ] > a [ k ] ) ? i : k ) ; } System . out . println ( a [ k ] ) ; } }

import java . util . * ;    public class Main {   public static void main ( String [ ] args ) {

import java . util . Arrays ; import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int [ ] nums = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { nums [ i ] = scanner . nextInt ( ) ; } Arrays . sort ( nums ) ; for ( int i = n - 1 ; i >= 0 ; i -- ) { if ( ( Math . sqrt ( nums [ i ] ) % 1 ) != 0 ) { System . out . println ( nums [ i ] ) ; break ; } } } }

import java . util . * ; public class PerfectSquare { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int a [ ] = new int [ n ] ; int max = - ( int ) Math . pow ( 10 , 6 ) ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; if ( ! isPerfect ( a [ i ] ) ) { if ( a [ i ] > max ) { max = a [ i ] ; } } } System . out . println ( max ) ; } static boolean isPerfect ( int n ) { double b = Math . sqrt ( n ) ; if ( b == ( int ) b ) return true ; else return false ; } }

import math   n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) mx = - 10000000 for num in l : if ( num < 0 ) : mx = max ( mx , num ) else : k = int ( math . sqrt ( num ) ) if ( k * k < num ) : mx = max ( mx , num ) print ( mx ) NEW_LINE

import mathn = int ( input ( ) ) s = list ( map ( int , input ( ) . strip ( ) . split ( ) ) ) s . sort ( reverse = True ) for i in s : if i >= 0 : t = math . sqrt ( i ) if t != int ( t ) : print ( i ) break else : print ( i ) break NEW_LINE

import mathdef check ( x ) : y = int ( math . sqrt ( x ) ) if ( x == y * y ) : return False return Truen = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) a . sort ( ) for i in range ( n - 1 , - 1 , - 1 ) : if ( a [ i ] < 0 or check ( a [ i ] ) ) : print ( a [ i ] ) break NEW_LINE

num = int ( input ( ) ) arr = sorted ( map ( int , input ( ) . split ( ) ) )     for n in arr : if n < 0 : ans = n else : x = int ( n ** 0.5 ) if n != x * x : ans = n   print ( ans )     NEW_LINE

n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) mx = - 10000000 for num in l : if ( num < 0 ) : mx = max ( mx , num ) beg = 0 end = 1000 while ( beg <= end ) : mid = beg + ( end - beg ) // 2 if ( mid * mid <= num ) : beg = mid + 1 else : end = mid - 1 if ( end * end < num ) : mx = max ( mx , num ) print ( mx ) NEW_LINE


import java . util . Scanner ;   public class LoveTriangle {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int planesNumber = sc . nextInt ( ) ;   sc . nextLine ( ) ;

import java . util . Scanner ;   public class Problem25 {   public static void main ( String [ ] args ) {

import java . util . * ;    public class Triangle {   static class Edge { int v , u ; public Edge ( int v , int u ) { this . v = v ; this . u = u ; } } public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; int n = scn . nextInt ( ) ; int [ ] [ ] adj = new int [ n ] [ n ] ; LinkedList < Edge > edges = new LinkedList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { int v = scn . nextInt ( ) - 1 ; adj [ i ] [ v ] = 1 ; adj [ v ] [ i ] = 1 ; edges . add ( new Edge ( i , v ) ) ; } for ( Edge e : edges ) for ( int i = 0 ; i < n ; i ++ ) if ( adj [ i ] [ e . v ] == 1 && adj [ i ] [ e . u ] == 1 ) { System . out . println ( " YES " ) ; return ; } System . out . println ( " NO " ) ; } }

n = int ( input ( ) ) f = [ 1 ] + list ( map ( int , input ( ) . split ( ) ) ) for i in range ( 1 , n + 1 ) : if f [ f [ f [ i ] ] ] == i : print ( ' Yes ' ) breakelse : print ( ' No ' ) NEW_LINE

import sys   stdin = sys . stdininf = 1 << 60 mod = 1000000007 eps = 1e-10   sys . setrecursionlimit ( 10 ** 7 )   ni = lambda : int ( ns ( ) ) nin = lambda y : [ ni ( ) for _ in range ( y ) ] na = lambda : list ( map ( int , stdin . readline ( ) . split ( ) ) ) nan = lambda y : [ na ( ) for _ in range ( y ) ] ns = lambda : stdin . readline ( ) . rstrip ( ) nsn = lambda y : [ ns ( ) for _ in range ( y ) ] nas = lambda : stdin . readline ( ) . split ( )   n = ni ( ) a = list ( map ( lambda x : x - 1 , na ( ) ) )   ok = Falsefor i in range ( n ) : A = i B = a [ A ] C = a [ B ] if A != B and B != C and A != C and a [ C ] == A : ok = True   if ok : print ( " YES " ) else : print ( " NO " ) NEW_LINE

n = int ( input ( ) ) l = [ ] a = ( input ( ) . split ( " ▁ " ) ) NEW_LINE


import java . util . * ;   public class CodeForces990B { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) , k = input . nextInt ( ) ; int ans = 0 ; List < Integer > list = new ArrayList < > ( ) ; int [ ] count = new int [ 1000000 * 4 ] ; for ( int i = 0 ; i < n ; i ++ ) { int x = input . nextInt ( ) ; list . add ( x ) ; count [ x ] ++ ; } Collections . sort ( list ) ; for ( int i = n - 1 ; i >= 1 ; i -- ) { if ( list . get ( i ) > list . get ( i - 1 ) && list . get ( i ) <= list . get ( i - 1 ) + k ) ans += count [ list . get ( i - 1 ) ] ; } System . out . println ( n - ans ) ; } }

import com . sun . security . jgss . GSSUtil ;   import javax . swing . table . AbstractTableModel ; import java . io . * ; import java . util . * ; import java . util . concurrent . atomic . AtomicReferenceFieldUpdater ;

import java . io . * ; import java . util . * ; public class Asd { static PrintWriter w = new PrintWriter ( System . out ) ; static FastScanner s = new FastScanner ( ) ; public static void main ( String [ ] args ) { int t = 1 ;

n , k = map ( int , input ( ) . split ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) l . sort ( ) a = 0 i = 0 while i < ( n - 1 ) : j = i + 1 while j < n and l [ j ] == l [ i ] : j += 1 if j == n : break else : if l [ j ] <= l [ i ] + k : a += ( j - i ) i = jprint ( n - a ) NEW_LINE

n , K = map ( int , input ( ) . split ( ) ) b = sorted ( [ int ( x ) for x in input ( ) . split ( ) ] ) l = cur = 0 for i in range ( 1 , n ) : if b [ i ] == b [ i - 1 ] : continue if b [ i ] > b [ i - 1 ] + K : l = i else : cur += ( i - l ) ; l = iprint ( n - cur ) NEW_LINE

n , k = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) j = 0 a . sort ( ) n1 = nfor i in range ( n ) : while a [ j ] < a [ i ] : if a [ i ] <= a [ j ] + k : n1 -= 1 j += 1 print ( n1 ) NEW_LINE

n , k = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) a . sort ( ) slow , fast = 0 , 0 while fast < n : if a [ slow ] == a [ fast ] : fast += 1 elif abs ( a [ slow ] - a [ fast ] ) <= k : a [ slow ] = 0 slow += 1 else : slow += 1 ans = 0 for i in a : if i != 0 : ans += 1 print ( ans ) NEW_LINE


import java . util . * ; public class contest10 { static Scanner scn = new Scanner ( System . in ) ;

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ;   public class Codeforces {   private static final Scanner sc = new Scanner ( System . in ) ; private static final BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; private static final long MOD = ( long ) ( 1e9 + 7 ) ;   public static int [ ] LPS ( String p ) { int [ ] lps = new int [ p . length ( ) ] ;   int i = 1 ; int j = 0 ; while ( i < p . length ( ) ) { if ( p . charAt ( i ) == p . charAt ( j ) ) { lps [ i ] = j + 1 ; i ++ ; j ++ ; } else { if ( j == 0 ) { lps [ i ] = 0 ; i ++ ; } else { j = lps [ j - 1 ] ; } } } return lps ; }   public static void KMP ( String text , String pattern ) { int [ ] lps = LPS ( pattern ) ; int i = 0 ; int j = 0 ; ArrayList < Integer > matches = new ArrayList < > ( ) ; while ( i < text . length ( ) ) { if ( text . charAt ( i ) == pattern . charAt ( j ) ) { i ++ ; j ++ ; } else { if ( j != 0 ) { j = lps [ j - 1 ] ; } else { i ++ ; } } if ( j == pattern . length ( ) ) { matches . add ( i - j ) ; j = lps [ j - 1 ] ; } } for ( int x : matches ) { System . out . println ( " Match ▁ at ▁ : ▁ " + x ) ; } }   private static class SegmentTree { private long [ ] st ; private int size ; private int n ; private long [ ] a ; SegmentTree ( long [ ] a , int n ) { this . size = 4 * n ; this . n = n ; this . a = a ; st = new long [ size ] ;

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 ; FastReader in = new FastReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; BDoubleMatrix solver = new BDoubleMatrix ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }   static class BDoubleMatrix { public void solve ( int testNumber , FastReader in , PrintWriter out ) { int n = in . nextInt ( ) , m = in . nextInt ( ) ; int [ ] [ ] a = new int [ n ] [ m ] ; int [ ] [ ] b = new int [ n ] [ m ] ; int [ ] [ ] min = new int [ n ] [ m ] ; int [ ] [ ] max = new int [ n ] [ m ] ; in . readArray ( a ) ; in . readArray ( b ) ; for ( int i = 0 ; i < n ; ++ i ) { for ( int j = 0 ; j < m ; ++ j ) { min [ i ] [ j ] = Math . min ( a [ i ] [ j ] , b [ i ] [ j ] ) ; max [ i ] [ j ] = Math . max ( a [ i ] [ j ] , b [ i ] [ j ] ) ; } }

n , m = map ( int , input ( ) . split ( ) ) A = [ list ( map ( int , input ( ) . split ( ) ) ) for i in range ( n ) ] B = [ list ( map ( int , input ( ) . split ( ) ) ) for i in range ( n ) ]   X = [ [ 0 ] * m for i in range ( n ) ] Y = [ [ 0 ] * m for i in range ( n ) ]   for i in range ( n ) : for j in range ( m ) : X [ i ] [ j ] = min ( A [ i ] [ j ] , B [ i ] [ j ] ) Y [ i ] [ j ] = max ( A [ i ] [ j ] , B [ i ] [ j ] )   NEW_LINE

N , M = map ( int , input ( ) . split ( ) ) mat1 = [ list ( map ( int , input ( ) . split ( ) ) ) for i in range ( N ) ] mat2 = [ list ( map ( int , input ( ) . split ( ) ) ) for i in range ( N ) ]   ans = ' Possible ' for r in range ( N ) : for c in range ( M ) : bigger_v = max ( mat1 [ r ] [ c ] , mat2 [ r ] [ c ] ) smaller_v = min ( mat1 [ r ] [ c ] , mat2 [ r ] [ c ] ) if r > 0 : bigger_prev = max ( mat1 [ r - 1 ] [ c ] , mat2 [ r - 1 ] [ c ] ) smaller_prev = min ( mat1 [ r - 1 ] [ c ] , mat2 [ r - 1 ] [ c ] ) if not ( bigger_v > bigger_prev and smaller_v > smaller_prev ) : ans = ' Impossible ' break if c > 0 : bigger_prev = max ( mat1 [ r ] [ c - 1 ] , mat2 [ r ] [ c - 1 ] ) smaller_prev = min ( mat1 [ r ] [ c - 1 ] , mat2 [ r ] [ c - 1 ] ) if not ( bigger_v > bigger_prev and smaller_v > smaller_prev ) : NEW_LINE

a , b = map ( int , input ( ) . split ( ) ) flag = 0 l1 = [ ] l2 = [ ] for i in range ( a * 2 ) : l3 = list ( map ( int , input ( ) . split ( ) ) ) if i < a : l1 . append ( l3 ) else : l2 . append ( l3 ) for x in range ( b ) : if l1 [ i - a ] [ x ] > l2 [ i - a ] [ x ] : l1 [ i - a ] [ x ] , l2 [ i - a ] [ x ] = l2 [ i - a ] [ x ] , l1 [ i - a ] [ x ] if x > 0 and ( l1 [ i - a ] [ x ] <= l1 [ i - a ] [ x - 1 ] or l2 [ i - a ] [ x ] <= l2 [ i - a ] [ x - 1 ] ) : flag = 1 if flag : print ( ' Impossible ' ) exit ( ) for x in range ( b ) : for i in range ( a - 1 ) : if l1 [ i ] [ x ] >= l1 [ i + 1 ] [ x ] or l2 [ i ] [ x ] >= l2 [ i + 1 ] [ x ] : print ( ' Impossible ' ) exit ( ) print ( ' Possible ' ) NEW_LINE

def check ( a , n , m ) : for i in range ( n ) :   if ( sorted ( a [ i ] ) != a [ i ] or len ( a [ i ] ) != len ( set ( a [ i ] ) ) ) : return 0   return 1   n , m = map ( int , input ( ) . split ( ) ) a = [ ] b = [ ] a1 = [ ] b1 = [ ] for i in range ( m ) : a1 . append ( [ 0 ] * n ) b1 . append ( [ 0 ] * n ) for i in range ( n ) : l = [ int ( x ) for x in input ( ) . split ( ) ] a . append ( l ) for i in range ( n ) : l = [ int ( x ) for x in input ( ) . split ( ) ] b . append ( l )     for i in range ( n ) : for j in range ( m ) : x = a [ i ] [ j ] y = b [ i ] [ j ] a [ i ] [ j ] = min ( x , y ) b [ i ] [ j ] = max ( x , y )     for i in range ( n ) : for j in range ( m ) : a1 [ j ] [ i ] = a [ i ] [ j ] b1 [ j ] [ i ] = b [ i ] [ j ]     if ( check ( a , n , m ) == 1 and check ( a1 , m , n ) == 1 and check ( b , n , m ) == 1 and check ( b1 , m , n ) == 1 ) : print ( " Possible " ) else : print ( " Impossible " ) NEW_LINE

def inp ( ) : return map ( int , input ( ) . split ( ) )   def check ( arr , n , m ) : for i in range ( n ) : for j in range ( 1 , m ) : if arr [ i ] [ j ] <= arr [ i ] [ j - 1 ] : return 1 for i in range ( m ) : for j in range ( 1 , n ) : if arr [ j ] [ i ] <= arr [ j - 1 ] [ i ] : return 1 return 0   n , m = inp ( ) arr = [ ] for i in range ( n ) : arr . append ( list ( inp ( ) ) ) brr = [ ] for i in range ( n ) : brr . append ( list ( inp ( ) ) ) for i in range ( n ) : for j in range ( m ) : if arr [ i ] [ j ] > brr [ i ] [ j ] : x = arr [ i ] [ j ] arr [ i ] [ j ] = brr [ i ] [ j ] brr [ i ] [ j ] = xf = check ( arr , n , m ) | check ( brr , n , m ) if f == 1 : print ( " Impossible " ) else : print ( " Possible " ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . * ;   public class Main {   public static boolean check ( String Number , String Divi ) { for ( int i = 0 ; i <= 9 ; i ++ ) { String ch = i + " " ; if ( Number . contains ( ch ) && Divi . contains ( ch ) ) { return true ; } } return false ; }   public static void main ( String [ ] args ) throws IOException { FastScanner input = new FastScanner ( ) ; int n = input . nextInt ( ) ; String a [ ] = new String [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = input . next ( ) ; } for ( int i = 0 ; i < a [ 0 ] . length ( ) ; i ++ ) { for ( int j = 0 ; j < n - 1 ; j ++ ) { if ( a [ j ] . charAt ( i ) != a [ j + 1 ] . charAt ( i ) ) { System . out . println ( i ) ; return ; } } }   }   static class FastScanner {   BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( " " ) ;   String next ( ) { while ( ! st . hasMoreTokens ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   int [ ] readArray ( int n ) { int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = nextInt ( ) ; } return a ; }   long nextLong ( ) {   return Long . parseLong ( next ( ) ) ; }   double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } }   }

import java . util . * ; import java . lang . * ; import java . io . * ;   public class Main { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner sx = new Scanner ( System . in ) ; int n = sx . nextInt ( ) ; int i = 1 ; String s1 = sx . next ( ) ;

import java . util . * ; import java . io . * ; import java . lang . * ;   public class MainClass { private static BufferedReader br = null ; private static StringTokenizer st = null ; static { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } private static String str ( ) throws IOException { return br . readLine ( ) ; } private static int ints ( ) throws IOException { return Integer . parseInt ( br . readLine ( ) ) ; } private static int [ ] ints ( int N ) throws IOException { st = new StringTokenizer ( br . readLine ( ) ) ; int [ ] nums = new int [ N ] ; for ( int i = 0 ; i < N ; i += 1 ) { nums [ i ] = Integer . parseInt ( st . nextToken ( ) ) ; } return nums ; } public static void main ( String [ ] args ) throws IOException { int N = ints ( ) ; String [ ] nums = new String [ N ] ; for ( int i = 0 ; i < N ; i += 1 ) { nums [ i ] = str ( ) ; } Solution obj = new Solution ( ) ; System . out . println ( obj . longestcommonPrefix ( nums , N ) ) ; } }   class Solution { public int longestcommonPrefix ( String [ ] nums , int N ) { String first = nums [ 0 ] ; int length = first . length ( ) ; String prefix = " " ; for ( int i = 0 ; i < length ; i += 1 ) { boolean isFound = true ; String curr_pre = first . substring ( 0 , i + 1 ) ; for ( int j = 1 ; j < N && isFound ; j += 1 ) { if ( ! nums [ j ] . startsWith ( curr_pre ) ) isFound = false ; } if ( isFound ) prefix = curr_pre ; if ( ! isFound ) return prefix . length ( ) ; } return prefix . length ( ) ; } }

import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; String [ ] array = new String [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { array [ i ] = scan . next ( ) ; } int count = 0 ; for ( int i = 0 ; i < array [ 0 ] . length ( ) ; i ++ ) { for ( int j = 0 ; j < array . length ; j ++ ) { if ( array [ 0 ] . charAt ( i ) != array [ j ] . charAt ( i ) ) { System . out . println ( count ) ; return ; } } count ++ ; } } }

import java . util . * ; public class P2 {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String s [ ] = new String [ n ] ; boolean flag = true ; int c = 0 ; for ( int i = 0 ; i < n ; i ++ ) s [ i ] = sc . next ( ) ; for ( int i = 0 ; i < s [ 0 ] . length ( ) ; i ++ ) { for ( int j = 0 ; j < n - 1 ; j ++ ) { if ( s [ j ] . charAt ( i ) == s [ j + 1 ] . charAt ( i ) ) { continue ; } else { flag = false ; break ; } } if ( flag ) { c ++ ; } else { break ; } } System . out . println ( c ) ; } }

n = int ( input ( ) ) s1 = input ( ) s2 = input ( ) mi = 0 for j in range ( len ( s1 ) ) : if s1 [ j ] != s2 [ j ] : mi = j breaktemp = s2for j in range ( n - 2 ) : s3 = input ( ) for i in range ( len ( temp ) ) : if temp [ i ] != s3 [ i ] : mi = min ( i , mi ) break temp = s3print ( mi ) NEW_LINE

num = int ( input ( ) ) arr , arr2 = ( [ ] , [ ] ) i = 0 for x in range ( num ) : nums = input ( ) while len ( arr ) < len ( nums ) : arr . append ( set ( ) ) for y in range ( len ( nums ) ) : arr [ y ] . add ( nums [ y ] ) y = 0 for z in range ( len ( arr ) ) : if len ( arr [ z ] ) == 1 and i == z : arr2 . append ( arr [ z ] ) i += 1 else : breakif len ( nums ) > 1 : print ( len ( arr2 ) ) else : print ( 0 ) NEW_LINE

n = int ( input ( ) )   str1 = str ( input ( ) ) ctr = len ( str1 ) for i in range ( 2 , n + 1 ) : strn = str ( input ( ) ) ans = 0 for j in range ( ctr ) : if str1 [ j ] != strn [ j ] : break else : ans += 1 ctr = ans     print ( ctr ) NEW_LINE

a = int ( input ( ) ) c = [ ]   cnt = 0 for i in range ( a ) : c . append ( input ( ) )   for i in range ( 0 , len ( c [ 0 ] ) ) : b = 0 for j in range ( 1 , a ) : if c [ j ] [ i ] == c [ 0 ] [ i ] : b += 1 else : break if b == a - 1 : cnt += 1 else : breakprint ( cnt )                                                           NEW_LINE

cases = int ( input ( ) )   numbers = [ ] while cases : cases -= 1 s = input ( ) numbers . append ( s )   numbers . sort ( )   ct = 0   for i , j in zip ( numbers [ 0 ] , numbers [ - 1 ] ) : if i == j : ct += 1 else : print ( ct ) break NEW_LINE


import java . util . Scanner ;   public class NewYearandDays {   public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; String s = scan . nextLine ( ) ; String [ ] a = s . split ( " ▁ " , - 1 ) ;   int n = Integer . valueOf ( a [ 0 ] ) ; if ( a [ 2 ] . equals ( " month " ) ) { if ( n == 31 ) { System . out . println ( "7" ) ; } else if ( n > 29 ) { System . out . println ( "11" ) ; } else { System . out . println ( "12" ) ; } } else { int p = 366 / 7 ; if ( n == 5 || n == 6 ) { ++ p ; } System . out . println ( p ) ;   } }   }

import java . util . Scanner ;     public class JavaApplication173 {      public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ;   int n = sc . nextInt ( ) ; String s1 = sc . next ( ) ; String s2 = sc . next ( ) ;   if ( s2 . charAt ( 0 ) == ' w ' ) { int x = 0 ; int current = 5 ; for ( int i = 0 ; i < 366 ; i ++ ) { if ( current == n ) { x ++ ; } current ++ ; if ( current > 7 ) { current = 1 ; } } System . out . println ( x ) ; return ; } else { switch ( n ) { case 30 : System . out . println ( 11 ) ; break ; case 31 : System . out . println ( 7 ) ; break ; default : System . out . println ( 12 ) ; break ; } }   } }

import java . util . Scanner ;   public class Candy { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; sc . next ( ) ; String s = sc . next ( ) ; sc . close ( ) ;   if ( s . equals ( " week " ) ) { if ( n == 5 || n == 6 ) System . out . println ( 53 ) ; else System . out . println ( 52 ) ; } else { if ( n <= 29 ) System . out . println ( 12 ) ; else if ( n == 30 ) System . out . println ( 11 ) ; else System . out . println ( 7 ) ; }   } }

import java . util . Scanner ;   public class NewYearAndDays { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; String str = input . nextLine ( ) ;   input . close ( ) ;   StringBuffer num = new StringBuffer ( ) ;   if ( Character . isDigit ( str . charAt ( 0 ) ) && Character . isDigit ( str . charAt ( 1 ) ) ) num . append ( str . charAt ( 0 ) ) . append ( str . charAt ( 1 ) ) ; else num . append ( str . charAt ( 0 ) ) ; int number = Integer . parseInt ( num . toString ( ) ) ;   if ( str . contains ( " month " ) ) { if ( number <= 29 ) System . out . println ( 12 ) ; else if ( number == 30 ) System . out . println ( 11 ) ; else System . out . println ( 7 ) ; } else { if ( number == 5 || number == 6 ) System . out . println ( 53 ) ; else System . out . println ( 52 ) ; } } }

import java . util . Scanner ;   public class NYDays { public static void main ( String [ ] args ) {   Scanner in = new Scanner ( System . in ) ; int x = in . nextInt ( ) ; String s = in . nextLine ( ) ;   in . close ( ) ; System . out . println ( s . charAt ( s . length ( ) - 1 ) == ' k ' ? x == 5 || x == 6 ? 53 : 52 : x < 30 ? 12 : x < 31 ? 11 : 7 ) ; } }

s = list ( input ( ) . split ( ) )   if s [ - 1 ] == " week " : if s [ 0 ] in "56" : print ( 53 ) else : print ( 52 ) else : if int ( s [ 0 ] ) == 31 : print ( 7 ) elif int ( s [ 0 ] ) == 30 : print ( 11 ) else : print ( 12 ) NEW_LINE

M = [ 31 ] * 7 + [ 30 ] * 4 + [ 29 ] ; n , _ , s = input ( ) . split ( ) ; print ( 52 + ( n in '56' ) if s > ' n ' else sum ( i >= int ( n ) for i in M ) ) NEW_LINE

s = input ( ) . split ( ) x = int ( s [ 0 ] ) if s [ - 1 ] == ' month ' : if x == 31 : print ( 7 ) elif x == 30 : print ( 11 ) else : print ( 12 ) else : print ( 52 if ( x < 5 or x > 6 ) else 53 ) NEW_LINE

s = input ( ) . split ( ) days = 366   if s [ 2 ] == ' week ' : ans = 52 if int ( s [ 0 ] ) == 5 or int ( s [ 0 ] ) == 6 : ans += 1 print ( ans )   else : if int ( s [ 0 ] ) == 31 : print ( 7 ) elif int ( s [ 0 ] ) == 30 : print ( 11 )   else : print ( 12 ) NEW_LINE


import java . util . * ; public class square { public static void main ( String ar [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String d = sc . next ( ) ; char [ ] dir = d . toCharArray ( ) ; int [ ] jumps = new int [ n ] ; for ( int j = 0 ; j < n ; j ++ ) jumps [ j ] = sc . nextInt ( ) ; HashSet < Integer > visited = new HashSet ( ) ; visited . add ( 0 ) ; int curr = 0 ; while ( true ) { if ( dir [ curr ] == ' < ' ) curr = curr - jumps [ curr ] ; else if ( dir [ curr ] == ' > ' ) curr = curr + jumps [ curr ] ; if ( curr < 0 || curr >= n ) { System . out . println ( " FINITE " ) ; return ; } else if ( visited . contains ( curr ) ) { System . out . println ( " INFINITE " ) ; return ; } visited . add ( curr ) ; } } }

import com . sun . org . apache . bcel . internal . generic . AALOAD ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . math . BigInteger ; import java . util . * ; import java . util . stream . IntStream ; import javafx . util . Pair ;   public class Main {   static void sort ( int a [ ] ) { Random ran = new Random ( ) ; for ( int i = 0 ; i < a . length ; i ++ ) { int r = ran . nextInt ( a . length ) ; int temp = a [ r ] ; a [ r ] = a [ i ] ; a [ i ] = temp ; }   Arrays . sort ( a ) ; }   public static void main ( String [ ] args ) throws IOException {   Scanner input = new Scanner ( System . in ) ;   int n = input . nextInt ( ) ; String s = input . next ( ) ; int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = input . nextInt ( ) ; } int count = 0 ; for ( int i = 0 ; i < n ; ) { if ( count > n ) { System . out . println ( " INFINITE " ) ; return ; } count ++ ; if ( s . charAt ( i ) == ' > ' ) { if ( ( i + 1 + a [ i ] ) > n ) { System . out . println ( " FINITE " ) ; return ; } else { i = ( i + a [ i ] ) ; } } else if ( s . charAt ( i ) == ' < ' ) { if ( ( ( i + 1 ) - a [ i ] ) <= 0 ) { System . out . println ( " FINITE " ) ; return ; } else { i = i - a [ i ] ; } } } System . out . println ( " INFINITE " ) ; }   }

n = int ( input ( ) ) s = input ( ) r = lambda : list ( map ( int , input ( ) . split ( ) ) ) arr = r ( )     f = Truevisited = set ( ) pos = 0 while 1 : if pos < 0 or pos >= n : break   if pos in visited : f = False break   visited . add ( pos ) if s [ pos ] == ' > ' : pos += arr [ pos ] else : pos -= arr [ pos ]     print ( " FINITE " if f else " INFINITE " )     NEW_LINE

if __name__ == ' _ _ main _ _ ' : Y = lambda : list ( map ( int , input ( ) . split ( ) ) ) N = lambda : int ( input ( ) )   n = N ( ) s = input ( ) a = Y ( ) nxt , ans = 0 , 0   for i in range ( n ) : nxt += [ a [ nxt ] , - a [ nxt ] ] [ s [ nxt ] == ' < ' ] if nxt >= n or nxt < 0 : ans = 2 break print ( " INFINITE " [ ans : ] ) NEW_LINE

if __name__ == ' _ _ main _ _ ' : Y = lambda : list ( map ( int , input ( ) . split ( ) ) ) N = lambda : int ( input ( ) )   n = N ( ) s = input ( ) a = Y ( ) nxt , ans = 0 , 0   for i in range ( n ) : nxt += a [ nxt ] if s [ nxt ] == ' > ' else - a [ nxt ] if nxt >= n or nxt < 0 : ans = 2 break print ( " INFINITE " [ ans : ] ) NEW_LINE

n = int ( input ( ) ) s = input ( ) d = { } a = list ( map ( int , input ( ) . split ( ) ) ) for i in range ( n ) : d [ i + 1 ] = 1 * a [ i ] if s [ i ] == ' > ' else - 1 * a [ i ] cell = 1 for i in range ( n ) : cell += ( d [ cell ] ) if cell < 1 or cell > n : print ( " FINITE " ) breakelse : print ( " INFINITE " ) NEW_LINE

n = int ( input ( ) ) s = input ( ) a = list ( map ( int , input ( ) . split ( ) ) ) k = 0 i = 0 while k < n * 4 : if s [ i ] == ' > ' : k += a [ i ] i += a [ i ] else : k += a [ i ] i -= a [ i ] if i < 0 or i >= n : exit ( print ( " FINITE " ) )   print ( " INFINITE " ) NEW_LINE


import java . util . * ; public class BeforeAnExam { public static void main ( String arg [ ] ) { Scanner sc = new Scanner ( System . in ) ; int d = sc . nextInt ( ) ; int sumhours = sc . nextInt ( ) ; int [ ] [ ] ar = new int [ d ] [ 2 ] ; int maxSum = 0 , minSum = 0 ; for ( int i = 0 ; i < d ; i ++ ) { ar [ i ] [ 0 ] = sc . nextInt ( ) ; ar [ i ] [ 1 ] = sc . nextInt ( ) ; maxSum += ar [ i ] [ 1 ] ; minSum += ar [ i ] [ 0 ] ; }    if ( sumhours > maxSum || sumhours < minSum ) { System . out . println ( " NO " ) ; System . exit ( 0 ) ; }   int [ ] dayHours = new int [ d ] ; for ( int i = 0 ; i < d ; i ++ ) { dayHours [ i ] = ar [ i ] [ 1 ] - ar [ i ] [ 0 ] ; }   int [ ] res = new int [ d ] ; int temp = 0 ; for ( int i = 0 ; i < d ; i ++ ) { temp += ar [ i ] [ 0 ] ; res [ i ] = ar [ i ] [ 0 ] ; }    System . out . println ( " YES " ) ; if ( ( temp == sumhours ) ) { for ( int i = 0 ; i < d ; i ++ ) { System . out . print ( res [ i ] + " ▁ " ) ; } } else { int req = sumhours - temp ; for ( int i = 0 ; i < d ; i ++ ) { if ( dayHours [ i ] - req >= 0 ) { res [ i ] += req ; break ; } else { req = req - dayHours [ i ] ; res [ i ] += dayHours [ i ] ;   }   }     for ( int i = 0 ; i < d ; i ++ ) System . out . print ( res [ i ] + " ▁ " ) ; }         } }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . StringTokenizer ;   public class BeforeAnExam { public static void main ( String [ ] args ) { FastReader ( ) ; int t = 1 ; while ( t > 0 ) { solve ( ) ; -- t ; } write . flush ( ) ; write . close ( ) ; } static void solve ( ) { int d = ni ( ) , st = ni ( ) ; int mins = 0 ; int maxs = 0 ; int [ ] min = new int [ d ] ; int [ ] max = new int [ d ] ; for ( int i = 0 ; i < d ; ++ i ) { min [ i ] = ni ( ) ; max [ i ] = ni ( ) ; mins = mins + min [ i ] ; maxs = maxs + max [ i ] ; } if ( st < mins || st > maxs ) { out ( " NO " ) ; } else { out ( " YES " ) ; if ( st == mins ) { for ( int e : min ) { ou ( e + " ▁ " ) ; } } else { int rem = st - mins ; for ( int i = 0 ; i < d ; ++ i ) { if ( rem <= ( max [ i ] - min [ i ] ) ) { min [ i ] = min [ i ] + rem ; rem = 0 ; break ; } else {   rem = rem - ( max [ i ] - min [ i ] ) ; min [ i ] = max [ i ] ; } } for ( int e : min ) { ou ( e + " ▁ " ) ; } } } }

import java . util . * ;   public class BeforeAnExam_B {   public static void main ( String [ ] args ) {

import java . util . HashSet ; import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { int d , sum_time ; int min [ ] = new int [ 100 ] ; int max [ ] = new int [ 100 ] ; int total_max = 0 ; int total_min = 0 ; int [ ] ans = new int [ 100 ] ; int sum = 0 ; int sum_min = 0 ; Scanner in = new Scanner ( System . in ) ; d = in . nextInt ( ) ; sum_time = in . nextInt ( ) ; for ( int i = 1 ; i <= d ; i ++ ) { min [ i ] = in . nextInt ( ) ; max [ i ] = in . nextInt ( ) ; total_max += max [ i ] ; total_min += min [ i ] ; } if ( total_max < sum_time || total_min > sum_time ) { System . out . println ( " NO " ) ; } else { System . out . println ( " YES " ) ; sum_time -= total_min ; int total = 0 ; for ( int i = 1 ; i <= d ; i ++ ) { max [ i ] -= min [ i ] ; total += max [ i ] ; } total -= max [ 1 ] ; for ( int i = 1 ; i <= d ; i ++ ) {

import java . util . * ;   public class solucion2 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int d = scan . nextInt ( ) ; int hs = scan . nextInt ( ) ; int hmin = 0 ; int hmax = 0 ; int [ ] hminarray = new int [ d ] ; int [ ] hmaxarray = new int [ d ] ; for ( int i = 0 ; i < d ; i ++ ) { hminarray [ i ] = scan . nextInt ( ) ; hmin += hminarray [ i ] ; hmaxarray [ i ] = scan . nextInt ( ) ; hmax += hmaxarray [ i ] ; } if ( hs >= hmin && hs <= hmax ) { System . out . println ( " YES " ) ; int reparto = hs - hmin ; for ( int i = 0 ; i < d ; i ++ ) { if ( reparto > hmaxarray [ i ] - hminarray [ i ] ) { reparto -= ( hmaxarray [ i ] - hminarray [ i ] ) ; hminarray [ i ] = hmaxarray [ i ] ; } else { hminarray [ i ] += reparto ; reparto = 0 ; } } for ( int i = 0 ; i < d ; i ++ ) { System . out . print ( hminarray [ i ] + " ▁ " ) ; } } else System . out . println ( " NO " ) ; } }

d , sum_time = map ( int , input ( ) . split ( ) )   min_tim = [ ] max_tim = [ ] for i in range ( d ) : min_time , max_time = map ( int , input ( ) . split ( ) ) min_tim . append ( min_time ) max_tim . append ( max_time ) alloted_sum_time = sum ( min_tim ) for j in range ( len ( min_tim ) ) : if alloted_sum_time < sum_time : x = min ( max_tim [ j ] - min_tim [ j ] , sum_time - alloted_sum_time ) alloted_sum_time += x NEW_LINE

a = [ ] b = [ ] result = [ ] n , s = map ( int , input ( ) . split ( ) ) for i in range ( n ) : c , d = map ( int , input ( ) . split ( ) ) a . append ( c ) result . append ( c ) b . append ( d ) if sum ( a ) <= s <= sum ( b ) : print ( ' YES ' ) remain = s - sum ( a ) for i in range ( n ) : if b [ i ] - a [ i ] <= remain : result [ i ] = b [ i ] remain -= b [ i ] - a [ i ] else : result [ i ] = a [ i ] + remain break for i in result : print ( i , end = ' ▁ ' ) else : print ( ' NO ' ) NEW_LINE

d , sumTime = map ( int , input ( ) . split ( ) ) min_Time = [ ] max_Time = [ ] for i in range ( 0 , d ) : tmp , tmp1 = map ( int , input ( ) . split ( ) ) min_Time . append ( tmp ) max_Time . append ( tmp1 ) res = [ ] if ( sum ( min_Time ) <= sumTime and sum ( max_Time ) >= sumTime ) : remaining_Time = sumTime - sum ( min_Time ) for i in range ( 0 , d ) : res . append ( min_Time [ i ] ) for i in range ( 0 , d ) : if ( remaining_Time == 0 ) : break else : res [ i ] = min ( remaining_Time + min_Time [ i ] , max_Time [ i ] ) remaining_Time -= res [ i ] - min_Time [ i ] print ( " YES " ) for i in range ( 0 , d ) : print ( res [ i ] ) else : print ( " NO " ) NEW_LINE

study_days , sum_of_times = map ( int , input ( ) . split ( ) ) minimals , maximals = [ ] , [ ] for _ in range ( study_days ) : least , most = map ( int , input ( ) . split ( ) ) minimals . append ( least ) maximals . append ( most ) lowest_sum , highest_sum = sum ( minimals ) , sum ( maximals ) if lowest_sum <= sum_of_times <= highest_sum : print ( " YES " ) difference_from_minimum = sum_of_times - lowest_sum index = 0 while difference_from_minimum : if minimals [ index ] < maximals [ index ] : minimals [ index ] += 1 difference_from_minimum -= 1 else : index += 1 print ( " ▁ " . join ( str ( x ) for x in minimals ) ) else : print ( " NO " ) NEW_LINE

def proB ( arr , k ) : sumi = 0 for i in arr : sumi += i [ 0 ] if ( sumi > k ) : print ( ' NO ' ) else : k -= sumi ans = [ ] for i in arr : ans . append ( i [ 0 ] ) if ( i [ 1 ] - i [ 0 ] >= k ) : ans [ - 1 ] += k k = 0 else : ans [ - 1 ] += i [ 1 ] - i [ 0 ] k -= i [ 1 ] - i [ 0 ] if ( k > 0 ) : print ( ' NO ' ) else : print ( ' YES ' ) print ( * ans ) t , k = list ( map ( int , input ( ) . split ( ) ) ) arr = [ ] for i in range ( t ) : arr1 = list ( map ( int , input ( ) . split ( ) ) ) arr . append ( arr1 ) proB ( arr , k ) NEW_LINE


import java . io . IOException ; import java . util . * ; public class VitayAgain { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int arr [ ] = new int [ n ] ; for ( int i = 0 ; i < arr . length ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; } if ( arr [ n - 1 ] == 15 ) { System . out . println ( " DOWN " ) ; return ; } else if ( arr [ n - 1 ] == 0 ) { System . out . println ( " UP " ) ; return ; } if ( n == 1 ) { System . out . println ( - 1 ) ; return ; } System . out . println ( arr [ arr . length - 1 ] > arr [ arr . length - 2 ] ? " UP " : " DOWN " ) ; } }

import java . util . * ;   public class Main {   public static void main ( String [ ] args ) { int n ; int [ ] num = new int [ 100 ] ; Scanner input = new Scanner ( System . in ) ; n = input . nextInt ( ) ; for ( int i = 1 ; i <= n ; i ++ ) { num [ i ] = input . nextInt ( ) ; } if ( num [ n ] == 15 ) { System . out . println ( " DOWN " ) ; } else if ( num [ n ] == 0 ) { System . out . println ( " UP " ) ; } else if ( n == 1 && num [ n ] != 15 && num [ n ] != 0 ) { System . out . println ( - 1 ) ; } else if ( num [ n ] > num [ n - 1 ] ) { System . out . println ( " UP " ) ; } else if ( num [ n ] < num [ n - 1 ] ) { System . out . println ( " DOWN " ) ; } } }

n = int ( input ( ) )   days = [ int ( bruh ) for bruh in input ( ) . split ( ) ]   if days [ - 1 ] == 15 : print ( " DOWN " ) exit ( )   if days [ - 1 ] == 0 : print ( " UP " ) exit ( )   if len ( days ) == 1 : print ( - 1 ) exit ( )   if days [ - 1 ] < days [ - 2 ] : print ( " DOWN " ) exit ( )   if days [ - 1 ] > days [ - 2 ] : print ( " UP " ) exit ( )     NEW_LINE

n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) if n == 1 : if a [ - 1 ] == 15 : print ( ' DOWN ' ) elif a [ - 1 ] == 0 : print ( ' UP ' ) else : print ( - 1 ) elif a [ - 1 ] > a [ - 2 ] : if a [ - 1 ] != 15 : print ( ' UP ' ) else : print ( ' DOWN ' ) else : if a [ - 1 ] != 0 : print ( ' DOWN ' ) else : print ( ' UP ' ) NEW_LINE

t = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) )   if len ( a ) == 1 : if a [ 0 ] == 0 : print ( ' UP ' ) elif a [ 0 ] == 15 : print ( ' DOWN ' ) else : print ( - 1 ) quit ( )   last = a [ - 1 ] prev = a [ - 2 ]   if last == 0 or ( last > prev and last != 15 ) : print ( ' UP ' ) else : print ( ' DOWN ' ) NEW_LINE

n = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) if arr [ n - 1 ] == 15 : print ( " DOWN " ) elif arr [ n - 1 ] == 0 : print ( ' UP ' ) elif n == 1 : print ( - 1 ) else : if arr [ n - 2 ] > arr [ n - 1 ] : print ( ' DOWN ' ) else : print ( " UP " ) NEW_LINE

n = int ( input ( ) ) l = [ int ( x ) for x in input ( ) . split ( ) ]   ans = - 1 if l [ - 1 ] == 15 : ans = ' DOWN ' elif l [ - 1 ] == 0 : ans = ' UP ' elif n == 1 : passelif n > 1 : if l [ - 2 ] > l [ - 1 ] : ans = ' DOWN ' else : ans = ' UP '     print ( ans ) NEW_LINE